WebSocket API
Order Book Channel
Snapshot and incremental depth updates for a market
Channel name: book
Subscription
{ "op": "sub", "channel": "book", "params": { "market": "BTC-PERP" } }params.market is required.
Message Types
Snapshot
Sent immediately after subscribing. Contains the order book state from the last throttled emission, not the real-time state at subscription time. Because updates are diffs computed against this same baseline, the snapshot and subsequent updates are always consistent, preventing checksum mismatches. The snapshot may lag the real-time book by up to 25ms; the first update message corrects any drift.
{
"channel": "book",
"filter": "BTC-PERP",
"type": "snapshot",
"data": {
"bids": [
["50000.00", "1.5"],
["49999.00", "2.3"]
],
"asks": [
["50001.00", "1.2"],
["50002.00", "3.1"]
],
"checksum": 1226559413
},
"ts": "1234567890000000000",
"gsn": 12345
}Update
Incremental updates to individual price levels.
{
"channel": "book",
"filter": "BTC-PERP",
"type": "update",
"data": {
"bids": [["50000.00", "2.0"]],
"asks": [],
"checksum": 1588788772
},
"ts": "1234567890000000000",
"gsn": 12346
}Fields
| Field | Type | Description |
|---|---|---|
channel | string | Always "book" |
filter | string | Market ID (e.g. "BTC-PERP") |
type | string | "snapshot" or "update" |
data.bids | string[][] | Bid levels as [px, sz] pairs, sorted high to low |
data.asks | string[][] | Ask levels as [px, sz] pairs, sorted low to high |
data.checksum | number | CRC32-IEEE checksum for integrity validation |
ts | string | Timestamp in nanoseconds |
gsn | number | Global sequence number |
Update Rules
- Size
"0"removes the level. - Size
> 0inserts or replaces the level. - Apply updates in stream order for each
filter(market). - Updates are throttled to one per 25ms per market. Events within the same 25ms window are coalesced into a single diff.
Integrity
Validate checksum after every message. On mismatch, resubscribe to rebuild local state.
See Order Book Checksum.