Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

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:

  1. Cache incoming diffs while waiting for the snapshot
  2. When the snapshot arrives, note its height and sequence
  3. Apply a diff only if: diff.height >= snapshot.height && diff.sequence > snapshot.sequence
  4. Discard diffs that don't meet this condition

Diff Types

type RawBookDiff =
  | { New: { sz: string } }
  | { Update: { origSz: string; newSz: string } }
  | 'Remove';