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
…
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
- ITCH file
Raw bytes, one message per order event
- Framer
Cuts the stream into messages
- Parser
Decodes bytes into readable events
221 M/s, parser only
- Order book
Tracks every open order
12 to 16 M/s, whole job
Live Bitcoin, totals per price
- Coinbase feed
Text messages over a websocket
- Python
Holds the connection, passes lines on
- C++ parser
Reads each text message
- 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
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.