Skip to content

How to design Robinhood

The first sections are free. The deep dives, level expectations and quiz are part of Pro.

On this page
Asked at
Practice this question

The problem

A stock trading app of this kind is a broker: it shows live prices and carries orders to an outside exchange, which fills them. Two flows shape the design and run in opposite directions. Prices move from one exchange feed out to crowds of phones, so the question is how to fan each tick out to the people watching that stock without making each server read the whole market. Orders move from a tap to the exchange, and the same order must reach it at most once even when the call times out and the user taps again; the exchange, not the app, holds the real state of an order, and the design is built around learning that state.

Clarifying questions

AskWhy it mattersA typical answer

Do we send orders to one exchange or route among several?

Routing among venues adds a smart order router and best-execution rules. With one exchange the hard part is agreeing with it, not choosing it.

As posed, 1 outside exchange fills all orders and its feed carries the prices. The app is a broker, not the exchange.

How fresh do prices need to be, and how many people watch at once?

Near real time means a push channel per connected user; a price a minute old could be served from a cache on a timer. The crowd size decides how many servers hold those connections.

Near real time: a user watching a stock should see each move within moments. There are 28.6 million funded customers, popular stocks are watched by large crowds at the same time, and prices tick many times a second.

Which order types, and can a user cancel?

Market and limit orders are enough to force the interesting problem: a limit order can sit open for hours, so its status arrives long after the call that placed it. Cancel adds a race against a fill.

Market and limit orders on stocks, and cancel of an order that has not filled. Options, ETFs and crypto are out of scope.

What does the exchange give us back: a reply to each call, a stream of fills, or both?

If the exchange reports fills on a separate stream, the app can treat that stream as the record and the synchronous reply as a hint. If there is no stream, the app has to poll for status.

Both: a synchronous place and cancel API, and a trade feed that reports fills with the order id the app sent.

When is the peak?

Orders bunch at the market open, so the design is sized for that peak window, not the average minute.

Orders peak at the market open. Trading outside market hours is out of scope.

Do we show the order book or just the last price?

A live order book multiplies the update rate per symbol by the depth shown, and changes the data model from one number per stock to a sorted structure per stock.

No. Show the last price for each stock; the live order book is out of scope.

The requirements menu

RequirementScopeWhy

See live stock prices

Core

The screen people keep open. It is the fan-out problem: one feed, many watchers per stock.

Place market and limit orders

Core

The write path to the exchange, and the one that must not run twice on a retry.

Cancel an order that has not filled

Core

A cancel competes with a fill that may already have happened at the exchange, so it is a request, not a command.

See the status of one’s orders and positions

Core

Status is what the exchange says it is. Positions are the running sum of fills, so they come from the same trade feed.

A watchlist per user that decides which prices the phone receives

Optional

Worth taking: it is the natural unit of subscription, and it tells the price server which symbols one connection needs. Keep it a list of symbols on the user row and move on.

A buying power check before an order leaves for the exchange

Optional

Real brokers reject orders the account lacks the cash for. Take it if asked, as a check inside the order service before the pending write; leave the margin math out.

Stop and stop-limit orders

Optional

Tempting because the order record looks barely changed, though triggering adds state, market-data checks and races. Leave them unless asked: a stop that the app watches for itself means a price-triggered job, which is a second system.

Price alerts sent as push notifications

Optional

Easy to add once per-symbol channels exist: a server subscribes on the user's behalf and sends a notification. Name it as a consumer of the same channel, and park it.

Fractional shares

Out of scope

Brokers handle fractional orders differently from whole-share orders, in ways that vary from one broker to the next, so they change who fills what. Mention it and keep shares a whole number.

Trading outside market hours

Out of scope

After the close, prices come from other venues and other rules apply. Keep to the regular session.

ETFs, options and crypto

Out of scope

Options chains multiply the number of symbols, and crypto trades around the clock on venues the app may run itself. Stocks are enough to show the design.

Showing the live order book

Out of scope

Depth data is many updates per stock per tick. The last price is one number, which keeps the price path simple.

