Pattern
1
Start from a snapshot
Load the initial book state from REST or the first WebSocket snapshot.
2
Apply diffs in timestamp order
Ignore messages older than the snapshot timestamp and apply updates in order.
3
Detect gaps
If replay or live streams emit a gap signal, mark the local book as unsafe until it is rebuilt.
4
Resync when needed
Pull a fresh snapshot and resume from the latest known safe point.
Inputs
Reconstruction needs a trustworthy starting point and ordered changes. The starting point can come from a REST snapshot, a WebSocket snapshot, or a checkpoint route in venue families that expose checkpoints. Changes can come from diffs, replay messages, or a bounded historical stream. Store the source route or channel with every run.TypeScript Reconstruction Helpers
The TypeScript SDK exposes Lighter tick-history helpers and anOrderBookReconstructor for workflows that need checkpoint plus delta reconstruction.
Python And Rust Helpers
The Python and Rust SDKs also expose reconstruction-oriented types and helpers. Use the package README for exact import paths and method names, then keep the same manifest and gap policy from this page.
If a runtime helper is missing for the venue family, use the REST/WebSocket route directly and keep the same reconstruction checklist instead of pretending every SDK has the same method.