Design a Real-Time Stock Alert System
Let users start and stop stock rules and notify them when trusted market prices cross configured bounds.
Problem statement
For this exercise, assume you are designing a real-time stock alert system. Let users start and stop stock rules and notify them when trusted market prices cross configured bounds.
Define a coherent first production version that satisfies the listed requirements and scale while making failures and degraded behavior visible.
What to build
- Create, update, pause, and stop per-user stock alert rules.
- Consume and validate market prices, then evaluate lower, upper, and percentage/window rules.
- Commit one alert per boundary crossing, use hysteresis before re-arming, and deliver through retryable notification channels.
At scale
- For this exercise, assume 10 million active rules and 200,000 accepted price updates per second.
- Evaluate relevant rules within five seconds p95.
- Market updates may be duplicated or out of order; users must not receive duplicate crossing events.