Design Problems/Stock Exchange / Trading System

Stock Exchange / Trading System

Hard
Low LatencyMatching EngineFIFO Queue

High-Level Architecture

Rendering diagram...

Design an electronic stock exchange system that matches buy and sell orders with ultra-low latency. The system maintains an order book for each stock, executes trades when prices match, and disseminates market data to participants in real-time.

Clarifying Questions

  • Latency requirements? (Order to acknowledgment < 1ms, order to match < 5ms)
  • How many symbols/stocks? (10,000 actively traded)
  • Order types? (Market, limit, stop-loss, cancel/replace)
  • Peak order rate? (1M orders/second across all symbols)
  • Market data consumers? (100K connected clients for real-time data)
  • Do we need to support pre/post market? (Yes)