Digital Asset Market Data: Collection, Parsing, and Engineering Practices

    This article walks through the engineering workflow for collecting and parsing digital asset market data, using a sample GLMUSDT ticker snapshot as the reference structure. It covers a five-category field model, a three-layer schema design with high-precision decimal types, collection and scheduling strategies, validation rules for price jumps and stale data, derived metrics such as amplitude, and a practical production checklist. Readers will learn how to turn a single quote record into a reliable, auditable data asset that supports both real-time display and offline analysis.

    1. Reading the Data Structure from a Single Ticker Snapshot

    The raw material is a typical digital asset market record: the symbol is GLM, the trading pair is GLMUSDT, the market type is CRYPTO, and the quote currency is USD. The latest price is 0.09149, with a 24-hour change of 0.002797 (3.153%), an open of 0.08869, a high of 0.09368, and a low of 0.08759. Market capitalization is about USD 90.5415 million, the market cap rank is 168, and the data timestamp is 2026-11-24 14:28:28.

    For developers, the value of this record is not any specific number but the standard field set it demonstrates: identifier fields (symbol, trading pair, market type), price fields (last, open, high, low), derived fields (change amount, change percentage), scale fields (market cap, rank), and metadata (quote currency, timestamp). Once these five categories are abstracted clearly, the same model can carry data from any source you connect later.

    One point deserves emphasis: market data is high-frequency time-series data, and any single value is valid only at the instant its timestamp indicates. In engineering terms, you must store the triple of “value + timestamp + source identifier” together. Otherwise the data cannot be traced back, and consistency checks become impossible.

    2. Field Modeling and Type Design

    A three-layer model is recommended: a raw layer that keeps the payload exactly as collected, a detail layer that standardizes fields, and an aggregate layer for minute-level and hour-level rollups.

    1. from dataclasses import dataclass
    2. from decimal import Decimal
    3. @dataclass
    4. class TickerSnapshot:
    5. symbol: str # Symbol, e.g., GLM
    6. pair: str # Trading pair, e.g., GLMUSDT
    7. market_type: str # Market type, e.g., CRYPTO
    8. quote_currency: str # Quote currency
    9. last: Decimal # Latest price
    10. open_24h: Decimal # 24-hour open
    11. high_24h: Decimal
    12. low_24h: Decimal
    13. change_24h: Decimal # Change amount
    14. change_pct: Decimal # Change percentage
    15. market_cap: Decimal # Market capitalization
    16. rank: int # Market cap rank
    17. ts: str # Data timestamp

    Always use a high-precision decimal type rather than binary floating point for prices and market caps, so accumulated errors are avoided. For change percentage, it helps to keep conversion functions for both the decimal form and the percentage form, preventing the display layer and the calculation layer from diverging.

    3. Collection and Scheduling Strategy

    There are three common collection modes: scheduled polling, long-lived connection push, and batch snapshots. Polling is simple and cheap, which suits low-frequency scenarios. Push offers better real-time behavior but requires handling reconnects and heartbeats. Batch snapshots work well as a daily reconciliation baseline.

    For scheduling, a tiered frequency is suggested: second-level for core symbols and minute-level for the long tail, adjusted dynamically through a configuration center. All collection tasks should be idempotent, meaning repeated collection at the same point in time produces no duplicate records. Using “symbol + timestamp” as the unique key is a practical way to deduplicate.

    On Baidu AI Cloud, collection tasks can be deployed on a container platform, with a message queue decoupling collection from parsing, object storage archiving raw payloads, and logging plus monitoring services tracking task success rate and latency.

    4. Data Validation and Exception Handling

    The most common anomalies in market data are “jumps” and “stalls.” A jump means the price deviates from a reasonable range within a short window, which can be detected with a change-percentage threshold combined with a mean-reversion distance check. A stall means the timestamp has not updated for a long time, which requires timeout detection.

    1. def is_sane(prev, cur, max_pct=Decimal("0.3")):
    2. if prev is None or prev == 0:
    3. return True
    4. return abs(cur - prev) / prev <= max_pct
    5. def is_stale(ts_now, ts_data, max_gap_sec=120):
    6. return (ts_now - ts_data).total_seconds() > max_gap_sec

    Data that fails validation should not be discarded outright. Instead, it should be flagged and moved to a quarantine area for manual or rule-based review, keeping the data pipeline auditable.

    5. Metric Calculation and Visualization

    Common metrics can be derived on top of the detail layer: range high and low, amplitude ((high - low) / open), price-volume correlation, and rank changes. Using the given snapshot, amplitude is roughly (0.09368 - 0.08759) / 0.08869 ≈ 6.87%, notably higher than the 24-hour change of 3.153%. This shows intraday volatility exceeding the net daily move, and detecting such “volatility versus trend divergence” is valuable for risk alerts.

    For visualization, three screens are suggested: an overview screen showing the latest price and change percentage, a trend screen showing the intraday curve, and a structure screen showing market cap and rank changes. Every chart must label the data timestamp and the data source to avoid misreading.

    6. Engineering Implementation Checklist

    1. Unify the data contract so field names and units stay consistent end to end;
    2. Decouple collection, parsing, and storage so each can scale independently;
    3. Make the whole pipeline idempotent with deduplication;
    4. Establish validation rules for jumps, stalls, and missing data;
    5. Cold-archive raw data and keep detail data in hot storage;
    6. Cover collection latency, parse failure rate, and validation rejection rate in monitoring;
    7. Apply rate limiting and caching to external interfaces to prevent repeated computation.

    With this structure in place, a seemingly simple ticker snapshot can grow into a durable data asset that supports real-time display as well as offline analysis and compliance auditing.