Streaming a live order book with Kafka
Nordic Analytics, fintech platform for traders and analysts
Live Level II market depth from Interactive Brokers, streamed through a durable event log to multiple independent consumers, with no data lost on a restart.
01Live order-book depth
Downstream services needed live Level II order-book updates, the bids and asks at each price. The stream also needed to remain available for independent processing and later analysis.
02Feed live, store everything, lose nothing
Build one service that streams updates reliably to multiple consumers, without losing data when a process restarts.
03One stream, multiple readers
I changed the design from a nightly-reset in-memory store to a durable Kafka log, so multiple consumers could receive depth updates and recover independently.
- A Python service holds the WebSocket connection to the Interactive Brokers Web API and writes every update to a Kafka topic, running on Redpanda.
- Multiple independent consumers read that topic, each at its own pace.
- The log is on disk and each consumer tracks its own position, so after a crash it resumes where it stopped.
04Running in production
It's running in production. Consumers receive live market depth, restarts do not lose data, and a new consumer can be added without touching the others.