The Runtime Theory
High-Frequency Trading

Market Data Feeds and Parsers

How exchanges broadcast real-time market data, the FIX and ITCH protocols, and how feed handlers parse data at line rate.

The Runtime Theory Team1 min read
▸ On this page

Market Data Feeds and Parsers

Market data feeds are the real-time stream of information that exchanges broadcast to market participants: new orders, cancellations, modifications, and trade executions.

What Feeds Exchanges Publish

When an order book changes, the exchange publishes an update message to every subscriber. These feed handlers are some of the most latency-sensitive systems in finance.

plaintext
Message types:
- NEW_ORDER      → add a bid/ask to the book
- CANCEL         → remove a quantity from an existing order
- REPLACE        → modify price/quantity of an existing order
- TRADE          → a matched buy and sell

Feed Protocols

FIX (Financial Information eXchange)

A text-based protocol used for order entry and trade reporting. Human-readable but verbose.

plaintext
8=FIX.4.2|35=D|55=AAPL|44=150.00|38=100|54=1|
  ^     ^    ^    ^        ^       ^   ^
Begin  Type  Symbol  Price  Qty   Side(1=Buy)

ITCH / OUCH

Binary protocols used by exchanges like NASDAQ for ultra-low-latency market data.

plaintext
ITCH (market data):
- Add Order (35=353)
- Order Delete (35=354)
- Order Cancel (35=355)
 
OUCH (order entry):
- New Order (35=A)
- Modify Order (35=E)
- Cancel Order (35=F)

Feed Handlers

A feed handler is the software that receives, parses, and processes market data. Feed handlers must:

  1. Parse at line rate — Process every byte as it arrives, no buffering.
  2. Maintain order book state — Apply each update in order to reconstruct the book.
  3. Handle gaps and replays — Markets pause and resume (circuit breakers); feed handlers must catch up.
  4. Distribute to strategies — Feed the book to trading algorithms with minimal latency.

Architecture

plaintext
Network → NIC (kernel bypass) → Feed Handler (C++) → Order Book → Strategy → Order Gateway → Exchange
 
Latency budget:
- Network: 5-50 μs (colocated)
- Feed handler parse: 100 ns - 1 μs per message
- Order book update: 100 ns
- Strategy decision: 100 ns - 10 μs
- Network return: 5-50 μs

Book Reconstruction

The feed handler rebuilds the order book from the message stream:

  1. Apply adds — Insert new orders at the correct price level.
  2. Apply cancels — Remove quantity from existing orders.
  3. Apply deletes — Remove orders entirely.
  4. Apply trades — Remove matched quantity, record the trade price.

The top of book (best bid/ask) is the most watched — it determines whether incoming market orders will match.

Not started

Sign in to save your learning progress.

Sign in to save