Real-Time Digital Asset Market Data: Collection, Validation, and Display Practices

    This article breaks down the engineering work behind digital asset market data, using a sample quote snapshot to define a reusable field model. It covers symbol and quote currency decoupling, 24-hour range consistency checks, collection through combined snapshot polling and incremental push, a data quality checklist, real-time frontend rendering, and observability metrics for building a reliable quote service.

    1. Introduction: Why Market Data Engineering Is Harder Than It Looks

    In digital asset trading applications, displaying market data may look like simply rendering the latest price on a page. In practice, it involves high-frequency data ingestion, field semantics alignment, unified time baselines, abnormal fluctuation filtering, reconnection after disconnects, and end-to-end latency control. This article uses a typical quote snapshot as a sample, abstracts a general field model, and provides reusable architecture and code patterns.

    The semantic structure of the sample snapshot is as follows (field names have been neutralized):

    1. {
    2. "symbol": "GLMUSDT",
    3. "asset_name": "Golem",
    4. "market_type": "CRYPTO",
    5. "quote_currency": "USD",
    6. "last_price": 0.09119,
    7. "change_24h": 0.002497,
    8. "change_ratio_24h": 0.02815,
    9. "open_24h": 0.08869,
    10. "high_24h": 0.09368,
    11. "low_24h": 0.08759,
    12. "market_cap": 90541500,
    13. "rank": 168,
    14. "update_time": "2026-11-24 14:29:37"
    15. }

    These fields cover the core needs of a quote service: current price, range statistics, change and change ratio, market cap and rank, and update time. The following sections break them down layer by layer.

    2. Field Semantics and Data Model Design

    2.1 Decoupling the Trading Pair from the Quote Currency

    symbol is formed by concatenating the base asset code and the quote currency, while quote_currency specifies the quote unit separately. For engineering, it is recommended to split them into two columns, base_asset and quote_asset, when creating the table. This avoids string parsing ambiguity when performing currency conversion or cross-market aggregation later.

    2.2 Consistency Constraints for 24-Hour Range Statistics

    open_24h, high_24h, low_24h, and last_price must satisfy:

    1. low_24h <= min(open_24h, last_price) <= max(open_24h, last_price) <= high_24h

    The change ratio should also satisfy change_ratio_24h ≈ change_24h / open_24h. In the sample, 0.002497 / 0.08869 ≈ 2.815%, which matches the given value. Without this validation before insertion, the frontend candlestick chart and the actual current price can display an absurd “price outside the range” result.

    2.3 Differences in Market Cap and Rank Definitions

    Market cap is usually calculated as “circulating supply × current price” or “total supply × current price”, and different data sources use different definitions. Rank is a relative measure that changes in real time with overall market movements. Therefore, these two fields should be annotated with the data source and calculation basis, and are not suitable as strong consistency constraints for validation.

    3. Collection Pipeline Design

    A dual-channel approach of “batch snapshots + incremental push” is recommended:

    1. Poll the snapshot API on a schedule, every 5–15 seconds, as a fallback data source.
    2. Subscribe to incremental trades and order book updates over a long-lived connection as the low-latency primary channel.
    3. Deduplicate and select the best data from both channels in memory by symbol + update_time.

    Illustrative pseudocode:

    1. async def merge_quote(incoming, store):
    2. key = incoming["symbol"]
    3. current = store.get(key)
    4. if current and current["update_time"] >= incoming["update_time"]:
    5. return # Drop stale data to prevent out-of-order overwrites
    6. if not validate(incoming):
    7. metrics.inc("quote_invalid")
    8. return
    9. store.set(key, incoming)
    10. await bus.publish("quote.updated", incoming)

    The key point is monotonic timestamp validation. Out-of-order data is the most common source of pollution in high-frequency market data. Once stale data overwrites a newer value, the page shows the price “jumping back”.

    4. Data Quality Validation Checklist

    • Prices must be positive, and precision must match the asset’s minimum tick size.
    • high_24h >= low_24h, and the current price falls within the range.
    • When the absolute change ratio exceeds a threshold (such as ±50%), the record enters a manual review queue instead of being discarded directly.
    • If the deviation between update_time and the local clock exceeds the tolerance, the data is considered stale.
    • Market cap and rank may be missing, but missing values must be explicitly marked and cannot be filled with 0.

    5. Real-Time Display and Backend Services

    The backend can write validated data into an in-memory cache and expose two capabilities: a snapshot query API and incremental push over a long-lived connection. After subscribing, the frontend maintains local state by symbol and re-renders only the corresponding row when an update event arrives, avoiding the performance jitter caused by full refreshes.

    1. socket.on("quote.updated", (q) => {
    2. renderRow(q.symbol, {
    3. price: q.last_price.toFixed(5),
    4. ratio: (q.change_ratio_24h * 100).toFixed(2) + "%",
    5. stale: Date.now() - parseTime(q.update_time) > 30000
    6. });
    7. });

    To support high-concurrency access, you can combine general cloud capabilities: a message queue handles peak shaving and broadcasting, a cache service hosts hot snapshots, a container platform hosts stateless query services, and logging and monitoring with alerting provide pipeline observability. Baidu AI Cloud offers corresponding product forms in these general categories, which can be combined flexibly according to business scale.

    6. Observability and Alerting

    Metrics that must be monitored include collection success rate, data staleness rate, validation failure rate, end-to-end latency percentiles (P95/P99), and push connection count. Alerting should be tiered: a short-term spike in validation failures usually indicates an upstream change, a rising staleness rate usually indicates a broken pipeline, and rising latency percentiles usually indicate consumer-side backlog.

    7. Summary

    The engineering difficulty of market data lies not in “fetching a number”, but in rigorous field semantics, correct time ordering, controllable anomalies, and an observable pipeline. Moving validation ahead of insertion, treating timestamps as first-class citizens, and letting definition metadata flow with the data are the three most economical principles for building a trustworthy quote service.