Practice: Design Retail Stock Brokerage
Retail stock brokerage inspired by Robinhood-style brokers: orders validated against buying power and acknowledged immediately, routed asynchronously over FIX to market makers and exchanges, fills booked to a double-entry ledger, and live quotes streamed over WebSockets. A teaching design.
Build this system yourself on the canvas below. Add components, connect them, and run traffic simulations to see where your design holds up and where it breaks.
Functional requirements
- Place buy/sell orders (market, limit, stop-loss) for listed equities; receive order confirmation with order ID
- Cancel or modify a pending order before it is matched
- View real-time portfolio: current holdings, unrealised P&L, available margin
- Receive real-time order fill notifications (WebSocket push)
- Stream live market data: best bid/ask, last traded price, volume for any instrument
- View order history and past trades with timestamps and execution prices
Non-functional requirements
- Order placement latency < 10ms p99 from API receipt to exchange acknowledgement
- Market data freshness < 100ms lag from exchange tick to client display
- Zero duplicate order fills — matching engine must be strictly serialised
- All trades immutably logged for regulatory audit within 500ms of execution
- 99.99% availability during market hours (9:15 AM – 3:30 PM IST / 9:30 AM – 4:00 PM EST)
- Portfolio P&L calculations consistent within 1 second of a trade execution