Market Data Pipeline for Digital Assets: Collection, Validation, and Real-Time Display

    This article walks through an engineering approach to handling digital asset market data, using a GLMUSDT snapshot as the running example. It covers a three-layer data model (raw, standardized, and derived), collection strategies focused on frequency, deduplication, and retry logic, validation rules for range, consistency, freshness, and precision, tiered storage that separates hot and cold data, and real-time display with threshold-based alerting. The goal is to turn a simple price record into a reliable data asset that supports analysis and decision-making.

    1. Introduction: Why Market Data Needs Engineering Governance

    In digital asset trading and quantitative analysis, market data is the starting point of the entire decision pipeline. Consider a typical snapshot record: the asset code is GLM, the trading pair is GLMUSDT, the market type is CRYPTO, the latest traded price is approximately 0.09139 USD, the 24-hour change is 0.002697, corresponding to a 3.041% change, with an open price of 0.08869, a high of 0.09368, a low of 0.08759, an overall market cap of about 90.5415 million USD, a market cap rank of 168, and a data timestamp of 2026-11-24 14:33:41.

    This kind of data looks simple but actually contains multi-dimensional information: time, price, volume-derived metrics, and ranking. If you render it directly to a page, you will quickly run into precision loss, timezone confusion, missing fields, and duplicate pushes. This is why the data needs to be processed in layers from an engineering perspective.

    2. Data Model Design: From Snapshot to Computable Structure

    The snapshot can be abstracted into a three-layer model.

    The first layer is the raw layer, which preserves the original fields returned by the API without any processing, making it easy to trace back and troubleshoot.

    The second layer is the standardized layer, which unifies field naming, units, and types. Prices are unified as floating-point or fixed-point decimals, market cap is unified in USD, and timestamps are converted to ISO format with timezone information.

    The third layer is the derived layer, which calculates derived metrics such as amplitude, offset relative to the open price, and volume-price relationships.

    A sample structure looks like this:

    1. {
    2. "symbol": "GLM",
    3. "pair": "GLMUSDT",
    4. "market": "CRYPTO",
    5. "price": 0.09139,
    6. "open": 0.08869,
    7. "high": 0.09368,
    8. "low": 0.08759,
    9. "change": 0.002697,
    10. "change_pct": 3.041,
    11. "market_cap_usd": 90541500,
    12. "rank": 168,
    13. "ts": "2026-11-24T14:33:41+00:00"
    14. }

    Amplitude can be derived from the high and low: (0.09368 - 0.08759) / 0.08869 ≈ 6.87%, indicating that intraday volatility is not small and the 3.041% gain falls within a normal range.

    3. Collection and Ingestion: Stability First

    The collection layer needs to address three problems: frequency, deduplication, and retry on failure.

    For frequency, market snapshots are high-frequency data. A combination of incremental pulls and push updates is recommended to avoid wasting bandwidth with full polling.

    For deduplication, use the asset code, trading pair, and update timestamp to form an idempotency key. Perform an idempotency check before writing to prevent duplicate records from polluting statistics.

    For retries, use an exponential backoff strategy with a maximum retry count and a circuit breaker threshold to prevent cascading failures from downstream issues.

    Sample pseudocode:

    1. def fetch_snapshot(pair):
    2. for attempt in range(5):
    3. try:
    4. data = client.get(pair)
    5. return normalize(data)
    6. except TransientError:
    7. sleep(2 ** attempt)
    8. raise RuntimeError("snapshot unavailable")

    4. Validation and Cleansing: Blocking Errors Before Storage

    Validation rules should cover four categories.

    First, range validation: price must be greater than zero, the change percentage should fall within a reasonable range, and the market cap rank should be a positive integer.

    Second, logic validation: the high must not be lower than the open and low, the low must not be higher than the open and high, and the direction of the change amount must match the direction of the change percentage.

    Third, freshness validation: if the deviation between the data timestamp and the current time exceeds a threshold, mark the data as stale.

    Fourth, precision validation: price fields should retain a fixed number of decimal places to avoid comparison failures caused by inconsistent precision across sources.

    For the sample in this round, 0.09139 falls between 0.08759 and 0.09368, the change amount is positive and the change percentage is positive, so the logic is consistent and the data can proceed directly to the standardized layer.

    5. Storage and Computation: Tiered Implementation

    For storage, hot and cold separation is recommended. Recent hours of hot data should be placed in low-latency in-memory storage to support real-time dashboards; historical data should land in object storage or columnar storage for backtesting and reporting.

    Computation is divided into real-time stream computing and offline batch computing. Stream computing handles rolling-window metrics such as average price, amplitude, and rank changes; batch computing handles daily-level statistics and market cap distribution reviews.

    Rank-related metrics require special attention to consistency of calculation methodology. Market cap rank changes with overall market fluctuations, so both the rank and the absolute market cap value should be displayed together to avoid user misinterpretation.

    6. Real-Time Display and Alerting

    For the display layer, push plus incremental rendering is recommended, updating only changed fields to reduce frontend load. For sharp price movements, threshold-based alerts can be configured and delivered to on-call staff through general monitoring and alerting capabilities.

    Example alerting rules:

    1. if abs(change_pct) > 5 for 3 consecutive snapshots:
    2. trigger alert(level=warning)
    3. if price == 0 or timestamp stale > 60s:
    4. trigger alert(level=critical)

    7. Cloud Deployment Recommendations

    On Baidu AI Cloud, a general product combination can complete the loop: use a message queue to handle the real-time market data stream, use a container platform to deploy collection and computation services, use object storage to archive historical snapshots, use a log service to record trace information, and use monitoring and alerting to ensure availability. The overall architecture remains stateless for easy elastic scaling.

    8. Conclusion

    The value of market data lies not in the number of fields but in unified calculation methodology, a reliable pipeline, and intuitive display. By abstracting snapshots into a standard model, combined with strict validation, tiered storage, and real-time push, a simple price record can be transformed into a data asset that supports analytical decision-making.