orderbook events.
Choose an L2 method
Method signatures
Parameters
If either time boundary is omitted, the SDK resolves a bounded range from
catalog metadata. Explicitly bounded ranges can replay from complete local
coverage without a network request.
Event versions and time
Legacy rows retain their originalorderbook, orderbook_snapshot,
l2_snapshot, or orderbook_delta type and use timestamp. V2 uses only
type: "orderbook", uses data.is_snapshot to classify the update, and uses
collector_timestamp as the SDK event time. Nullable exchange_timestamp
remains venue-time provenance.
A snapshot replaces both sides of the book. A delta replaces the quantity at
each listed price, and quantity zero removes that price. A legacy delta can omit
an unchanged side; v2 provides both side arrays.
Complete L2 snapshots
l2_snapshots() and l2Snapshots() reconstruct complete books by default.
Python and Rust return single-pass streams; TypeScript returns an array.
Materialized L2 rows use the standard event envelope with
type: "orderbook" and these fields under data:
data.bids: bid levels sorted from highest to lowest pricedata.asks: ask levels sorted from lowest to highest pricedata.is_snapshot: v2 origin flag;truereplaces the book andfalseapplies absolute updates
data.is_snapshot: false even though their bids
and asks contain the complete current book. This lets you identify the stored
update that produced the materialized state.
Reconstruction lifecycle
- A snapshot initializes or replaces the complete book.
- A delta updates only its listed price levels.
- A zero-quantity update deletes its price level.
- A coverage gap or reconnect clears reconstructed state.
- Following deltas are skipped until another snapshot initializes the book.
Raw L2 updates
l2_updates() and l2Updates() return the original snapshots and sparse
deltas without constructing a complete book for every update. Use them for
execution replay, custom sampling, or application-managed order book state.
A v2 snapshot has data.is_snapshot: true; a v2 delta has
data.is_snapshot: false:
Build complete books on demand
UseOrderbookBuilder.update() to maintain native book state without
allocating a complete result after every update. Call snapshot() only when
you need sorted bid and ask levels. Builder state is isolated by
(source, market).
update() returns false for a delta received before its first snapshot.
snapshot(source, market) returns None or undefined until that book has
been initialized.
Builder methods
Use
update() in high-frequency loops. Use apply() only when every update
must immediately produce a complete book. When apply() materializes a v2
delta, the output deliberately retains data.is_snapshot: false.
How it works
Both L2 methods use snapshot-first historical replay. See Snapshots for the full flow. Raw update iteration stays bounded in memory.Related documentation
- BBO if you only need top-of-book quotes
- Depth metrics for derived liquidity metrics
- Events for order book updates mixed with other event types
- Snapshots for historical coverage and storage
- Quickstart