Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Price Movement Alert Platform

Design a one-shot alert service that evaluates rolling price changes and notifies subscribers quickly and reliably.

Problem statement

Design a stock-price alert platform. A market-data provider makes the latest price of each instrument available once per second through a provider-pushed stream, a platform-pulled or polled interface, or a defensible combination of both.

Compare those acquisition models before choosing one: account for alert latency and freshness, provider request load and quotas, missed-update and backfill behavior, failure recovery, and operating complexity.

A user can subscribe to an alert that should fire when an instrument rises by a chosen percentage over exactly one rolling window: minute, hour, day, week, month, or year. A subscription is removed after it fires once, and an untriggered subscription expires one month after creation.

For this exercise, assume an alert compares the latest accepted price with the most recent valid price at or before the rolling-window boundary. A trigger means the latest price is at least the baseline price multiplied by 1 plus the requested percentage.

Deliveries may be retried, but a user must not receive the same logical alert more than once. Historical prices need only be retained long enough to evaluate the supported windows, and trading or order execution is outside scope.

What to build

  1. Users can create and cancel one-shot price-movement subscriptions for one instrument, threshold, and supported rolling window.
  2. The system continuously compares incoming prices with the correct rolling-window baseline and identifies every eligible subscription.
  3. Triggered alerts are delivered once from the user's perspective and removed; untriggered subscriptions expire one month after creation.

At scale

  • Assume 50,000 instruments and up to 50,000 incoming price updates per second during bursts.
  • Assume 20 million active subscriptions, with popular instruments accounting for a large share of them.
  • For this exercise, target alert evaluation within 2 seconds of an accepted price update at p99 and 99.99% monthly availability.
  • Retain normalized price history for 13 months so every supported baseline can be reconstructed after failures or late data.