Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Handling Order‑Book Level Changes When Pulling Snapshots From Crypto Asset APIs

Description and use

Intercepting and incrementally updating order‑book levels in real time preserves change history and prevents data drift.

Problem

Overwriting local order‑book snapshots discards incremental changes, leading to biased liquidity metrics and lost event history.

Outcome

The prototype now maintains a synchronized local order‑book, preserving incremental changes for accurate liquidity metrics and backtesting.

Workflow

  • Subscribe to WebSocket order‑book stream
  • Parse incoming message (symbol, price, volume)
  • If volume==0: delete price level from local book
  • Else: update or insert price level with new volume
  • Attach timestamp to each message and discard out‑of‑order events
  • Normalize price decimal precision
  • On WebSocket reconnection: fetch full snapshot before resuming incremental updates

Evidence

Simply fetching snapshots and overwriting local state will not meet these requirements. You need to implement incremental update logic for your local order book.

Source

If the incoming volume value is 0: interpret this as an order cancellation, remove that price level locally.

Source

  • Record date: 2026-09-05T16:18:26.441Z