Running the exchange itself: the app is a broker

Out of scope

Matching engines are a different question. Here the exchange is a box the design calls and listens to.

Non-functional requirements

RequirementWhat it forces

Prices reach watching users in near real time

A connection the server can write to the moment a tick arrives, so a push stream per connected user rather than a timer on the phone. Each price server should receive just the symbols its users watch, or the fleet spends most of its time dropping ticks nobody connected to it needs.

An order is placed at the exchange at most once, whatever the retries

The order has to exist in our store, filed under a key chosen on the phone, before the exchange is called, so a second tap finds it instead of creating a twin. The exchange call carries an id our service chose on each attempt, and because duplicate handling differs by venue, the design queries the order's status by that id before any retry rather than relying on the exchange to drop a repeat.

The app’s view of an order never disagrees with the exchange for long

The exchange is the record. Our status column is a copy, updated as fills arrive on its feed and matched to orders by id, and a job queries the exchange about orders left pending past a threshold, so a lost reply is corrected on the job's next pass while the exchange is reachable, rather than at the end of the day.

Estimates

QuantityWorkingResultWhat it sizes

Users connected at the market open

Assume a tenth of the 28.6 million funded customers have the app open at the opening bell (an assumption to say out loud): 28.6 million × 10% ≈ 2.86 million live connections

About 2.86 million open price streams

The price server fleet: how many connections it has to hold at the same time.

Price servers for those connections

Assume one server holds about 100,000 mostly idle streams (a planning figure, not a measurement): 2.86 million ÷ 100,000 ≈ 29 servers

About 29 servers; plan for 30 to 40 so one dying does not overload the rest

The fleet size, and the number of subscribers one symbol's channel has when the fleet is subscribed by symbol.

Ticks into a server that reads the whole feed

