19. Stock Exchange

Medium

Design a system to facilitate the buying and selling of stocks

Functional Requirements
  • Users should be able to put in orders to buy or sell
  • Users should be able to cancel orders
  • Buy orders should be matched to sell orders with the same price if they exist
  • User accounts have a balance where they have to preload funds in order to place a buy order
  • User should be able to check the current price
Nonfunctional Requirements
  • 99.999% reliability
  • Price checks need to be updated within 3000 milliseconds
Assumptions
  • The system should function 24/7 and ignore the concept of "after-hours trading"
Estimated Usage
  • 500 million order per day
  • Uniform usage throughout the day
  • 200 listed companies on the market
  • 1:1 Buy to Sell orders

Seen this question in a real interview before?

Not all editor features are supported on mobile