Session
A session as GET /sessions/{session}, create and PATCH give it.
Includes SessionCommon
idstringRequireduserstringRequiredexternal_user_refstringYour ref for the user; left out when the user is no longer linked.
external_refstringRequiredNullableA session's labels: up to 20; keys 1–64 letters, digits or _ . : -; string values up to 200 characters. Never interpreted; filter on them with label.<key>=<value>.
namestringRequiredactive; 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.
status_reasonstringRequiredWho set the status (e.g. partner, admin, rule, time_cap); empty when nobody has.
created_atstring (date-time)Requiredlocked_atstring (date-time)Left out when not locked.
ended_atstring (date-time)Left out until it ends.
replay_timestring (date-time)RequiredNullableThe replay clock as last saved.
locked_replay_timestring (date-time)Where a lock or end froze the replay. Left out otherwise.
startstring (date-time)Where the replay begins.
endstring (date-time)NullableWhere the replay stops; null when the session plays on to the latest data.
dayobjectRequiredDeprecatedThe same window as start and end, under its older name.
Show fields
startstring (date-time)Requiredendstring (date-time)RequiredNullableinstrumentsarray of stringRequiredA decimal amount in the account currency (USD), at most two decimal places.
currencystringRequiredleveragenumberRequiredcommissionobject · CommissionCharged per side on every market: fixed per unit (lot, contract, share; 0–1,000), or percentage of the side's notional (0–100).
Show fields
typestringRequiredvaluenumberRequiredtime_cap_minutesintegerLeft out when there is no cap.
opened_atstring (date-time)When a page first opened it (the time cap runs from here). Left out until then.
time_cap_ends_atstring (date-time)Left out without a cap or before the first open.
blindbooleanRequiredallow_skipbooleanRequiredWhat the developer's page may drive in this session through the terminal SDK: none (the default), replay (play, pause, step, speed, jump, hold) or replay_and_orders (also place orders).
accountobjectRequiredThe account at replay_time.
Show fields
currencystringRequiredA decimal amount in the account currency (USD), at most two decimal places.
A decimal amount in the account currency (USD), at most two decimal places.
A decimal amount in the account currency (USD), at most two decimal places.
A decimal amount in the account currency (USD), at most two decimal places.
valued_atstring (date-time)The replay time open positions were marked at.
unpricedintegerOpen positions that could not be priced at the replay time (equity then leaves them out). Left out when 0.
open_positionsarray of object · SessionPositionLeft out when there are none.
Show item fields
idintegerRequiredinstrumentstringRequiredsidestringRequiredquantitynumberRequiredentry_pricenumberRequiredopened_atstring (date-time)RequiredReplay time.
marknumberLeft out when it couldn't be priced.
unrealized_pnlnumberLeft out when it couldn't be priced.
unpricedstringWhy it couldn't be priced.
working_ordersintegerLeft out when 0.
Closed trades only.
Show fields
tradesintegerRequiredwinsintegerRequiredlossesintegerRequiredwin_ratenumberRequiredgross_profitnumberRequiredgross_lossnumberRequirednet_pnlnumberRequiredprofit_factornumberRequiredNullableaverage_winnumberRequiredaverage_lossnumberRequiredlargest_winnumberRequiredlargest_lossnumberRequiredmax_drawdownnumberRequiredmax_drawdown_pctnumberRequiredrulesobject · RuleSetThe canonical form, returned on read with every default filled in and every id present.
Show fields
day_resetobjectShow fields
timestringtzstringAn IANA time zone.
rulesarray of object · RuleShow item fields
idstringYour name for the rule; defaults to its type (then type_2, …). Breaches name it.
typestringRequiredOne of
daily_loss
type"daily_loss"RequiredAn amount (a bare number, or {"amount": n}), or {"percent": n} of the starting balance.
Show options
One of
number
With amount
amountnumberRequiredWith percent
percentnumberRequiredbasisstringMeasured from the start-of-day balance or equity.
on_breachstringmax_drawdown
type"max_drawdown"RequiredAn amount (a bare number, or {"amount": n}), or {"percent": n} of the starting balance.
Show options
One of
number
With amount
amountnumberRequiredWith percent
percentnumberRequiredmodestringfixed from the starting balance; trailing from the peak.
peakstringTrailing only: what the peak follows (equity is updated on every price change).
stop_at_starting_balancebooleanTrailing only: the floor stops rising once it reaches the starting balance.
on_breachstringmax_position_size
type"max_position_size"Requiredlimitone of 2 typesRequiredThe 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
With units
unitsnumberRequiredon_breachstringmax_open_positions
type"max_open_positions"Requiredlimitone of 2 typesRequiredShow options
One of
integer
With count
countintegerRequiredon_breachstringprofit_target
type"profit_target"RequiredAn amount (a bare number, or {"amount": n}), or {"percent": n} of the starting balance.
Show options
One of
number
With amount
amountnumberRequiredWith percent
percentnumberRequiredbasisstringReached when equity hits it, or when an exit brings the closed balance to it. The recorded result is the closed balance.
slippage
type"slippage"RequiredticksintegerRequiredEvery market and stop fill moves this many ticks against the trader. Limits never slip. A cost, never a breach.
breachesobjectRequiredShow fields
countintegerRequiredlastobject · BreachThe newest breach. Left out when there are none.
Show fields
idstringRequiredrule_idstringRequiredrule_typestringRequiredperiodstringThe trading day (YYYY-MM-DD) for daily rules.
limitnumberRequiredThe rule's limit, in unit.
valuenumberRequiredWhat was observed, in unit.
unitstringRequiredThe same for sessions and demo accounts: money (a decimal in the account currency)
for money rules, units (lots, contracts, coins or shares, up to three decimals) for
max_position_size, count (a whole number) for max_open_positions.
atstring (date-time)RequiredThe crossing: replay time for backtests (the bar's time), the exact price change for demo accounts.
at_precisionstringRequiredbetween: across a gap in our price records, the crossing was between window_start and window_end.
window_startstring (date-time)window_endstring (date-time)pricesobjectRequiredNullableDemo accounts: the bid/ask by market at the crossing. Sessions: {}.
actionstringRequiredaction_appliedbooleanRequiredfalse when Chartnaut has paused rule actions for you (an emergency stop): the breach is stored and nothing is done.
detected_atstring (date-time)Requireddetected_bystringRequiredWhere it was found: client or replay for sessions; sweep (a price change) or event (a fill, close or adjustment) for demo accounts.
