book channel delivers a normalized orderbook: a full snapshot first,
then delta frames carrying only the levels that changed. It’s the default
channel when you omit channels on subscribe.
Prices and sizes
Every market is normalized to one scale, regardless of venue:
A
Level is { price, size }. A snapshot carries separate bids and asks
arrays of levels; a delta carries a flat list of changes, where each change
is { side, price, size } and size: 0 means that price level is now gone.
snapshot and delta
snapshot replaces your local book. A delta mutates it: each change
is { side, price, size }, and size: 0 deletes that price level. We
deliberately don’t distinguish add / update / remove — it’s always “set this
level to this size, where 0 means gone.”
venueTimestamp is the venue’s timestamp for the underlying event;
serverTimestamp is when we emitted the frame.
A minimal apply loop:
Sequencing and resync
Per subscription,seq is a monotonically increasing integer that we assign
at ingestion (not the venue). The core guarantee for the book channel:
We never send a
delta whose seq is not exactly the previous seq + 1. If
we otherwise would, we send a snapshot instead.- The first frame on a book subscription is always a
snapshot. - On a venue gap or upstream reconnect, you get
status: resyncing, then a freshsnapshot, thendeltas resume. Drop your book onresyncingand trust the next snapshot. - A mid-stream
snapshot(seq jumps via a snapshot rather than a +1 delta) is normal and expected — replace your book and carry on.
seq per
subscription; if a delta ever arrives where seq !== last + 1, you can simply
wait for the snapshot that the contract guarantees is coming.
The trade channel has its own per-market sequence space and
no resync mechanics — its seq works differently, so don’t apply book
reasoning to it.