Market Data Service
Purpose
Ingestion, normalization, and distribution of market prices and security master data.
Responsibilities
- Security master management
- Real-time price ingestion
- Historical OHLC storage
- Price validation and normalization
- Index data
Non-Responsibilities
- Portfolio valuation (Portfolio Service)
- Risk calculations (Fraud Service)
APIs
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/v1/securities | Bearer | List securities |
| GET | /api/v1/securities/{id}/price | Bearer | Current price |
| GET | /api/v1/securities/{id}/history | Bearer | Historical OHLC |
| GET | /api/v1/indices/{id} | Bearer | Index value |
Database
| Table | Key Columns | Description |
|---|---|---|
| securities | id, symbol, name, type, currency | Security master |
| prices | security_id, price, timestamp, source | Latest prices |
| price_history | security_id, date, open, high, low, close, volume | OHLC data |
| indices | id, name, value, timestamp | Index values |
Kafka
Produces: MarketPriceUpdated
Consumes: External feed events (internal topic)
Partition key: security_id
Dependencies
Sync: External market data providers Async: Publishes to Kafka
Failure Handling
- Feed outage → use last known price with staleness flag
- Invalid price → reject and alert
Scaling
Batch ingestion + real-time updates. High write volume on price_history.
Security
Read access for authenticated users. ADMIN for security master changes.
Observability
Metrics: market_data_ingestion_total, price_staleness_seconds.