Snapshot
depth defaults to 50 (maximum 500). Levels whose total
size is below a small dust threshold are left out, the same as on the
WebSocket book frames.
On a binary market both outcomes share one book. outcome=0 (the
default) returns the YES view, where a NO bid at price p appears as
a YES ask at 1 − p; outcome=1 returns the mirrored NO view.
Live updates
For real-time book updates use the WebSockettoken_book channel.
See WebSocket messages.
The REST snapshot carries no sequence number — seq / prevSeq
exist only on WebSocket token_book frames. Align the two with the
hash field (below); if your local copy drifts, request a fresh
snapshot.
Reconciliation with the WebSocket feed
Thehash field is a canonical 16-hex SHA-256 prefix over the
(bids, asks) pair — price + quantity only, computed identically on
this response and on the WebSocket book_snapshot and book_update
envelopes. For the same logical book state both produce identical
hashes.
Typical reconciliation flow:
- Open the WebSocket and subscribe to
token_bookfor the tokenId you care about. - Buffer incoming
book_snapshot/book_updateframes keyed by their envelopeseq. - Call
GET /api/markets/{symbol}/orderbook?outcome=<the token's outcomeIndex>&depth=100and read the responsehash. The hash covers only the levels returned, so the defaultdepth=50can’t match a deeper WebSocket book, and the other outcome’s view never matches. - Walk the buffered WS frames to find one with a matching
hash— thatseqis your alignment point; drop earlier frames, apply later ones onto the REST snapshot. - From there each
book_updateyou apply must produce the samehashas the envelope. If they ever diverge, issueget_book_snapshotto force a fresh server-side snapshot and restart alignment.
count is excluded from the hash on both sides, so an aggregated
REST response (no count) and a book_snapshot.data (with count)
produce the same hash for the same (bids, asks).
Cross-reference
The orderbook is the aggregated view of resting orders. For your own orders, always cross-reference withGET /api/orders/open, which
lists your own open orders on tradeable markets.