L3 Book
Order-level data with basic fields. Sends an initial snapshot followed by incremental diffs.
{"method": "subscribe", "subscription": {"type": "l3Book", "coin": "BTC"}}Set "snapshot": false to skip the initial snapshot.
Data format: L3BookSnapshot | L3BookUpdates
Applying Diffs
Diffs may arrive before the snapshot. Use sequence and height to apply them correctly:
- Cache incoming diffs while waiting for the snapshot
- When the snapshot arrives, note its
heightandsequence - Apply a diff only if:
diff.height >= snapshot.height && diff.sequence > snapshot.sequence - Discard diffs that don't meet this condition
Diff Types
type RawBookDiff =
| { New: { sz: string } }
| { Update: { origSz: string; newSz: string } }
| 'Remove';