Messages
{
"type": "orderbook_snapshot",
"sending_ts_ms": 1669149841234,
"sid": 2,
"seq": 2,
"msg": {
"market_ticker": "FED-23DEC-T3.00",
"market_id": "9b0f6b43-5b68-4f9f-9f02-9a2d1b8ac1a1",
"clock": 4182057,
"yes_dollars_fp": [
[
"0.0800",
"300.00"
],
[
"0.2200",
"333.00"
]
],
"no_dollars_fp": [
[
"0.5400",
"20.00"
],
[
"0.5600",
"146.00"
]
]
}
}{
"type": "orderbook_delta",
"sending_ts_ms": 1669149841123,
"sid": 2,
"seq": 3,
"msg": {
"market_ticker": "FED-23DEC-T3.00",
"market_id": "9b0f6b43-5b68-4f9f-9f02-9a2d1b8ac1a1",
"clock": 4182061,
"price_dollars": "0.9600",
"delta_fp": "-54.00",
"side": "yes",
"ts": "2022-11-22T20:44:01Z",
"ts_ms": 1669149841000
}
}WebSockets
Orderbook Updates
Real-time orderbook price level changes. Provides incremental updates to maintain a live orderbook.
Requirements:
- Authentication required
- Market specification required:
- Use
market_ticker(string) for a single market - Use
market_tickers(array of strings) for multiple markets market_id/market_idsare not supported for this channel and never select a market. A firstsubscribethat gives onlymarket_id/market_idsis acknowledged withsubscribedbut receives no snapshots or deltas. On an existing subscription, asubscribe,add_marketsordelete_marketsthat gives only IDs returnsokand changes nothing, so the markets already subscribed keep streaming;get_snapshotwith only IDs returns error code 14
- Use
- Sends
orderbook_snapshotfirst, then incrementalorderbook_deltaupdates - Supports
update_subscriptionwithadd_markets/delete_markets/get_snapshotactions get_snapshotreturns anorderbook_snapshotfor the requestedmarket_tickerswithout changing the subscribed markets. Apply every returned snapshot as a replacement for that market’s local book- Each connection has one
orderbook_deltasubscription. A repeatedsubscribeadds new markets to its existingsid; it does not resend snapshots for markets already subscribed - A subscription holds at most 500,000 markets. A
subscribeoradd_marketsthat would exceed this returns error code 26 and adds none of its markets - When a market is determined, the server sends an empty
orderbook_snapshotfor it and removes it from the subscription. No further messages follow for that market and there is no separate notification; replace your local book with the empty snapshot - A repeated
subscribemust use the existingupdate_interval_ms(omitting it means0). A different valid interval returns error code 11 without adding markets. Useupdate_subscriptionwithadd_marketsto add markets without respecifying the interval. To change the interval,unsubscribe, wait forunsubscribed, thensubscribeagain
Matching real-time updates across connections:
These guarantees apply to subscriptions created in real-time mode (the initial update_interval_ms is omitted or 0). Conflated subscriptions have the separate clock and recovery rules below.
clockis the exchange clock. It is the same on every connection, so it can match a market’s updates across redundant connections;seqcounts messages on one subscription only- One exchange action can make several deltas, so several deltas can share a
clock. Every connection sends them in the same order, before any delta for that market with a higherclock - A snapshot includes every change with a
clockat or below its own; the deltas that follow it on that connection have higher clocks - While you are subscribed to a market, its clocks never go down outside exchange maintenance, but they skip values. They are not comparable across markets. Keep checking
seqon each connection for missed messages - A market’s clock may decrease during exchange maintenance, so don’t compare clocks from before a maintenance period with clocks after it
Conflated updates (opt-in):
- Set
update_interval_msto100or1000on the initialsubscribeto receive conflated updates instead of oneorderbook_deltaper change. Omit it or set it to0for real-time updates, the default - Each window produces one
orderbook_deltaper changed price level, carrying the net held change at that level. Levels whose held changes cancel out are skipped. Apply every delta in sequence to account for those changes exactly - Each window’s flush is scheduled one interval after that window’s first held change; processing and transport latency are additional.
clock,tsandts_msare those of the latest change included in each delta - A conflated delta’s
clockdescribes that price level’s latest included change, not the completeness of the whole book. Clocks can decrease between messages, including when an immediate own-order update overtakes a held public update. Do not discard a delta because its clock is lower than a previously received clock - Updates to your own orders bypass the interval, with the usual
client_order_idandsubaccountannotations when available. For a subaccount-restricted key, this applies only to orders within that restriction. Changes to other participants’ orders, including liquidity your trades consume, are held like other public changes - Snapshots bypass the interval and replace any unsent held changes for their market. Always replace your local book with a received snapshot before applying subsequent deltas for that market
- Between flushes, public levels can lag your own orders, and the book can appear locked or crossed. A flush contains separate delta messages, not an atomic full-book snapshot; there is no end-of-flush message
seqstays contiguous; the interval is fixed for the life of the subscription- Apply every delta in
seqorder within its subscription. If you detect a gap, requestget_snapshotfor all subscribed markets, orunsubscribe, wait forunsubscribed, thensubscribeagain. A repeatedsubscribealone does not resynchronize existing markets - Conflation windows are independent across subscriptions, so the same clock can accompany different net deltas on different connections. Do not merge or deduplicate conflated streams by clock. When switching connections, rebuild from that connection’s snapshot and follow its own
seq
Use case: Building and maintaining a real-time orderbook
WSS
orderbook_delta
Messages
{
"type": "orderbook_snapshot",
"sending_ts_ms": 1669149841234,
"sid": 2,
"seq": 2,
"msg": {
"market_ticker": "FED-23DEC-T3.00",
"market_id": "9b0f6b43-5b68-4f9f-9f02-9a2d1b8ac1a1",
"clock": 4182057,
"yes_dollars_fp": [
[
"0.0800",
"300.00"
],
[
"0.2200",
"333.00"
]
],
"no_dollars_fp": [
[
"0.5400",
"20.00"
],
[
"0.5600",
"146.00"
]
]
}
}{
"type": "orderbook_delta",
"sending_ts_ms": 1669149841123,
"sid": 2,
"seq": 3,
"msg": {
"market_ticker": "FED-23DEC-T3.00",
"market_id": "9b0f6b43-5b68-4f9f-9f02-9a2d1b8ac1a1",
"clock": 4182061,
"price_dollars": "0.9600",
"delta_fp": "-54.00",
"side": "yes",
"ts": "2022-11-22T20:44:01Z",
"ts_ms": 1669149841000
}
}apiKey
type:apiKey
API key authentication required for WebSocket connections. The API key should be provided during the WebSocket handshake.
Orderbook Snapshot
type:object
Complete view of the order book's aggregated price levels
Orderbook Delta
type:object
Update to be applied to the current order book view