Skip to content

Money, time and paging ​

Decimals are strings ​

Prices, volumes, money and rates are strings ("1.08452", "0.10"). Never turn them into JavaScript numbers for arithmetic: use a decimal library, and send strings back.

ts
import Decimal from "decimal.js"
const equity = new Decimal(account.money.equity)

Socket prices come decoded to strings as well (see Live socket).

Time ​

Times are RFC 3339 in UTC; show them in the user's zone. Fields that say server time (day end, sessions, switches) are wall times of the trading server's clock: staff.serverTime.retrieve().

Logins and group paths ​

Logins are positive integers. Group paths use a backslash (real\standard; in JavaScript "real\\standard"). The SDK URL-encodes path parameters for you; masks like real\* work where a method says so.

Paging ​

Paged lists take page (1-based) and limit and answer { items, total, page }. Fast-growing logs page by cursor with before. Lists are never null. See the paging recipe.

Changing things ​

  • PATCH changes only the fields you send. Resources with a version need the version you last read; a stale one answers conflict.
  • Bodies are strict: an unknown field is refused with invalid_input. The types catch most of these at compile time.
  • Every staff change writes a journal line: staff.journal.list().