Design a Live Market Tick Brokerage Platform
Design the real-time market-data and order-to-position paths for a retail brokerage platform.
Problem statement
Design a brokerage platform that receives exchange tick streams at a reported peak near one million ticks per second across roughly 5,000 instruments, delivers prices no more than about 500 milliseconds old to five million connected users watching about 20 instruments each, routes buy and sell orders to an exchange, and shows positions and holdings.
For this exercise, assume clients subscribe to at most 20 instruments per session and need the latest conflated price rather than every raw tick. Also assume order commands are idempotent, reserve buying power or sellable quantity before routing, and exchange lifecycle events may be duplicated or reordered.
Advice, funding, clearing, settlement, and historical charting are out of scope.
What to build
- Stream a fresh latest price for every instrument in a connected user's active watchlist.
- Accept an idempotent buy or sell order, reserve the required resource, and route an accepted order to the selected exchange.
- For this exercise, apply duplicate or reordered exchange acknowledgements, fills, rejects, and cancellations exactly once in effect.
- Show the user current order outcomes, executions, positions, and holdings derived from authoritative lifecycle events.
At scale
- The reported feed peaks near one million ticks per second across roughly 5,000 instruments.
- The reported audience is five million concurrent users watching about 20 instruments each, with displayed prices at most about 500 milliseconds old.
- For this exercise, assume peaks of 50,000 order commands per second and a 300 millisecond p99 target for a durable accepted, rejected, duplicate, or throttled response.
- For this exercise, assume exchange events arrive at least once and may be delayed or reordered, order and execution history remains replayable for 30 days, and acknowledged state survives one process or availability-zone failure.