The three carriers
Order book state reaches you through three channels. All three carry the identical payload shape, so one parser handles all of them.
A fourth event,
MARKET_UPDATE,
reaches subscribed markets too — but it carries status transitions only and
never any book data. A client that subscribes and listens only for
MARKET_UPDATE will sit silent until a market halts or resumes.
Replace, never merge
The reason is that a price level which has been fully consumed is omitted from the arrays. It is not sent with quantity0, and there is no “removed
levels” field. Absence is the only signal.
yes_bids: [[63, 120], [62, 340]], the 62¢ level trades
out, and the next message is yes_bids: [[63, 120]]. Replacing gives you the
truth. Merging leaves 340 contracts resting at 62¢ in your UI forever.
Why throttling is safe
Depth is coalesced to at most one update per second per market. Within each window the server keeps only the newest state and discards the intermediate ones outright — they are never sent, and never resent later. That is lossless precisely because every message is a full snapshot. The update you receive already reflects everything the dropped ones would have told you. This is also why there is no sequence number and nothing to request a replay of: there is no gap to detect. If you can see the latest snapshot, you are fully caught up. The trade-off is that you cannot reconstruct the path the book took between updates. If you need every intermediate state, the trade feed (NEW_TRADE) is the event-by-event
record; the depth feed is a sampled view of state.
subscriptionType: "realtime" is accepted and acknowledged, but a realtime
subscriber currently receives no ORDERBOOK_DEPTH messages — only the
one-off initial_orderbooks snapshot and MARKET_UPDATE events. Subscribe as
throttled (the default) until this is addressed.Seeding a book
Because REST andinitial_orderbooks return the same shape, either can seed
you. Prefer the WebSocket path — it removes the race between fetching a snapshot
and the first push arriving:
GET /orderbook/orderbook when you want depth without holding a connection — a
server-side valuation job, say. Note it is cached for 60 seconds, so it is not
a substitute for the live feed.
Confirming what you subscribed to
Thesubscribed acknowledgement is not a validity check. The server joins a
room for every id it is handed, valid or not, and echoes them all back in
marketIds. A typo looks exactly like a real market.
missingMarkets is the only failure signal. Without checking it you will wait
indefinitely for depth on a market that does not exist.
Reading the payload
yes_bids/no_bidsare[price, quantity]pairs, best price first.- Prices are cents, 1–99. YES and NO are complementary — a YES bid at 63 and a NO bid at 37 price the same contract at 100.
bestYesBid/bestNoBidare conveniences derived fromyes_bids[0][0]andno_bids[0][0]. They arenullwhen that side is empty; an empty side is[], notnull.timestampis unix milliseconds at snapshot generation. Over REST on a cache hit this is the age of the cached copy, not of your request.
