Design stock price alerts
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Uber's technical phone screen, last asked Dec 2025. It tests notifications, streaming and pub/sub.
Design a stock price alert system. Users create alerts on securities, such as "tell me when this stock goes above $200", and get a notification when the market price crosses their threshold. Notifications go out by push, email or SMS. Cover the functional requirements, APIs, data model, architecture, how alerts are evaluated against live prices, scale, latency, reliability, deduplication and delivery.
Requirements
- Functional: create, list, edit and delete alerts on a symbol with a direction (above or below) and a threshold; choose delivery channels.
- Functional: when a price tick crosses an alert's threshold, notify the user once.
- Non-functional: millions of users and alerts; thousands of symbols with many ticks per second at market open; notification within seconds of the crossing; no missed alerts and no duplicate notifications.
Clarifying questions
- Is an alert one-shot (fires once and is disabled) or recurring (re-arms after the price moves back)?
- What counts as crossing: any tick past the threshold, or the price at a regular interval?
- Which price feed, and how many ticks per second at peak?
- How fast must the notification arrive?
- Are there alert types beyond thresholds, such as a percentage change in a day?
What a strong answer covers
- APIs for alert CRUD, and a data model with alert id, user, symbol, direction, threshold, status and channels.
- The hard part: matching each tick to the alerts it triggers without scanning every alert. Per symbol, keep "above" alerts sorted by threshold and "below" alerts sorted the other way, so a tick finds all crossed alerts with one range lookup.
- Partitioning evaluators by symbol, holding the sorted alerts in memory, loaded from the database and kept in sync from alert changes.
- Detecting a crossing as a change between the previous and the current price, so a gap in the feed does not miss an alert.
- Firing through a durable queue to a notification service with per-channel workers, retries and provider failover.
- Deduplication: mark an alert fired atomically before or with enqueueing, and give each notification an idempotency key.
- Hot symbols at market open, evaluator failover, and monitoring of tick lag and delivery latency.
Follow-ups
- A symbol has two million alerts at nearly the same threshold, and the price crosses it. How do you avoid a delivery spike melting the providers?
- Add alerts like "down 5% today". What changes in evaluation?
- An evaluator crashes after notifying but before marking alerts fired. What happens?
- Users in many countries want alerts only during their waking hours.
Where it's asked
- Uber · Technical phone screen · Last asked Dec 202560 min · One medium problem with a follow-up, or two short ones; sometimes object-oriented design
What it tests
notifications · streaming · pub/sub
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
