Markets and quotes
Two reads, with a key of either scope:
GET /markets: every market, the same list the terminal reads.GET /markets/{symbol}/quote: one market’s last quote and whether it takes orders.
The list
Section titled “The list”{"markets": [...], "source": {"reconnecting", "last_price_ms"}}. Each market:
| Field | |
|---|---|
symbol |
the name every order and route uses |
family |
crypto, stocks, indices, commodities or forex |
unit_e8 |
the size of one market unit: unit_e8 / 100,000,000 of a coin, share or contract |
max_leverage_x |
the market’s leverage ceiling (null: none) |
frozen |
true: no new order (unfreeze_at_ms, the earliest it may end); manual_freeze: frozen by an operator, reduce-only market and limit orders still pass |
reconnecting |
the market waits for prices after a reconnection of the price source |
quote |
{bid_e8, ask_e8, mid_e8, bid_size_e8, ask_size_e8, ts_ms}, null before the first quote |
stats |
the day’s figures: mark_e8, oracle_e8, prev_day_e8, change_bp, day_volume_usd, open_interest_usd, funding_e8, next_funding_ms, ts_ms |
A quote
Section titled “A quote”GET /markets/{symbol}/quote answers symbol, quote (as above), frozen, manual_freeze, unfreeze_at_ms,
now_ms and reconnecting. An unknown symbol is a 404.
A market order fills at the simulator’s price of its own moment, never at a price read earlier: a quote tells you where the market is, not the price you will get.
All numbers are integers.
| What | Unit |
|---|---|
a size (qty, filled_qty, a position’s qty; negative = short) |
market units: one unit is unit_e8 / 100,000,000 of a coin |
an order’s or a position’s price (limit_price, trigger_price, stop_loss, take_profit, avg_price, mark, an execution’s price) |
micro-USD per market unit |
a quote or a day figure (bid_e8, ask_e8, mid_e8, mark_e8…) |
USD per coin × 100,000,000 |
money (balance, equity, headroom, fee, realized_pnl, unrealized_pnl) |
micro-USD: 1,000,000 is 1 USD |
size_usd of an account |
USD |
times (*_ms) |
milliseconds since 1970, UTC |
From one to the other:
- price per coin in USD =
price × 100 / unit_e8 - order price =
quote_e8 × unit_e8 / 10,000,000,000(an integer: round it the way your order needs) - coins =
qty × unit_e8 / 100,000,000
For example, BTC’s unit_e8 is 10000: one unit is 0.0001 BTC, and a coin price of 80,000 USD (an example) is an order
price of 8,000,000. Always read unit_e8 from GET /markets: never assume it.