ChartnautDocs

Session

A session as GET /sessions/{session}, create and PATCH give it.

object

Includes SessionCommon

idstringRequired
Pattern ^ses_[0-9]+$
userstringRequired
Pattern ^usr_[0-9]+$
external_user_refstring

Your ref for the user; left out when the user is no longer linked.

external_refstringRequiredNullable
labelsmap of string · LabelsRequired

A 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>.

namestringRequired
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
status_reasonstringRequired

Who set the status (e.g. partner, admin, rule, time_cap); empty when nobody has.

created_atstring (date-time)Required
locked_atstring (date-time)

Left out when not locked.

ended_atstring (date-time)

Left out until it ends.

replay_timestring (date-time)RequiredNullable

The 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)Nullable

Where the replay stops; null when the session plays on to the latest data.

dayobjectRequiredDeprecated

The same window as start and end, under its older name.

Show fields
startstring (date-time)Required
endstring (date-time)RequiredNullable
instrumentsarray of stringRequired
starting_balancenumber · MoneyRequired

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

Example 10000
currencystringRequired
leveragenumberRequired
commissionobject · Commission

Charged 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
typestringRequired
One of fixed percentage
valuenumberRequired
At least 0
time_cap_minutesinteger

Left 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.

blindbooleanRequired
allow_skipbooleanRequired
page_controlstring · PageControlRequired

What 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).

One of none replay replay_and_ordersDefault none
accountobjectRequired

The account at replay_time.

Show fields
currencystringRequired
balancenumber · MoneyRequired

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

Example 10000
equitynumber · MoneyRequired

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

Example 10000
realized_pnlnumber · MoneyRequired

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

Example 10000
unrealized_pnlnumber · MoneyRequired

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

Example 10000
valued_atstring (date-time)

The replay time open positions were marked at.

unpricedinteger

Open positions that could not be priced at the replay time (equity then leaves them out). Left out when 0.

open_positionsarray of object · SessionPosition

Left out when there are none.

Show item fields
idintegerRequired
instrumentstringRequired
sidestringRequired
One of long short
quantitynumberRequired
entry_pricenumberRequired
opened_atstring (date-time)Required

Replay time.

marknumber

Left out when it couldn't be priced.

unrealized_pnlnumber

Left out when it couldn't be priced.

unpricedstring

Why it couldn't be priced.

working_ordersinteger

Left out when 0.

statsobject · StatsRequired

Closed trades only.

Show fields
tradesintegerRequired
winsintegerRequired
lossesintegerRequired
win_ratenumberRequired
gross_profitnumberRequired
gross_lossnumberRequired
net_pnlnumberRequired
profit_factornumberRequiredNullable
average_winnumberRequired
average_lossnumberRequired
largest_winnumberRequired
largest_lossnumberRequired
max_drawdownnumberRequired
max_drawdown_pctnumberRequired
rulesobject · RuleSet

The canonical form, returned on read with every default filled in and every id present.

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
breachesobjectRequired
Show fields
countintegerRequired
lastobject · Breach

The newest breach. Left out when there are none.

Show fields
idstringRequired
Pattern ^brk_[0-9]+$
rule_idstringRequired
rule_typestringRequired
periodstring

The trading day (YYYY-MM-DD) for daily rules.

limitnumberRequired

The rule's limit, in unit.

valuenumberRequired

What was observed, in unit.

unitstringRequired

The 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.

One of money units count
atstring (date-time)Required

The crossing: replay time for backtests (the bar's time), the exact price change for demo accounts.

at_precisionstringRequired

between: across a gap in our price records, the crossing was between window_start and window_end.

One of exact between bar
window_startstring (date-time)
window_endstring (date-time)
pricesobjectRequiredNullable

Demo accounts: the bid/ask by market at the crossing. Sessions: {}.

actionstringRequired
One of record block_order close_and_end complete
action_appliedbooleanRequired

false when Chartnaut has paused rule actions for you (an emergency stop): the breach is stored and nothing is done.

detected_atstring (date-time)Required
detected_bystringRequired

Where it was found: client or replay for sessions; sweep (a price change) or event (a fill, close or adjustment) for demo accounts.

One of sweep event replay client

Used by#