Independent project · Jul 2026
Low-Latency Limit Order Book Engine & Market Data Parser (C++20)
A C++20 engine that parses Databento DBN market-by-order binary data, reconstructs a NASDAQ limit order book, and benchmarks end-to-end throughput and latency on a full real trading day — with an animated replay dashboard that plays the session back like a video, embedded live below.
View code on GitHub
C++20Low LatencyMarket MicrostructureDBN/ITCHzstdCMakeCatch2
Live session replay — the engine's own dashboard, playing the real trading day
Press play. Every top-of-book change and fill from AAPL on 2024-01-05, delta-encoded and replayed at 0.5–15 market-minutes per second.
Open full screen ↗Book-update latency distribution (C++ benchmark)
Book updates per latency bin
Message intensity through the session
Messages per minute
Charts render the project's actual published result files, exported unmodified from the source repository.
Approach & findings
- Streaming zstd DBN reader with zero-copy parsing and no per-record allocation; wire-struct layouts pinned by static_asserts. Parse-only throughput ~28M records/s (36 ns/record including decompression), single-threaded on Apple silicon at -O3.
- Order book keyed by an order-ID hash map plus a sorted map of occupied price levels per side — memory scales with resting orders, not price-range width. Handles add, partial/full cancel, modify, fill, and session clear.
- Full day of AAPL market-by-order data (2024-01-05, XNAS.ITCH): 4,772,682 records — 2.26M adds, 2.28M cancels, 106K fills — parsed and reconstructed in 0.42 s (~11.4M events/s), with book-update latency of 42 ns p50 / 125 ns p99 / 209 ns p99.9.
- Validation: per-action record counts match the official Python databento client exactly; Catch2 unit tests cover the parser and book; vcpkg manifest mode keeps all C++ dependencies project-local.
- The replay dashboard is a single self-contained HTML file generated by the engine: all 147,390 top-of-book changes (ms-timestamped, delta-encoded) and all 102,958 regular-hours fills in a live time & sales tape, with transport controls (play/pause, 0.5–15 market-min/s, scrubber) — the same file embedded on this page.
Results
- Parse throughput
- ~28M rec/s
- Parse + book build
- 11.4M ev/s
- Book update p50 / p99
- 42 / 125 ns
- Records validated
- 4.77M