SnapshotStart from a checkpointPull an L4 snapshot for one family and symbol, or use a WebSocket replay baseline for Hyperliquid core.
DiffsApply updates in orderProcess server-ordered diffs without dropping or reordering messages. Retain each event’s block/order metadata. Honor the optional
insert_before key on new-order diffs: it names the resting order ID the new order queue-jumps ahead of; absent means append at the tail.Live bookHold current stateOn a gap event, mark the book unsafe and rebuild from a fresh checkpoint.
L4 Workflow
Implementation Pattern
1
Confirm route availability
L4 routes are a route-availability question, separate from connection, replay, and throughput limits. Verify the selected symbol’s published coverage before requesting history, then size the client against WebSocket limits and the account’s published plan terms.
2
Start with one symbol
Confirm the local book can process a small stream before widening to more markets.
3
Separate UI from book state
Drop or throttle noncritical UI updates before dropping book events.
4
Stop on unsafe gaps
If the book misses ordered events, mark it unsafe and rebuild from a known baseline.
L4 State Checklist
Capture this checklist before claiming a client maintains an L4 book.REST And WebSocket Together
Use REST when you need point snapshots or bounded historical L4 records. Use WebSocket for live updates on every L4 family. Use WebSocket replay only for Hyperliquid corel4_diffs and l4_orders. A production L4 client often uses REST for baseline and recovery, WebSocket for live state, and data-quality routes for trust decisions; core clients can also use checkpoint-anchored WebSocket replay.
Do not collapse L4 into a generic “orderbook” label in storage. Store whether the data is L2, L3, L4, current, historical, replayed, or reconstructed. That distinction matters for backtests, visualizations, alerting, and customer-facing products.