Open this on a laptop
The canvas needs room: requirements on one side, live feedback on the other. Any screen 1024px or wider works.
Design a Stock Trading App
hardTraders watch live prices, place orders checked for margin, and every order and fill is counted exactly once.
The problem
Build a trading app like Zerodha, Groww or Robinhood. It shows live prices, takes orders, checks the trader can pay, sends orders to the stock exchange, and keeps positions and money right.
Two systems meet at the order: a firehose of prices that may be dropped and merged, and a money path where nothing may be lost or sent twice.
The exchange matches buyers and sellers. The app never matches anything: it routes orders and listens for fills.
What it must do
- Live prices. Read the exchange's feed once, next to the exchange, and push at most 4 updates a second per instrument to each phone over one live connection.
- Place orders. Save each order with a key made once per tap, block its margin in memory, and send it to the exchange exactly once.
- Positions and funds. Each fill updates the position and writes ledger entries, skipping any fill whose trade id has been seen.
What you'll learn
- Start with the simplest design that works
- Keep running when a server dies
- Push live prices to millions of phones
- Check margin in memory at the open
- Send each order and count each fill once