Skip to main content

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

MethodEndpointAuthDescription
GET/api/v1/securitiesBearerList securities
GET/api/v1/securities/{id}/priceBearerCurrent price
GET/api/v1/securities/{id}/historyBearerHistorical OHLC
GET/api/v1/indices/{id}BearerIndex value

Database

TableKey ColumnsDescription
securitiesid, symbol, name, type, currencySecurity master
pricessecurity_id, price, timestamp, sourceLatest prices
price_historysecurity_id, date, open, high, low, close, volumeOHLC data
indicesid, name, value, timestampIndex 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.