Query order book depth (one-time)
Fetch a single order book snapshot without subscribing to updates.params: [market, limit, price_interval]. Maximum limit: 100. Set price_interval to "0" for no grouping.
Request
Response
Subscribe to order book depth
Public
depth updates exclude Retail Price Improvement (RPI) orders. The stream includes only regular order book liquidity.Maintaining a local order book
To maintain an accurate local order book:- Subscribe and wait for the first message (
params[0]istrue) — initialize order book from snapshot - For each incremental update: if amount is
"0"remove the price level; otherwise update or insert at the correct sorted position - Keep asks sorted ascending, bids sorted descending
- Truncate to your desired limit after each update
Update model
First message (past_update_id absent): Full order book snapshot. Replace any existing local state.
Subsequent messages (past_update_id present): Incremental deltas. Apply each price level change to the local book.
Ordering guarantees
- Updates arrive in
update_idorder. Each incremental message’spast_update_idmatches the previous message’supdate_id. - If 10 seconds pass without activity, the server sends a full snapshot (
params[0]istrue, nopast_update_id) as a keepalive. Treat this as a full reset. - A gap between
past_update_idand the storedupdate_idindicates a missed message — re-subscribe to resync.