Quick example
Node.js
Commands
Every command carries anid you choose; the reply echoes it.
Subscribe to a series, not a window, to follow it automatically. With
series_tickers: ["sol-15m"], each new window’s window_lifecycle event and first orderbook_snapshot arrive on the same subscription — no resubscribing every 15 minutes. You can pass up to 100 tickers per command.
Channels
Private channels (
fill, user_orders, market_positions, balance) arrive with order entry; today they answer error 8 (AUTH_REQUIRED).
Prices
AAPL) or crypto (X:BTCUSD), upper case, up to 64 per command. t_ms is when the price printed at its source; ts_ms is when the server sent it. These are the same prices windows open and settle on.
Sequence numbers and recovery
Every data message has the envelope{ type, sid, seq, ts_ms, msg }. seq starts at 1 and goes up by exactly 1 per message on that subscription.
- If
seqjumps, you missed messages. Sendupdate_subscriptionwithaction: "get_snapshot"(or resubscribe) and drop your local books until fresh snapshots arrive. - Snapshots carry the whole book; deltas carry one level. A delta means: the contracts at
priceonoutcome’s bid side change bydelta. A level that reaches 0 is removed.
Checksums
Everyorderbook_snapshot and orderbook_delta carries the checksum of the book after it is applied. Compute it on your side after each message; if it doesn’t match, your copy is wrong — request a snapshot.
- Take each side’s levels best first (highest price first) and keep the top 10.
- Write each level as
price:count, exactly as sent on the wire:0.55:10. - Join a side’s levels with
,, prefix them withup:anddown:, and join the two sides with|:up:0.55:10,0.54:3|down:0.44:7(an empty side is justup:ordown:). - The checksum is the CRC-32 (the zlib / PNG one) of that string’s UTF-8 bytes, as an unsigned 32-bit integer.
Limits
The server pings every 10 seconds; standard websocket clients answer automatically. A connection that stops answering is closed. Flooding commands closes the connection with code
1008, and a message over 64 KB with 1009. See Errors for the numbered error replies.