Reconstruction is for applications that need a local book over time instead of independent snapshots.Documentation Index
Fetch the complete documentation index at: https://docs.0xarchive.io/llms.txt
Use this file to discover all available pages before exploring further.
Pattern
Apply diffs in timestamp order
Ignore messages older than the snapshot timestamp and apply updates in order.
Detect gaps
If replay or live streams emit a gap signal, mark the local book as unsafe until it is rebuilt.
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 where the venue family supports it. 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.| Runtime | Package surface | Use it for |
|---|---|---|
| Python | oxarchive, OrderBookReconstructor, WebSocket extra | Notebook or pipeline reconstruction with typed models and optional stream callbacks |
| Rust | oxarchive, orderbook_reconstructor, websocket feature | Async services and backtest runners that need typed reconstruction behavior |
| TypeScript | @0xarchive/sdk, OrderBookReconstructor, WebSocket helpers | App and worker code that needs checkpoint-plus-delta reconstruction |
Gap Policy
A local book is only as trustworthy as its gap handling. If a replay, diff stream, or checkpoint route reports a missing segment, mark the local state unsafe and rebuild. Do not keep applying newer updates to a state that has an unknown hole. That can produce plausible but wrong depth.Reconstruction Manifest
Store a manifest beside reconstructed output.| Field | Store |
|---|---|
| Venue family and symbol | Lighter BTC, Spot HYPE-USDC, HIP-3 km:US500, or another explicit family |
| Baseline source | REST snapshot, WebSocket snapshot, checkpoint route, or replay snapshot |
| Update source | Diffs, replay stream, tick history, or live channel |
| Window | start/end timestamps and any cursor or iterator state |
| Gap state | gap list, rebuild trigger, and whether the output is complete |
| Output depth | full book or capped depth level |
| Code surface | SDK package/version, generated client, or direct REST/WebSocket path |