Design a stock price alert notification system similar to a Robinhood-style watchlist alert feature. At minimum, the system should support:
AAPL goes above $150".AAPL goes above $150".AAPL".Data Model: Create a table Alerts with columns id, user_id, stock_symbol, price_threshold, created_at, and deleted_at.
API Endpoints:
POST /alerts: Create a new alert.DELETE /alerts/{id}: Delete an existing alert.GET /alerts: List all alerts for a user.Notification Service: Use a pub/sub model to notify users when an alert condition is met.
Stock Price Updates: Use a time-series database to store stock prices and update them in real-time.
Caching: Cache frequent stock price queries to reduce database load.
Scalability: Use a distributed system to handle high volume of requests and data.
This problem statement and solution outline were compiled from various sources, including the DarkInterview URL provided and other relevant web searches.