Design an Order Matching Engine
HardSystem design · Finance
Design the core matching engine of a single exchange venue. Members send limit and market orders and cancels; the engine matches by price-time priority per symbol, emits executions and market data, and must recover exactly from failure. Focus on the single-threaded deterministic core, the sequenced input log, recovery and failover, latency, and the risk-check and market-data paths around it. Out of scope: clearing and settlement, the brokerage front end, and wallets/custody (see the stock trading and crypto exchange problems).
Requirements
- Maintain deterministic price-time priority; one writer per symbol
- Persist a sequenced, replicated input log; recover by snapshot plus replay
- Publish executions and market data without slowing matching
- Run pre-trade risk checks and fail over to a hot standby without losing or duplicating acknowledged orders