Designing a Digital Asset Market Data System: From Data Ingestion to Real-Time Display

    This article presents a practical architecture for building a digital asset market data system, covering the complete pipeline from data ingestion and aggregation to storage, distribution, and front-end rendering. It details the technical considerations for calculating 24-hour metrics such as open/high/low prices and percentage changes, handling out-of-order messages and anomalous values, computing market capitalization rankings, and optimizing front-end performance through throttling and differential updates. The article also emphasizes the importance of observability, particularly tracking data freshness to ensure that users always see real-time, accurate market information.

    Introduction and Problem Definition

    In digital asset trading, market data is one of the most user-facing pieces of information. A typical market data entry includes fields such as the trading pair symbol, market type, latest price, quote currency, 24-hour change amount and percentage, opening price, 24-hour high and low, market capitalization and its rank, and the data update timestamp. A representative data structure looks like this:

    1. {
    2. "symbol": "XXXUSDT",
    3. "market_type": "CRYPTO",
    4. "last_price": 0.09139,
    5. "currency": "USD",
    6. "change_24h": 0.002697,
    7. "change_pct_24h": 3.041,
    8. "open_24h": 0.08869,
    9. "high_24h": 0.09368,
    10. "low_24h": 0.08759,
    11. "market_cap": 90541500,
    12. "market_cap_rank": 168,
    13. "updated_at": "2026-11-24 14:33:41"
    14. }

    The core engineering challenge is how to efficiently collect, calculate, and display these metrics. This article breaks down the process from an architectural perspective.

    Overall Architecture

    A typical market data system can be divided into four layers:

    1. Data Ingestion Layer: This layer subscribes to trade streams and order book snapshots from upstream data sources via WebSocket, or falls back to REST polling. WebSocket is well-suited for high-frequency, real-time scenarios, while REST polling is simpler but incurs higher latency. In practice, WebSocket is the primary channel with REST polling as a fallback mechanism.
    2. Calculation and Aggregation Layer: This layer performs sliding window statistics on raw trade data to derive metrics such as the 24-hour opening price, high, low, and percentage change. The percentage change is calculated as follows:
    1. def calc_change_pct(open_24h, last_price):
    2. if open_24h <= 0:
    3. return 0.0
    4. return (last_price - open_24h) / open_24h * 100
    1. Storage Layer: High-frequency fields like the latest price are written to in-memory databases or local caches, while historical candlestick data is persisted in time-series storage for backtesting and charting.
    2. Distribution and Display Layer: Incremental updates are pushed to the front-end through a push channel. The front-end applies throttling to avoid UI jank caused by excessively frequent re-renders.

    Data Validation and Exception Handling

    Market data demands high accuracy, and engineering efforts must address several key issues:

    • Out-of-Order and Late Messages: Network jitter can cause messages to arrive out of sequence. The system should sort or discard messages based on event timestamps within the window. Importantly, the 24-hour high and low should be updated monotonically—only overwritten when a new high or new low is observed.
    • Anomaly Filtering: Price sanity checks should be performed. For example, if the price deviates from the median of the last N trades by more than a threshold, an alert should be triggered to prevent upstream data errors from contaminating the display.
    • Clock Consistency: The updated_at field should be normalized based on the server’s receive time to avoid ordering issues caused by clock drift across different data sources.
    • Reconnection Strategy: After a WebSocket disconnects, the system should reconnect using exponential backoff. Upon successful reconnection, it should first fetch a full snapshot for state alignment before resuming incremental subscriptions.

    Market Capitalization Calculation Details

    Market cap is typically calculated as circulating supply multiplied by the latest price. Circulating supply data updates at a much lower frequency than price. In practice, supply is synchronized periodically as a low-frequency configuration, while the price is updated in real time; the dynamic market cap is the product of the two. Market cap ranking requires periodic sorting across the entire market. A scheduled task that runs every minute to recalculate all rankings is a recommended approach, avoiding the need to trigger full sorts on every request.

    Front-End Display Performance Optimization

    A market data page often displays hundreds of trading pairs with update frequencies reaching dozens of times per second. Recommended practices include:

    1. Throttling and Batching: Merge multiple updates received within a 100–200ms window into a single render pass.
    2. Differential Updates: Only re-render cells whose values have changed and that are within the viewport.
    3. Price Movement Animation: Briefly highlight cells whose prices have changed (e.g., green for up, red for down, depending on regional conventions) to improve readability.
    4. Degradation Strategy: Automatically fall back to polling mode when the push channel fails, ensuring that the page always has data available.

    Monitoring and Observability

    A market data system requires a comprehensive monitoring framework. The ingestion layer should monitor message latency and disconnection counts. The calculation layer should track window computation time and discarded message counts. The distribution layer should monitor push success rates and end-to-end latency. A core metric to track is “data freshness”—the difference between the current time and the updated_at field. Once this exceeds a threshold, an alert should be triggered to prevent users from seeing stale market data.

    Conclusion

    A digital asset market data system may appear to be nothing more than “displaying a set of numbers,” but it actually involves multiple engineering disciplines, including real-time data ingestion, windowed aggregation, anomaly validation, caching, distribution, and front-end rendering optimization. A well-structured layered architecture, rigorous data validation, and robust observability are the keys to delivering a market data service that is low-latency, highly accurate, and scalable. Developers who master these general-purpose technical practices can readily apply them to any business scenario requiring real-time data display.