Real-Time Market Data System Architecture: Design and Engineering Implementation Checklist
A practical guide to building real-time market data systems for tradable instruments such as securities, digital assets, and commodities. It covers data modeling with strict field conventions and dual timestamps, a decoupled ingestion pipeline with multi-source cross-validation, storage tiering decided by query pattern and retention, latency-aware push and query APIs with explicit status flags, graded monitoring and alerting, performance and load-testing benchmarks, and a pre-launch checklist. Engineers will find concrete rules for handling backpressure, out-of-order and duplicate data, degradation strategies, and the trade-offs between freshness, consistency, and trustworthiness.
1. Set the Boundaries First: Three Problems a Market Data System Solves
A market data system is the end-to-end technical stack that collects, stores, computes, and distributes real-time price and order book information for tradable instruments (securities, digital assets, commodities, and more). Behind every last price, percentage change, OHLC, market cap, ranking, and update time shown on a screen is a data pipeline that demands “high-throughput writes + low-latency reads + explainable state.”
The design starts by accepting three constraints:
- Reads and writes are both heavy. Hot instruments are subscribed to by large numbers of clients at once, so read amplification is significant.
- Latency accumulates at every hop. Collection, cleaning, aggregation, and delivery each add delay, and end-to-end latency is determined by the slowest hop.
- The data feeds display, risk control, and settlement, so “explainable state” matters more than “looking real-time.” It is better to return data explicitly flagged as delayed than to return a number whose freshness cannot be judged.
2. Data Model: Field Conventions Drive Downstream Cost
Market data splits into two types: snapshots (state at a moment in time) and time series (changes recorded along a timeline, such as tick-by-tick trades and candlestick/K-line bars).
Snapshot example (src_ts / srv_ts are millisecond-level Unix timestamps, 13 digits; if a source returns a 10-digit second-level timestamp, you must distinguish it explicitly at the ingestion layer and never mix the two):
{"symbol": "XXX/USDT","quote_currency": "USD","last": "0.08879","change_pct": "0.566","open": "0.08829","high": "0.09268","low": "0.08759","volume": "12345678.9012","market_cap": "88870800","rank": 168,"status": "TRADING","src_ts": 1795123172000,"srv_ts": 1795123172137,"src_id": "primary","quality": "OK"}
Field convention rules:
| Item | Convention | Rationale |
|---|---|---|
| Price and amount | Fixed-point or high-precision type, serialized as a string over the API, with the number of decimals documented (e.g., 8 decimals for price, 4 for change_pct) | Floating-point error amplifies across multi-source aggregation and accumulation; use DECIMAL, not DOUBLE, in the database |
| Currency | quote_currency is required and, together with precision, forms the unit that interprets the value |
The same instrument may have multiple quote conventions |
| Missing values | Use null together with a quality flag; never substitute 0 or -1 |
0 is a valid price and would be confused with a real value |
| Trading status | status covers TRADING / SUSPENDED / DELISTED / PRE_TRADING |
When suspended, keep the last valid value rather than zeroing it out |
| Dual timestamps | src_ts (source time) + srv_ts (server receive time), stored in UTC and output in the timezone defined by the interface contract |
End-to-end latency = srv_ts − src_ts; timezone mismatch is the most common pitfall in cross-source alignment |
| Data quality | quality covers OK / STALE / SUSPECT / FALLBACK |
Lets downstream decide whether to display the value or fall back |
For the time-series part (ticks, K-lines), an additional seq or trade_id is needed for deduplication, along with a closed flag on each bar to avoid writing an unclosed bar to downstream as if it were a final value.
3. Collection and Ingestion: Turn Strategy into Executable Rules
Typical pipeline:
data source --> collectors (multi-source) --> message queue --> processing/aggregation --> cache layer --> push/query API|+--> time-series storage (archival, K-line computation)
Decoupling collection from processing, with each stage scaled independently, is the prerequisite for handling traffic spikes.
Multi-source cross-validation rules (starting values, to be calibrated against each instrument in practice):
- Filter candidates first:
src_tswithin the tolerance window, all fields present, values within a reasonable range. - If two sources deviate within tolerance -> take the newer one; if the deviation exceeds tolerance -> mark SUSPECT, keep the last valid value, and alert.
- If only one source survives -> mark DEGRADED; do not silently switch and hide the problem.
- If a single source times out or errors for N consecutive cycles -> remove it, then probe for recovery after a cooldown to avoid repeated flapping.
Choosing between push and polling:
- Long-connection push: the source supports incremental push, the instrument needs sub-second updates, and the subscription scale is manageable.
- Scheduled polling: the source only offers a snapshot API, the instrument updates infrequently, and push costs more than it returns.
- A mix is allowed: primary instruments use push, while the long tail is bucketed by update frequency and polled at low frequency.
Backpressure and discard strategy:
- For snapshots, keep only the latest value per instrument; intermediate states of the same symbol in the queue can be merged and dropped. Tick data cannot be dropped and can only be rate-limited or temporarily collected at a lower frequency.
- Trigger conditions: queue backlog exceeding a threshold, the age of the earliest message exceeding the tolerance window, a rising consumer error rate.
- For the primary metric, prefer “the age of the earliest message in the queue” over queue length, since it better reflects real latency.
Common pitfalls and troubleshooting steps:
- Source-side rate limiting: shows up as consecutive 429/4xx -> reduce frequency + exponential backoff + shard requests per instrument.
- Out-of-order data: shows up as prices jumping back and forth -> apply monotonic filtering on
src_tsorseq, dropping anything older than the current value. - Duplicate pushes: inevitable under at-least-once semantics -> use
(src_id, src_ts, seq)as the idempotency key. - Timezone mismatch: a fixed number of hours off in cross-source comparison -> standardize on UTC and check the source documentation and DST rules.
- Missing fields: a source adding new fields breaks downstream parsing -> do schema validation and default-value fallback at the ingestion layer; pass unknown fields through without parsing.
4. Storage Selection: Decide Along Four Dimensions
| Storage | Suitable queries | Write peak | Retention | Selection boundary |
|---|---|---|---|---|
| Distributed in-memory cache | Point lookups by key for the latest snapshot | High, stores only the latest state | No history needed | Hot reads dominate; estimate capacity as “number of active instruments × size per record × number of replicas” |
| Time-series database | Time-range queries, downsampled aggregation | High, friendly to sequential writes | Medium/short term (daily bars long-term, minute bars by month) | Needs K-lines, lookback, range aggregation; writes can be sharded by time |
| Relational database | Point lookups and joins on instrument metadata | Low | Long-term | Stable structure, low update frequency (names, trading pairs, listing status) |
| Object storage | Full scans, audit replay | Batch writes | Long-term | Cold-data archival with the lowest storage cost, insensitive to query latency |
The four decision dimensions are query pattern, retention, write peak, and cold-data cost. For hot/cold tiering, the boundary is best drawn by “whether a query falls within the last N days,” where N is set by the business lookback requirement. The goal is simple: hot data must be fast, cold data must be cheap.
5. Real-Time Push and Query: Latency Status Must Be Prominently Marked
Recommended response structure and status fields for the API:
{"data": { "symbol": "XXX/USDT", "last": "0.08879", "src_ts": 1795123172000 },"status": "DELAYED","data_age_ms": 8400,"quality": "STALE","source": "fallback_cache"}
Compliance requirements for financial market data must be written into the interface contract, not just agreed verbally:
- Whenever
statusis anything other than NORMAL (DELAYED, SUSPENDED, FALLBACK, HALTED), the interface must prominently display a status label next to the price; showing the number alone is not acceptable. - The front end must display
data_age_msor a “data as of” timestamp so users can judge freshness themselves; presenting a cached value as real-time is prohibited. - When the upstream is interrupted or the cache misses, return the last valid data with the status marked, rather than returning empty or an error. The interface stays usable but clearly flagged as untrustworthy.
- Market data is usually governed by exchange authorization and distribution terms; delay tiers, redistribution, and display formats must match the scope of that authorization. This article is engineering guidance, not compliance or investment advice; confirm with legal counsel and your data providers before going live.
Incremental push: send only changed fields (e.g., last, change_pct) to reduce bandwidth and serialization overhead; merge multiple updates to the same instrument within a window to avoid overwhelming client rendering.
Common questions:
- How do you build a market data system? First define the field conventions and dual timestamps, then build a decoupled ingestion pipeline, and finally layer storage by query pattern.
- How do you choose storage for market data? Look at query pattern and retention: caches for point lookups, a time-series database for range aggregation, object storage for archival, and a relational database for metadata.
- How do you tell whether market data is delayed? Check
srv_ts−src_tsand the API’sdata_age_ms, and look at percentiles rather than the mean. - What are common degradation strategies? Multi-source switching, keeping the last valid value with a status flag, lowering push frequency, and entering read-only mode, activated progressively by scope of impact.
6. Monitoring, Alerting, and Reliability: Grading and Response
| Level | Trigger conditions (starting values, to be calibrated against the nominal refresh cycle) | Response process |
|---|---|---|
| P0 | Core instrument freshness at 0 for an extended period; all data sources unreachable; push pipeline unavailable | Page on-call immediately, activate the degradation plan, announce the data status externally |
| P1 | Freshness exceeds 3× the nominal refresh cycle; end-to-end P99 latency over budget; age of the earliest queued message over threshold | On-call responds within 15 minutes, switches to a backup source, scales out consumers |
| P2 | Cache hit rate drops; single-source error rate rises; proportion of SUSPECT data rises | Track with a ticket, review the same day |
Must-monitor metrics:
- Data freshness: the gap between
srv_tsand the current time, grouped by instrument; look at P99 and the maximum, not the average. - End-to-end latency percentiles: P50 / P95 / P99 for each stage of collection, aggregation, and push.
- Data quality: missing rate, duplicate rate, abnormal jumps, and the proportion of cross-source deviations beyond tolerance.
- System metrics: cache hit rate, queue backlog and age of the earliest message, API error rate, and discard/merge counts.
For thresholds, prefer relative measures (relative to the nominal refresh cycle, relative to the historical baseline) rather than hard-coded absolute values, so that alerts do not all fail once the upstream adjusts its push frequency. The core pipeline must have a degradation plan, and that plan should be drilled regularly and documented, ensuring a single point of failure does not compromise overall availability.
7. Performance Optimization and Load-Testing Benchmarks
- Hotspot isolation: shard high-traffic instruments separately or add multi-level caching (in-process + distributed) so a hotspot does not take down the whole system.
- Batching and merging: merge pushes over a time window to control per-client render frequency.
- Horizontal scaling: make collection, processing, and query services stateless, and pair them with load balancing to absorb traffic swings.
- Load-testing benchmarks: record P99 end-to-end latency, P99 data freshness, discard and merge rates, queue backlog and age of the earliest message, cache hit rate, and single-shard throughput under hotspot sharding. The capacity limit is defined by “the point where latency starts exceeding budget,” not by “when CPU is maxed out.”
- Cloud deployment: use a container platform for elastic scaling, a message queue for traffic buffering, object storage for cold-data archival, and logging and monitoring services for observability, gaining elasticity at relatively low operational cost.
8. Pre-Launch Checklist
| Item | Acceptance criteria |
|---|---|
| Data model | Price uses fixed-point or high-precision, with decimals and currency clearly defined; missing values use null; suspended/delisted states are expressible; src_ts and srv_ts use a unified timezone |
| Ingestion redundancy | At least dual-source; cross-validation and automatic switching rules implemented; handling of rate limiting, out-of-order data, and duplicate pushes all covered by tests |
| Storage tiering | Hot/warm/cold boundaries and retention defined; capacity estimated from write peak and number of active instruments, and documented |
| Push degradation | Status fields prominently displayed in both the API and the UI; cache fallback returns a timestamp; the degradation plan has been drilled |
| Monitoring and alerting | Freshness, latency percentiles, error rate, and discard rate all wired in; grading and on-call processes clearly defined |
| Load-test capacity | Peak-scenario load test passed; capacity limits and degradation trigger points documented for each stage |
9. Summary
The hard part of a market data system is not any single technology but the trade-offs among real-time performance, consistency, and trustworthiness. Standardized field conventions, a decoupled ingestion pipeline, storage layered by query pattern, status-flagged push degradation, and a graded, actionable observability system together determine whether a market data service can truly go into production. Every threshold in this article should be treated as a starting point rather than a conclusion, and continuously calibrated against your own business’s nominal refresh cycle and load-test results.
