How Does a Market Work? [CS Colloquia]

Dated Oct 1, 2018; last modified on Sun, 14 Mar 2021

Objectives: low latency, high throughput & high reliability.

The messages are quite brief, e.g. the ITCH protocol uses 32 bytes per message.

Trading firm listens to broadcasts on buys, sells, deletes on ITCH broadcasts. Online sorting to identify profitable trades.

Matching engine operates on a first-come-first-served basis. Earlier orders with better price get traded first.

Markets run at 50 microsecond scales.

Single market peaks at 10Gbps. Peaks are correlated, e.g. “Shit! TSLA is burning. Sell!”

Components of a trading system:

  • Quotes: listen to the multicast
  • Strategies: how to decide what to sell
  • Order Entry: different markets have slightly different protocols