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

    This article presents a practical engineering approach to handling digital asset market data, covering neutral field modeling, UTC-based time normalization, two-layer data validation, anomaly detection, and a collection-cache-push pipeline for low-latency distribution. It also outlines monitoring metrics and alerting practices, showing how to build a reusable, elastic market data service on general cloud-native capabilities.

    1. Introduction: Why Market Data Needs Engineering Governance

    In digital asset trading and quantitative analysis, market data is the most fundamental and most sensitive input. A typical public quote includes: pair identifier, market type, latest traded price, quote currency, 24-hour change amount and change percentage, open price, high, low, market cap, market cap rank, and the data update time. For a mainstream coin, for example, the latest price is about USD 0.09359, the 24-hour change is about 0.107%, the open is 0.09349, the high is 0.09539, the low is 0.09119, the market cap is about USD 93.7331 million, the rank is 164, and the update time is 2026-12-01 19:49:31.

    These fields look simple, but supporting a stable display or strategy system requires solving five engineering problems: unified field semantics, a consistent time baseline, trustworthy data validation, abnormal movement detection, and low-latency distribution. Each is covered below.

    2. Field Modeling and Semantic Unification

    Naming across data sources is often inconsistent. For example, the latest price may be called price, last, or close, and the change percentage may be ratio or changePercent. Engineering practice calls for a neutral internal data model that maps external fields to a standard structure:

    1. {
    2. "symbol": "GLM",
    3. "pair": "GLMUSDT",
    4. "market": "CRYPTO",
    5. "price": 0.09359,
    6. "quoteCurrency": "USD",
    7. "change24h": 0.00009989,
    8. "changePercent24h": 0.107,
    9. "open24h": 0.09349,
    10. "high24h": 0.09539,
    11. "low24h": 0.09119,
    12. "marketCap": 937331000,
    13. "rank": 164,
    14. "ts": "2026-12-01T19:49:31Z"
    15. }

    Three points matter when modeling. First, price and change percentage must use floating-point or fixed-point decimals rather than direct string arithmetic. Second, the market cap field needs an explicit unit (CNY, ten-thousand CNY, or USD); the sample value of 93.7331 ten-thousand should be converted to 937331000 before storage. Third, rank is an integer that may be empty, so a default strategy must be defined.

    3. Time Baseline and Timezone Handling

    Time fields are the most error-prone part of market data. The sample update time is precise to the second; in engineering, it should be normalized to UTC for storage and rendered in the user’s timezone at the presentation layer. The recommended approach:

    1. from datetime import datetime, timezone
    2. def normalize_ts(raw: str) -> int:
    3. # Parse in UTC and output a millisecond timestamp
    4. dt = datetime.strptime(raw, "%Y-%m-%d %H:%M:%S").replace(tzinfo=timezone.utc)
    5. return int(dt.timestamp() * 1000)

    Each record must also carry two timestamps: a collection time and a source update time. The former is used to compute end-to-end latency; the latter determines whether the data is stale. If the source update time lags the collection time beyond a threshold (for example, 60 seconds), the record should be marked as stale and excluded from strategy calculations.

    4. Data Validation: From Validity to Plausibility

    Validation has two layers. The first is validity checking: price must be greater than 0, high must not be lower than low, the latest price must fall between high and low, and change amount and change percentage must satisfy changePercent ≈ change / open * 100. Checking the sample: 0.00009989 / 0.09349 × 100 ≈ 0.107, which matches the given value and shows the data is self-consistent.

    The second layer is plausibility checking, or abnormal movement detection. Common rules include:

    • If the price moves more than a configured percentage compared with the previous sample, trigger manual review;
    • If the latest price stays at the high or low for a long time, liquidity anomalies may exist;
    • If market cap or rank jumps by an order of magnitude, it usually indicates a unit error at the source.
    1. def is_sane(d: dict, prev_price: float, max_pct: float = 5.0) -> bool:
    2. if d["price"] <= 0 or d["high24h"] < d["low24h"]:
    3. return False
    4. if not (d["low24h"] <= d["price"] <= d["high24h"]):
    5. return False
    6. if prev_price and abs(d["price"] - prev_price) / prev_price * 100 > max_pct:
    7. return False
    8. return True

    5. Collection, Caching, and Real-Time Distribution

    A market data service typically follows a collect-validate-cache-push pipeline. The collection layer pulls on a fixed interval or subscribes to incremental updates; the validation layer filters dirty data; the cache layer keeps the latest snapshot in memory or a distributed cache for sub-second reads by the frontend; the push layer sends changes to subscribers over long-lived connections.

    To reduce unnecessary pushes, a change-threshold merging strategy can be applied: broadcast only when the price change exceeds the minimum tick or reaches a configured ratio, avoiding bandwidth waste from high-frequency jitter. Illustrative logic:

    1. def should_push(new: float, last: float, eps: float = 1e-5) -> bool:
    2. return abs(new - last) >= eps

    For deployment, the collection and push services can run on Baidu AI Cloud’s container platform, with a message queue for peak shaving and decoupling, object storage for archiving historical snapshots, and logging and monitoring with alerting to track latency and failure rates. This builds an elastically scalable market data pipeline using general cloud product capabilities.

    6. Monitoring, Alerting, and Observability

    Core metrics for a market data system include end-to-end latency, data staleness rate, validation failure rate, push success rate, and coverage across pairs. Set a baseline and alert threshold for each metric, and tier the alerts: rising latency is a notice, while data that stops updating for a long time is a severe incident. Retain sampled raw payloads to support incident retrospection.

    7. Summary

    Breaking an ordinary-looking quote into five stages—modeling, time, validation, distribution, and monitoring—yields a reusable paradigm for a market data service. The keys are unified semantics, a unified time baseline, two-layer validation, and threshold-based pushing, with deployment and operations handled by general cloud-native capabilities, balancing stability and real-time performance.