ChartnautDocs

Read an account

GET/accounts/{account}
Base URL
https://api.chartnaut.com/partner/v1
Auth
Bearer key
Operation ID
getAccount

A demo account you created needs demo_accounts:read: balance, the live valuation (equity, floating P&L, margin), open positions, lock state, rules and a breaches summary. Only a single read has valuation, positions and breaches. valuation is left out when the account can't be valued now.

One of the user's own accounts (an id from origin=user) needs accounts:read and answers a UserAccount; its open positions are at /accounts/{account}/positions and its closed trades at /accounts/{account}/trades. An account of a user who isn't linked to your app is 404 not_found, as if it didn't exist; a linked user who didn't grant accounts:read is 403 scope_not_granted.

Path parameters#

accountstringRequired
Pattern ^acc_[0-9]+$Example acc_5521

Responses#

200OKapplication/json

The account.

one of 2 types

One of

Account

A demo account you created. valuation, positions and breaches are on GET /accounts/{account} and the create answer only; list items and the PATCH answer leave them out.

idstringRequired
Pattern ^acc_[0-9]+$
userstringRequired
Pattern ^usr_[0-9]+$
display_namestringRequired
external_refstringRequiredNullable
labelsmap of string · AccountLabelsRequired

A demo account's labels: up to 20; keys 1–40 lower-case letters, digits or _ . -, starting with a letter or digit; string values up to 100 bytes. Never interpreted; filter on them with label.<key>=<value>.

statusstring · SubjectStatusRequired

