l4_diffs and l4_orders on core, and the spot_, hip3_, and hip4_ prefixed channels on the other families. REST history and checkpoint routes serve the same records for bounded pulls. Lighter has L3 individual-order depth instead.
SnapshotStart from a checkpointPull an L4 snapshot for one family and symbol, or use the
l4_snapshot that opens a subscription or replay.DiffsApply updates in orderApply server-ordered diffs without dropping or reordering them, and keep each event’s block and order metadata.
Live bookHold current stateOn a gap event, mark the book unsafe and rebuild from a fresh checkpoint.
Subscribe to L4 diffs
An L4 subscription opens with anl4_snapshot of the full book, then sends ordered l4_batch messages. This script prints the snapshot size and the first few batches for SOL. It runs on any plan, including Free.
Order events
Livel4_orders, hip3_l4_orders, spot_l4_orders, and hip4_l4_orders messages use the l4_batch type. Items are ordered by block number, then by their order within the block. Each item carries the fields below; optional fields are omitted when absent.
Use
cloid to match an event to an order your own system placed. Hyperliquid core and HIP-3 channels carry accepted orders only. Spot and HIP-4 channels also carry rejected orders, with the rejection reason in status.
Keep the book correct
- Baseline: start every family from a REST snapshot or checkpoint route, or from the
l4_snapshotthat opens a subscription or replay. - Updates: use live diffs for current state, and WebSocket replay, REST history, or the SDK reconstruction helpers for historical work.
- Ordering: apply L4 events in the order the server sends them and keep the block and order metadata. Never sort by timestamp alone. (Lighter L3 history orders by
sequenceinstead.) - Queue placement: a new-order item in an
l4_batchcan carry an optionalinsert_beforekey. Insert the new order ahead of that order ID within its price level; when the key is absent, append it at the tail. The initiall4_snapshotlists each price level in queue priority. - Gaps: when a sequence or replay gap appears, mark the book unsafe, stop output, and rebuild from a snapshot or replay checkpoint, or rerun the bounded window.
- Load: confirm one symbol keeps up before adding markets, and drop or throttle UI updates before you ever drop book events. Size the client against WebSocket limits, and check the symbol’s published coverage before requesting history.
- Storage: label stored data as L2, L3, or L4, and as current, historical, replayed, or reconstructed. Do not collapse L4 into a generic “orderbook” label; the distinction matters for backtests, charts, alerts, and anything you publish.