Menu

Post image 1
Post image 2
1 / 2
0

Why a single timestamp breaks real-time aggregation

DEV Community·Vitalii Buhaiov·18 days ago
#dMAx3ioF
Reading 0:00
15s threshold

During volatile moves, the aggregator could show a "consensus" order book that never existed on any exchange at any single instant. The bug: one timestamp field hiding three different "nows", one per venue. I learned this aggregating live order books. The pattern generalizes to any multi-source pipeline. The setup I run a service that joins live order books from Binance, Bybit, and OKX into one view. Each producer is a small daemon (one per exchange/asset pair) that holds a websocket open, applies snapshot+diff updates, and publishes the top 200 levels to Redis. A 10 Hz aggregator reads the three Redis keys, bins prices into per-asset buckets ($1 for BTC, $0.10 for ETH, etc.), and writes one unified snapshot. There's an obvious question every consumer asks: what time is this unified snapshot from? If you're paying attention, this question has two wrong answers before it has a right one. Wrong answer #1: now() The aggregator runs every 100 ms. So the snapshot is from… now? Sort of.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More