active; locked (by you or Chartnaut; a demo account also locks when its user unlinks); and the final ones: ended (you, the user, Chartnaut or a session's time cap ended it; status_reason says who), breached (a close_and_end rule fired), completed_to_target (the profit target was reached; everything was closed). A block_order breach refuses new orders but leaves the status active.

One of active locked ended breached completed_to_target
locked_atstring (date-time)RequiredNullable
locked_bystring

Who locked it (system: the user unlinked). Left out when not locked.

One of partner rule admin system
status_reasonstring

Left out when empty.

ended_atstring (date-time)RequiredNullable
currencystringRequired
Only USD
starting_balancenumber · MoneyRequired

A decimal amount in the account currency (USD), at most two decimal places.

Example 10000
leveragenumberRequired
balancenumber · MoneyRequired

A decimal amount in the account currency (USD), at most two decimal places.

Example 10000
created_atstring (date-time)Required
rulesobject · RuleSetRequired

The rule set as stored; {} when there is none.

Show fields
day_resetobject
Show fields
timestring
Default 17:00Pattern ^[0-2][0-9]:[0-5][0-9]$
tzstring

An IANA time zone.

Default America/New_York
rulesarray of object · Rule
At most 50 items
Show item fields
idstring

Your name for the rule; defaults to its type (then type_2, …). Breaches name it.

Pattern ^[A-Za-z0-9_.:-]{1,64}$
typestringRequired
One of daily_loss max_drawdown max_position_size max_open_positions profit_target slippage

One of

daily_loss
type"daily_loss"Required
limitone of 3 types · MoneyLimitRequired

An amount (a bare number, or {"amount": n}), or {"percent": n} of the starting balance.

Show options

One of

number
More than 0
With amount
amountnumberRequired
More than 0
With percent
percentnumberRequired
More than 0, at most 100
basisstring

Measured from the start-of-day balance or equity.

One of balance equityDefault balance
on_breachstring
One of record block_order close_and_endDefault record
max_drawdown
type"max_drawdown"Required
limitone of 3 types · MoneyLimitRequired

An amount (a bare number, or {"amount": n}), or {"percent": n} of the starting balance.

Show options

One of

number
More than 0
With amount
amountnumberRequired
More than 0
With percent
percentnumberRequired
More than 0, at most 100
modestring

fixed from the starting balance; trailing from the peak.

One of fixed trailingDefault fixed
peakstring

Trailing only: what the peak follows (equity is updated on every price change).

One of equity balanceDefault equity
stop_at_starting_balanceboolean

Trailing only: the floor stops rising once it reaches the starting balance.

Default false
on_breachstring
One of record block_order close_and_endDefault record
max_position_size
type"max_position_size"Required
limitone of 2 typesRequired

The largest position per market, in units as the platform shows them (lots, contracts, coins, shares), up to three decimals: a number or {"units": n}.

Show options

One of

number
More than 0
With units
unitsnumberRequired
More than 0
on_breachstring
One of record block_order close_and_endDefault record
max_open_positions
type"max_open_positions"Required
limitone of 2 typesRequired
Show options

One of

integer
At least 1
With count
countintegerRequired
At least 1
on_breachstring
One of record block_order close_and_endDefault record
profit_target
type"profit_target"Required
targetone of 3 types · MoneyLimitRequired

An amount (a bare number, or {"amount": n}), or {"percent": n} of the starting balance.

Show options

One of

number
More than 0
With amount
amountnumberRequired
More than 0
With percent
percentnumberRequired
More than 0, at most 100
basisstring

Reached when equity hits it, or when an exit brings the closed balance to it. The recorded result is the closed balance.

One of equity balanceDefault equity
slippage
type"slippage"Required
ticksintegerRequired

Every market and stop fill moves this many ticks against the trader. Limits never slip. A cost, never a breach.

0 to 10,000
valuationobject

Valued now from the engines' last prices. Single read only, and left out when it can't be valued.

Show fields
atstring (date-time)Required
equitynumberRequired
floating_pnlnumberRequired
used_marginnumberRequired
free_marginnumberRequired
margin_levelnumberRequiredNullable
stalebooleanRequired

A position could not be priced, or a quote is old.

positionsarray of object

Open positions. Single read only, and left out when there are none.

Show item fields
idintegerRequired
instrumentstringRequired
sidestringRequired
One of Long Short
quantitynumberRequired
entry_pricenumberRequired
opened_atstring (date-time)Required
pendingbooleanRequired

The entry has not filled yet.

floating_pnlnumberRequiredNullable
breachesobject

Single read only.

Show fields
countintegerRequired
latest_atstring (date-time)RequiredNullable
UserAccount

One of the user's own accounts (origin=user, read-only): their Chartnaut Demo account or a broker account they linked, never one you created. balance and equity are as Chartnaut last stored them. Its open positions and closed trades are read by id (/accounts/{account}/positions, /accounts/{account}/trades).

idstringRequired

For GET /accounts/{account}, /positions and /trades (accounts:read).

Pattern ^acc_[0-9]+$
brokerstringRequired

The broker, e.g. chartnaut_demo, mt4, mt5, ctrader, tradelocker, rithmic.

display_namestringRequired
currencystringRequired
balancenumberRequired
equitynumberRequired
starting_balancenumberRequired
leveragenumberRequired
created_atstring (date-time)Required
ErrorAny other statusapplication/json

Error. Every response to a request whose key checked out, errors included, carries RateLimit-Limit (requests a minute), RateLimit-Remaining and RateLimit-Reset (seconds until the minute resets). A 401, the 403 switched_off when the whole API is off for you, and the 429 for too many bad keys from one IP come before that check and carry none. A 429 also carries Retry-After (seconds).

Headers

RateLimit-Limitinteger
RateLimit-Remaininginteger
RateLimit-Resetinteger
Retry-Afterinteger

Body

object · Error
errorobject · ErrorBodyRequired
Show fields
codestringRequired

Stable. Branch on this, never on message.

Code Status Meaning
unauthorized 401 missing, unknown or revoked key (no RateLimit headers)
scope_not_granted 403 the user didn't grant details.scope
forbidden 403 your partner account isn't allowed this (details.reason, e.g. no_access for frame:live when live mode isn't enabled for you; details.scope)
permission_denied 403 this key lacks the key permission the call needs (details.permission, e.g. users:export; details.reason: "key_permission"): use a key that has it, or add it in the partner portal
not_managed 409 the call is for managed users only, and this user is linked (their own Chartnaut account and plan apply; details.reason: "not_managed")
switched_off 403 this part of the API is paused for you (everything, writes, frames, links, demo account creation, bulk actions); contact [email protected]
not_linked 404 the user isn't linked to you (details.user when the user was named in the request)
not_found 404 no such object for you; an id of the wrong type or shape is this too
conflict 409 external_ref already used (sessions: details.existing_id; accounts: details.field); the same Idempotency-Key still running; lock or unlock on an ended session
expected_count_mismatch 409 a bulk action matched a different number (details.expected, details.actual)
invalid_request 400 malformed body or unknown field (named in message, no details), a bad field (details.field where the endpoint names it), bad id, missing Idempotency-Key, invalid rules. Also 413 for a body over 2 MiB
idempotency_key_reused 422 the Idempotency-Key was used with a different path or body
plan_limit 422 / 403 the user's Chartnaut plan doesn't allow it (details.reason), or your developer plan's cap (details.owner: "developer", details.limit: apps (an app past your plan's count after a downgrade takes no new users), free_linked, managed_users, data; with used, cap). No auto top-up: upgrade on the Developers page
seat_limit 403 your Business seats are full this month (details.limit seats or pro_seats, used, cap): a new managed user can't start until you add seats; users active this month carry on
partner_limit 422 one of your partner limits (details.limit, and for demo accounts details.max)
rate_limited 429 your rate limit: details.limit is rate_minute or rate_burst. Also, with no details and Retry-After: 60, any call from an IP that sent 30 bad keys this minute, good keys included. See Retry-After
internal 500 retry; if it persists contact [email protected]
One of unauthorized scope_not_granted forbidden permission_denied not_managed not_linked plan_limit seat_limit partner_limit not_found conflict expected_count_mismatch rate_limited idempotency_key_reused switched_off invalid_request internal
messagestringRequired
detailsobject