System Design Article

Design a Stock Exchange

Difficulty: Hard

Design a stock exchange like NASDAQ that matches buy and sell orders for thousands of symbols at sub-100-microsecond latency, handles 200K orders per second per symbol at peak, and produces a deterministic, replayable trade history with regulatory audit guarantees. The interview centerpiece is the matching engine: a deliberately single-threaded, in-memory order book that processes orders sequentially in price-time priority. We design the order book data structures (price-indexed levels with FIFO queues), the gateway path (ultra-low-latency parsing and rate-limit), the event-sourced persistence (every order and trade as an append-only event), and how to scale by sharding per symbol.

System Design
/

Design a Stock Exchange

Design a Stock Exchange

Design a stock exchange like NASDAQ that matches buy and sell orders for thousands of symbols at sub-100-microsecond latency, handles 200K orders per second per symbol at peak, and produces a deterministic, replayable trade history with regulatory audit guarantees. The interview centerpiece is the matching engine: a deliberately single-threaded, in-memory order book that processes orders sequentially in price-time priority. We design the order book data structures (price-indexed levels with FIFO queues), the gateway path (ultra-low-latency parsing and rate-limit), the event-sourced persistence (every order and trade as an append-only event), and how to scale by sharding per symbol.

System Design
Hard
design-stock-exchange
case-study
unique-specialized
stock-exchange
matching-engine
order-book
limit-order
fix-protocol
low-latency
ultra-low-latency
event-sourcing
deterministic-replay
single-threaded
leader-election
system-design
advanced
premium

775 views

15

This system design article is available for premium members only.

Upgrade to Premium