Assume 5,000 listed stocks (the prompt's thousands) each ticking 10 times a second on average: 5,000 × 10 = 50,000 ticks a second into each price server, whatever its users watch; across 29 servers that is about 1.45 million tick deliveries a second from a single feed

50,000 ticks a second per server, about 1.45 million a second across the fleet

The waste in the first design, where each server consumes the whole market: a server whose users watch a few hundred stocks throws nearly all of it away.

Fan-out for one popular stock

Assume 1 million of the 2.86 million connected users watch the same stock (about 35%), and it ticks 10 times a second: 10 million messages a second to phones. With channels per symbol, the pub/sub layer sends each tick once to each of about 29 subscribed servers, around 290 messages a second; the 10 million per-connection writes land on the price servers

10 million phone writes a second, against about 290 pub/sub deliveries a second

Where the load of a hot symbol lands: on the servers' connection writes, which grow with the servers you add, not on the channel.

Polling instead of push

2.86 million connected users asking once a second = 2.86 million requests a second, most returning a price that has not changed; asking once in 5 seconds cuts it to about 572,000 a second and shows prices up to 5 seconds late

2.86 million requests a second at a one-second poll

The cost of the polling alternative against one open stream per user: the request rate is paid whether or not the price moved.

Reconnect burst after a price server fails

One server's 100,000 streams drop together; if clients come back within a retry window of about 3 seconds, the rest of the fleet takes about 33,000 new connections a second for those seconds, each needing one latest-price read per watched symbol

About 33,000 reconnects a second for a few seconds

The latest-price cache and the connect path, which must take a burst rather than a steady rate.

A reported brokerage peak, for headroom

Robinhood's engineering blog reported 100k requests a second at peak in December 2019 and 750k in June 2020, which it calls a 7x rise over six months

750k requests a second at peak, 7x in six months

How much headroom the whole brokerage side needs: a market-open peak across its requests can multiply within months, which is the case for sharding the orders store by user instead of running one database.

Orders a day from reported volume

The August 2026 operating data reports equity average daily volume of $16.0 billion. Assuming an average order near $1,000 (an assumption): about 16 million equity orders a trading day. If a quarter of those 16 million land in the first half hour, that is 4 million orders in 1,800 seconds, about 2,200 a second at the open

Roughly 16 million orders a day and about 2,200 a second at the open, under these assumptions

The write rate on the orders table and the call rate into the exchange at the open.

Core entities

EntityWhat it holds

User

An account that can watch stocks and own orders. Sign-up and identity are out of scope, so it stays a stub.

Symbol

One stock and its most recent price, as last seen on the exchange feed.

Order

One request to buy or sell, written before the exchange hears of it and corrected afterwards from the trade feed.

Trade

One fill reported by the exchange feed, kept as the record from which order status and positions are derived.

Position

What a user holds in one stock: the running total of their fills.

The API

EndpointNotes

GET /symbols/{symbol} → { last_price }, then a live stream of price updates

The first response carries the latest price so the screen has a number before the stream delivers a tick. The stream is one server-sent events connection per client carrying the user's watchlist, not one connection per stock, because browsers cap open connections per domain when not on HTTP/2. Changing the watchlist is an ordinary request; the server adjusts its subscriptions.

POST /orders { symbol, side, type, shares, limit_price? } → { order_id }

Carries an Idempotency-Key header the phone generates when the user confirms an order and reuses for retries of that same order, including a second tap after a timeout. The service inserts a pending row keyed by it, then calls the exchange. A repeat with the same key returns the same order_id; the same key with different fields is refused with an error, and in this design we chose 409 Conflict for it. The reply says the order was accepted for placement, not that it filled.

DELETE /orders/{order_id} → cancel

Marks the order cancel_requested and asks the exchange. The response means the cancel was sent, not that it won: a fill may already have happened, and the trade feed settles which.

GET /orders → the user’s orders and their status

Reads our copy, which lags the exchange by the trade feed's delay. Pending rows older than the stuck-order threshold are shown as pending, not as failed, until the job has asked the exchange.

The high-level design

orderswatchwriteplacepricesPhoneOrder svcPrice fleetOrders DBExchange

Step 1 of 4

Two paths: orders out, prices in

Start with the two jobs. An order service takes POST /orders, writes the order to the orders database as pending under the phone's idempotency key, then calls the exchange's place API and records what it answered. Price servers hold a server-sent events stream per connected phone and, in this first cut, read the exchange price feed directly and write each tick to the phones watching that stock. The two paths share nothing but the exchange, so a flood of price updates at the open does not slow order placement, and the order side can be sharded by user later without touching prices.

orderswatchwriteplacetradesupdatepricespublishsubaskfixPhone appOrder servicePrice serversOrders DBExchangeTrade processorFeed consumerPub/sub by symbolStuck-order job
The whole design

What breaks first

The deep dives

Live price updates. A popular stock moves and a crowd of users has it on screen. Walk a single tick from the exchange feed to each of their phones, say which box fails first when that crowd grows tenfold, and what those users see when the server holding their stream fails.

A concept that helps here: WebSockets, server-sent events and pollingA concept that helps here: Fan-out on write and on readA concept that helps here: Hot keys and hot partitions

Orders that agree with the exchange. A user taps buy, the exchange call times out with no answer, and the user taps buy again. Walk both taps through the order service, say what is stored at each step, which side is the record of an order's status, and how the app still learns that status when the exchange's reply is lost.

A concept that helps here: Idempotency keysA concept that helps here: Delivery semantics: at most, at least, exactly onceA concept that helps here: Event sourcing and ledgers

Concepts this guide uses

Sources

  1. GlobeNewswire via The Manila Times: Robinhood Markets, Inc. reports August 2026 operating data
  2. MDN: Using server-sent events
  3. Stripe API reference: Idempotent requests
  4. Redis documentation: Pub/sub
  5. OnixS FIX 5.0 dictionary: OrderStatusRequest (MsgType H)
  6. Robinhood newsroom: How we scaled Robinhood's brokerage system for greater reliability
  7. TechCrunch: Robinhood offers $15 discount, blames outage on record trades
  8. Robinhood support: Using market data
Sign in to report a mistake