Design Robinhood
Understanding the Problem
📱 What is a retail brokerage? A retail brokerage like Robinhood, Webull or the app from your bank lets individuals buy and sell stocks from their phone. It shows live prices and charts, keeps track of each user's cash and positions, and when a user places an order, it sends that order on to a market maker or an exchange to be executed. The brokerage doesn't match orders itself; it's the customer-facing layer between millions of users and the market.
This question is often asked as "design Robinhood," "design a stock trading app," or "design the price ticker for a trading app." They're the same system with a different emphasis. Some interviewers mostly want the live price fan-out, others the order flow, and a good number will end with "the market just dropped 10% at the open; what breaks?" We'll cover all three.
Functional Requirements
Core Requirements
- Users should be able to see live prices for stocks on their watchlist and on a stock's detail page.
- Users should be able to view historical price charts for a stock over several ranges (1 day, 1 week, 1 month, 1 year, 5 years).
- Users should be able to place market and limit orders, cancel open orders, and see each order's status.
- Users should be able to see their portfolio: cash, positions and their current value.
Below the line (out of scope)
- Options, crypto, margin lending and short selling.
- Funding the account (bank transfers) and tax documents.
- News, social features and recommendations.
- Being the exchange. Matching happens elsewhere (see /system-design/stock-exchange).
Non-Functional Requirements
Ask your interviewer for scale. A reasonable set: 20 million funded accounts, 5 million daily active users, and up to 2 million users with the app open at the same time right after the market opens. There are about 7,000 tradable US stocks and ETFs that users care about, and the platform handles on the order of 5 million orders per day, heavily concentrated at the open.
Core Requirements
- Prices shown in the app should be fresh within about a second. A retail user isn't trading on microseconds, but a price that's 30 seconds stale is a support ticket and a regulatory problem.
- Order placement must be correct and exactly once: never lose an order, never send it twice, never let a user spend cash they don't have.
- The system should be highly available during market hours (9:30 to 16:00 Eastern). An outage at the open, when users can't sell, is the worst possible failure.
- The system should absorb 10x spikes in traffic on volatile days, when everyone opens the app at the same time.
- Charts should load in under 200 ms for common ranges.
Below the line (out of scope)
- Sub-millisecond latency. We aren't a high-frequency trading firm.
- Multi-region active-active order placement. One primary region with a warm standby is enough.
Let's do the math on the price stream, because it decides the architecture. The raw US equities feed at full depth can reach millions of messages per second at peak. Users don't need any of that granularity; they need the last price (and maybe best bid and ask) for the symbols on their screen. If we conflate to at most one update per symbol per second, the whole universe of 7,000 symbols is only 7,000 updates per second entering our system.
The fan-out is the expensive side. If 2 million connected users each watch about 20 symbols, that's 40 million subscriptions. If every one of those symbols changes every second, sending one message per symbol per user is up to 40 million messages per second. But if we send each user one batched message per second containing all their changed symbols, it's 2 million messages per second, a 20x reduction. That single decision is most of the design for requirement 1.
Orders are the opposite: small volume, high stakes. Five million orders per day sounds modest, but if 20% arrive in the first five minutes of the open, that's 1 million orders in 300 seconds, or over 3,000 orders per second sustained, with peaks much higher. Each one needs a buying power check, a durable write and a message to the market.
Say out loud that price data and order data have completely different requirements. Prices are high volume, lossy-tolerant and shared by everyone. Orders are low volume, must never be lost and are private to one user. They get separate paths, separate stores and separate scaling plans.