Back to projects
Completed2026

Multi-Venue Order Book Analytics Pipeline

Ingests Binance, Coinbase, and Kraken order books, normalizes exchange updates, and serves one-second analytics through a WebSocket API.

The problem

One market, three different feeds.

Each exchange sends order-book data in its own format. The pipeline reads those updates concurrently, rebuilds a separate book for each venue and market, and publishes a common event format for analytics.

Binance BTC-USDT stays separate from Coinbase and Kraken BTC-USD. A shared base asset does not make the quote currencies interchangeable.

Follow an update through the system.

  1. 01

    Exchange feeds

    WebSocket snapshots and updates

  2. 02

    Async adapters

    Normalize symbols, prices, and timestamps

  3. 03

    Redpanda

    Buffer keyed events by venue and market

  4. 04

    Analytics worker

    Rebuild books and close one-second windows

  5. 05

    ClickHouse + API

    Query history and stream new windows

Snapshots establish the starting book. Later updates change individual price levels; a detected sequence gap means that book must be rebuilt from a fresh snapshot.

What does order-book imbalance measure?

Choose a venue and change the displayed bid and ask sizes. This small example shows how the top-of-book balance changes; the project computes the metric across the top ten levels.

Best bid: 100,000 USDT

Best ask: 100,001 USDT

+0.23

Illustrative book imbalance

(bid size − ask size) / (bid size + ask size)

The prices and sizes here are synthetic. This control is an explanation of the metric, not a live feed or a trading signal.

What the current build covers.

The repository includes exchange adapters, Redpanda publication, book reconstruction, one-second analytics, ClickHouse storage, a WebSocket API, and replay fixtures. The local tests check normalization, sequence gaps, and the distinction between trade VWAP and resting book size.

Kraken checksum validation is not implemented yet, and live trade VWAP currently uses only Binance trades. The repository does not report a measured end-to-end throughput or a zero-loss guarantee.

Technologies

PythonasyncioRedpandaClickHouseFastAPI

Components

Exchange adaptersRedpanda event streamOrder-book reconstructionAnalytics workerClickHouse and API

Implementation details

  • —Built asynchronous WebSocket adapters for three venues with snapshots, reconnects, and sequence-gap handling where the feed provides sequence numbers.
  • —Published versioned, venue-and-symbol-keyed events to Redpanda; a worker reconstructs books and computes spread and top-ten-level imbalance.
  • —Stored completed windows in ClickHouse and exposed historical queries and live updates through FastAPI. Binance trades also support trade VWAP.