SevyDevy

Design a stock price alert system

PremiumReal-timeMedium

  • Price alerts
  • Kafka partitioning
  • Sorted threshold index

Quick answer

This real-time interview question asks you to design a stock price alert system. Aim for a design that delivers updates to many users with low delay, then explain connections, fan-out, ordering and trade-offs. Interviewers want to see how you keep latency low, handle reconnects and stay correct under load.

The problem

Design a stock price alert system like the alerts in trading apps: users set a price or percent-change alert, and the system pushes a notification when a tick crosses it. The hard parts are matching a fast tick stream against millions of alerts and firing each alert exactly once.

Users pick a symbol and a condition: price above X, price below X, or up or down N% from the previous close. Price ticks arrive on a Kafka topic. When a condition is met, the user gets a push within seconds, even in the opening rush.

What must a stock price alert system do?

  • Create alerts: Users create, edit and delete price above, price below and percent-change alerts on any listed symbol.
  • Fire once: A one-shot alert fires once when its condition is first met, then becomes triggered.
4 more requirementsUnlock to see all

How well must it do it?

  • Latency: From a tick on Kafka to the push handed to the gateway within 1 second at p99, also at market open.
  • Correctness: No alert fires twice in a trading day, and no crossed alert is missed, even after a consumer crash or rebalance.
2 more requirementsUnlock to see all

What scale should you design for?

Use these numbers in your estimates.

The scale numbers unlock with this questionUnlock

Key concepts

  • Price alerts
  • Kafka partitioning
  • Sorted threshold index
  • Idempotent notifications
  • Dead letter queue
  • Apns and FCM

How you’ll practise

6 short steps · save and come back any time
  1. Requirements
  2. Estimate
  3. Connections
  4. Message flow
  5. Delivery guarantees
  6. Wrap-up

Lala, personalized to you, gives a hint when you ask and reviews your design when you are ready.

What do interviewers look for?

In any real-time design round.

  • Clarifies latency, ordering and delivery guarantees
  • Chooses a connection model with reasons
  • Explains fan-out to many receivers
  • Handles reconnects, missed messages and duplicates
  • Plans for hot spots and sudden traffic spikes
  • States trade-offs between consistency and speed

Questions people ask about this interview question

Which design type is this question?
It is a real-time question. You design a stock price alert system and explain your choices the way you would in an interview.
Is this question asked at entry level?
It is marked Medium. Entry-level engineers can practise it, but it expects you to reason about requirements and trade-offs, not only list components.
What should I cover first?
Start with who sends and receives updates, how fast they must arrive and what order matters. Agree on scope with the interviewer before you design anything.
Can I practise it for free?
It is a premium question. Sign up and unlock it once for 10 credits; it then stays unlocked. When you finish, Lala, your personalized AI mentor, can review your design for 30 credits.

Related questions

Updated · Written by the SevyDevy team

Premium questionSign up free, then unlock it