Design stock price time-series store and query
Company: Citadel
Role: Software Engineer
Category: System Design
Difficulty: easy
Interview Round: Technical Screen
## Problem
Design a platform that stores stock prices over time and can be queried later.
### Core functionalities
1. **Ingest price**: The system receives events of the form:
- `ticker` (string, e.g., `AAPL`)
- `price` (decimal)
- `timestamp` (event time)
2. **Query price**: Given a `ticker` and a `timestamp`, return the price for that ticker at that time.
### Clarifications to address in your design (state assumptions)
- If there is **no price exactly at that timestamp**, should the system return:
- the most recent price **at or before** the timestamp (common), or
- “not found” unless there is an exact match?
- Expected scale: number of tickers, events/sec, retention (e.g., 1 day vs 10 years).
- Latency targets for reads/writes.
- Handling out-of-order events, duplicates, and clock skew.
## Deliverables
- High-level architecture (write path + read path).
- Data model and storage choice.
- APIs.
- Partitioning/indexing strategy.
- Consistency, availability, and failure-handling tradeoffs.
Quick Answer: This question evaluates system design skills for time-series data storage and querying, covering scalability, partitioning, indexing, event-time handling, consistency, and read/write latency trade-offs for historical stock prices.