Book Lab

Watch an order book rebuild itself.

A C++ engine rebuilds a stock exchange's book from raw messages. Replay a real NASDAQ day, or watch it live on Bitcoin.

BTC-USD

…

Connecting

4,138,857,296

NASDAQ messages, 6 trading days

0

book errors in total

44.6 s

for one full day, one laptop

57 ns

typical time per message

How it works

NASDAQ replay, every order

  1. ITCH file

    Raw bytes, one message per order event

  2. Framer

    Cuts the stream into messages

  3. Parser

    Decodes bytes into readable events

    221 M/s, parser only

  4. Order book

    Tracks every open order

    12 to 16 M/s, whole job

Live Bitcoin, totals per price

  1. Coinbase feed

    Text messages over a websocket

  2. Python

    Holds the connection, passes lines on

  3. C++ parser

    Reads each text message

  4. Order book

    Total size at each price

    about 25 µs per message

This website

Replay reads saved results. Live asks the server several times a second.

Next.js on Vercel

Why it is useful

For engineers: how it is built and how fast
Measured speed
Apple M4, 10 cores, 16 GB, AC power, 19 Oct 2026. Input: first 60,054,539 messages of the 28 Nov 2025 NASDAQ ITCH file, held in memory. Median of 7 runs, millions of messages per second.
  • Parse only221 M/s122 to 222
  • Parse and book update12.2 M/s11.4 to 12.3
  • With prefetching15.8 M/s15.6 to 15.8
  • Two-thread pipeline14.1 M/s12.8 to 14.6
Latency p50
57 ns
Latency p90
125 ns
Latency p99
590 ns
Latency p99.9
1.76 µs
  • Latency is the mean over 32-message batches, because one message is too fast to time reliably.
  • Prefetching the order-table slot a few messages ahead gave about 30% more throughput. The two-thread pipeline did not beat one thread, because parsing is too cheap to be worth splitting off.
  • Full day including decompression, one thread: 353,357,889 messages in 44.6 seconds.
What this does not claim
  • The NASDAQ replay is a recorded day, not a live feed. NASDAQ's live feed is a paid, licensed product.
  • The live page is Bitcoin from Coinbase, a simpler kind of data than NASDAQ's.
  • Why the book update is the slowest stage has not been profiled. Cache misses are the likely cause.
  • A few thinly traded stocks show a locked or crossed book at times. The cause has not been verified.