Skip to main content

Snapshot

Levels are aggregated — one entry per unique price, summed across all resting orders at that price. Prices and quantities are decimal strings. 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 WebSocket token_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

The hash 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:
  1. Open the WebSocket and subscribe to token_book for the tokenId you care about.
  2. Buffer incoming book_snapshot / book_update frames keyed by their envelope seq.
  3. Call GET /api/markets/{symbol}/orderbook?outcome=<the token's outcomeIndex>&depth=100 and read the response hash. The hash covers only the levels returned, so the default depth=50 can’t match a deeper WebSocket book, and the other outcome’s view never matches.
  4. Walk the buffered WS frames to find one with a matching hash — that seq is your alignment point; drop earlier frames, apply later ones onto the REST snapshot.
  5. From there each book_update you apply must produce the same hash as the envelope. If they ever diverge, issue get_book_snapshot to force a fresh server-side snapshot and restart alignment.
The hash domain is identical between REST and WS by construction — 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 with GET /api/orders/open, which lists your own open orders on tradeable markets.