Real-Time Crypto Market Data: Ingestion, Parsing, and System Design
A reliable crypto market data system requires more than fetching and displaying prices. This article covers data modeling, polling and streaming ingestion, consistency checks, storage, derived metrics, and resilient architecture, with practical guidance for balancing accuracy, latency, and engineering cost.
1. Why Market Data Needs a Dedicated System
Digital asset markets operate 24/7, with frequent and sometimes sharp price movements. Consider an illustrative snapshot of a major public-blockchain token: a latest price of $73.49, a 24-hour gain of $2.75 or approximately 3.88%, a high of $74.17, a low of $70.09, an opening price of $70.75, and a market capitalization of approximately $43.36 billion, ranking seventh.
Behind this seemingly simple snapshot are several engineering challenges: connecting to data sources, processing time-series updates, validating consistency, and distributing updates concurrently.
Fetching prices and displaying them is relatively straightforward. The harder task is building an accurate, low-latency, scalable pipeline that remains reliable under high-frequency updates, multiple data sources, and unreliable network conditions. This article outlines practical approaches to that task.
2. Designing the Market Data Model
A general-purpose market data model should include the following core fields:
- Asset identifiers: The symbol, such as
SOL; the trading pair, such asSOLUSDT; and the market type, such asCRYPTO. - Price information: Latest price, opening price, high, low, and quote currency, such as
USD. - Price changes: The absolute and percentage changes over 24 hours.
- Market size: Market capitalization and its market-wide rank.
- Metadata: An update timestamp for assessing data freshness.
A simple structured representation might look like this:
{"symbol": "SOL","pair": "SOLUSD","market": "CRYPTO","currency": "USD","price": 73.49,"open": 70.75,"high": 74.17,"low": 70.09,"change_24h": 2.75,"change_pct_24h": 3.883,"market_cap_usd": 43360000000,"market_cap_rank": 7,"updated_at": "2026-12-01T22:59:40Z"}
Several details deserve attention:
- Standardize timestamps on UTC. Convert them to the user’s time zone in the presentation layer to avoid time-zone inconsistencies across services.
- Use high-precision decimal types for prices. Types such as
Decimalhelp prevent the precision loss and accumulated errors associated with floating-point arithmetic. - Validate change fields against their underlying values. The percentage change should equal the absolute change divided by the previous price, where the previous price is the latest price minus the absolute change. In this example,
2.75 / 70.74 × 100 ≈ 3.887%, which is close to the supplied3.883%, allowing for rounding differences.
3. Data Ingestion: Polling vs. Streaming
Market data is typically obtained through one of two approaches.
Polling sends HTTP requests to a data API at regular intervals. It is simple to implement and debug, but request frequency is constrained by API quotas. It also introduces an unavoidable delay between a market change and the next request. Polling is suitable for views that do not require immediate updates, such as rankings refreshed once per minute.
Streaming uses persistent connections, such as WebSocket connections, to subscribe to incremental updates. It can provide millisecond-scale latency, but requires reconnection logic, heartbeat handling, and subscription recovery, increasing engineering complexity.
A common practical approach is a hybrid architecture: use streaming for core trading pairs and polling for less frequently accessed assets. The following pseudocode illustrates subscription and reconnection logic:
import asyncio, jsonasync def consume(ws_url):backoff = 1while True:try:async with session_connect(ws_url) as ws:await ws.send(subscribe_msg(["SOLUSD"]))async for raw in ws:tick = parse_tick(json.loads(raw))await pipeline.dispatch(tick)backoff = 1except ConnectionError:await asyncio.sleep(backoff)backoff = min(backoff * 2, 60) # Exponential backoff
Regardless of the ingestion method, monitor data freshness. Trigger an alert when the time elapsed since updated_at exceeds a configured threshold, such as 30 seconds. This helps prevent stale prices from appearing current and misleading users.
4. Ensuring Data Quality and Consistency
Market data directly influences user decisions, so unreliable records should not pass through unchecked. A layered validation process should include:
- Basic validity checks: Prices and market capitalization must be positive, the high must not be below the low, and the update timestamp must not be later than the current time.
- Logical consistency checks: Percentage and absolute changes should agree; the latest price should fall within the 24-hour high and low; and market capitalization ranks should fall within a reasonable range.
- Cross-source comparisons: Obtain quotes for the same instrument from at least two independent sources. If the difference exceeds a configured threshold, such as 1%, route the data for manual review or invoke a fallback procedure.
- Abnormal price-movement detection: Flag changes that exceed a statistical threshold within a given interval. This helps prevent faulty data from an individual source from being distributed as valid market updates.
Retain immutable logs of raw messages as well, using cloud object storage and logging services where appropriate. These records support audits and retrospective troubleshooting.
5. Storage, Computation, and Presentation
Storage
Store the latest market snapshots in an in-memory database or a cached key-value store to support millisecond-scale lookups. Write historical trade prices and volumes to a time-series database for candlestick charts and technical indicator calculations. Market-wide aggregates, such as capitalization rankings, can be materialized periodically.
Computation
The computation layer produces derived metrics. Recalculate absolute and percentage changes using a rolling 24-hour window rather than simply trusting upstream fields.
Market capitalization is calculated as price multiplied by circulating supply. Because supply data generally updates less frequently than prices, handle the two inputs independently.
Presentation
The presentation layer should address two concerns:
- Precision: Establish clear rules for decimal places. Low-priced assets may require more digits, while higher-priced assets can use fewer displayed digits.
- Update visibility: Show the timestamp associated with each rendered snapshot—for example, “Data updated at 2026-12-01 22:59:40 UTC”—so users can identify its reference time.
6. Architectural Recommendations
A robust cloud-based market data system typically includes the following components:
- Ingestion gateway and quota management: Centrally control request rates to upstream providers to avoid rate limiting.
- Message queue: Buffer market updates, decouple ingestion from downstream processing, absorb traffic spikes, and support multiple consumers.
- Rules engine and alerting: Configure real-time alerts for conditions such as abnormal price changes and delayed updates.
- Multilevel caching: Use longer cache lifetimes for static asset metadata and shorter lifetimes with active invalidation for dynamic prices.
- Staged rollouts and graceful degradation: Prepare fallback controls for API traffic spikes during extreme market conditions. Options include reducing refresh frequency or hiding secondary ranking data while keeping core market information available.
7. Conclusion
Market data engineering is fundamentally a balance between timeliness, accuracy, and implementation cost. Decimal precision, polling versus streaming, validation rules, caching, and degradation strategies all determine whether a displayed price of “$73.49, up 3.88%” is both trustworthy and current.
Start with a small but complete notification service for a single asset. Then evolve it into a horizontally scalable platform supporting multiple assets and data sources, keeping data quality at the center of each stage.
