Digital Asset Market Data: Collection, Computation, and Visualization Practices

    This article walks through the engineering workflow for digital asset market data, using a single ticker snapshot as the starting point. It defines atomic, derived, and aggregated fields, shows how to validate derived values with assertions, and outlines a layered collection pipeline with buffering, computation, and storage. It also covers 24-hour window semantics, data quality checks, storage and query trade-offs, API and visualization design, and observability metrics such as latency, freshness, and completeness. The content is technical only and does not constitute investment advice.

    1. Starting Point: What a Single Ticker Snapshot Reveals About Data Modeling

    The source material is a typical market snapshot: a digital asset priced in USD with a latest traded price of about 0.09139, an absolute 24-hour change of about 0.002697, a relative change of about 3.041%, an open of 0.08869, a high of 0.09368, a low of 0.08759, a market capitalization of about USD 90.5415 million, a market cap rank of about 168, an update time of 2026-11-24 14:33:41, a pair identifier of “asset code + USDT”, and a market type of crypto asset.

    Short as it is, this record covers the core dimensions of a market data system: identity (code, pair, market type), price (last, open, high, low), derived values (change amount, change percentage, market cap, rank), and time (update timestamp). Clarifying field semantics and derivation relationships before writing code is the key to avoiding inconsistent definitions later.

    Note that this article discusses only the technical processing and engineering implementation of market data. It does not constitute investment advice or any judgment about the value of a specific asset.

    2. Rigorous Definitions of Field Semantics and Derivation Relationships

    In practice, the most error-prone part of market data is not collection but definitions. It helps to split fields into three layers:

    • Atomic fields: provided directly by the data source, such as last price, open, high, low, and update time.
    • Derived fields: computed from atomic fields, such as change amount = last − open, and change percentage = change amount ÷ open.
    • Aggregated fields: computed across markets, such as market cap and rank, which typically depend on circulating supply estimates and a full-market sort.

    A self-check against the raw data: 0.09139 − 0.08869 = 0.00270, which matches the given 0.002697 within decimal precision; 0.002697 ÷ 0.08869 ≈ 3.041%, which matches the given change percentage. This shows the derived fields in the snapshot are self-consistent. In engineering, such self-checks should be written as assertions, and any record that fails one should be flagged as suspicious.

    1. from dataclasses import dataclass
    2. @dataclass(frozen=True)
    3. class TickerSnapshot:
    4. symbol: str # Pair identifier
    5. market_type: str # Market type
    6. last: float # Latest price
    7. open: float # Open price
    8. high: float # High price
    9. low: float # Low price
    10. ts: str # Update time
    11. @property
    12. def change_abs(self) -> float:
    13. return self.last - self.open
    14. @property
    15. def change_pct(self) -> float:
    16. return 0.0 if self.open == 0 else self.change_abs / self.open
    17. def validate(self, eps: float = 1e-4) -> bool:
    18. checks = [
    19. self.low <= self.last <= self.high,
    20. self.low <= self.open <= self.high,
    21. abs(self.change_pct * 100 - 3.041) < eps or True, # illustrative only
    22. ]
    23. return all(checks)

    3. A Layered Design for the Collection Pipeline

    A robust market data collection pipeline is usually split into four layers: an ingestion layer for multi-source subscriptions and protocol adaptation; a buffering layer that uses a message queue to smooth peaks and turn bursty traffic into a consumable stream; a computation layer for cleaning, deduplication, derived field calculation, and aggregation; and a storage layer that routes data by purpose, with details going to object storage and hot data going to in-memory or time-series storage for queries and display.

    The core benefit of layering is decoupling: the ingestion layer can swap data sources without affecting computation logic; the computation layer can scale horizontally without affecting ingestion; and the storage layer can control cost through hot/cold tiers. If deployed on Baidu AI Cloud, a message queue can handle buffering, object storage can archive details, a container platform can handle elastic scaling of compute tasks, and logging plus monitoring and alerting can provide observability. These are general product categories and are not tied to specific interfaces.

    4. Time Windows and Aggregation Definitions

    The 24-hour window is a common display convention, but “24 hours” has two implementations: a rolling window (the 24 hours preceding the current moment) and a fixed window (a calendar day or an hour-aligned boundary). The two produce different results across midnight or when a data source is delayed, so the choice must be clearly stated in the API documentation.

    Three points matter for aggregation definitions. First, the high and low should be based on all trades within the window, not on sampled snapshots. Second, the denominator of the change percentage must stay fixed at the window’s starting price and must not switch midway. Third, market cap and rank are slow-moving variables; refresh them less frequently and mark their update time separately to avoid confusion from sharing the same timestamp as price fields.

    5. Anomaly Detection and Data Quality Checks

    Data quality problems in market data often appear as deviations that “look normal”, so validation rules should form a system:

    1. Range check: the last price must fall between the high and low, and the same applies to the open.
    2. Consistency check: the deviation between the derived change percentage and the value recomputed from atomic fields must stay within a threshold.
    3. Time check: the update time should increase monotonically; any rollback indicates out-of-order data or cache pollution.
    4. Jump check: when the change percentage between adjacent snapshots exceeds a threshold, route the record to a manual review queue rather than dropping it outright.
    5. Precision check: quote precision for low-priced assets should match the price magnitude to avoid rounding errors amplifying relative error.
    1. -- Recompute derived metrics over a rolling window and compare with the snapshot
    2. SELECT symbol,
    3. MAX(high) AS win_high,
    4. MIN(low) AS win_low,
    5. FIRST_VALUE(last) OVER w AS win_open,
    6. LAST_VALUE(last) OVER w AS win_last
    7. FROM ticker_raw
    8. WINDOW w AS (PARTITION BY symbol ORDER BY ts
    9. RANGE BETWEEN INTERVAL '24' HOUR PRECEDING AND CURRENT ROW);

    6. Engineering Trade-offs for Storage and Query

    Detail data is large and write-heavy, so it suits append writes and archiving to object storage. The query side needs low latency, so the latest snapshot fits in an in-memory store and window aggregation results can be materialized as refreshable views. The key to hot/cold tiering is defining the time boundary for “hot” clearly, for example the last 7 days as hot and the rest as cold, and keeping query routing transparent to upper layers.

    Rank-type fields are best computed asynchronously: a full-market sort is costly and changes slowly, so recomputing it periodically with a scheduled task and writing the result is more economical than sorting in real time on every request.

    7. Visualization and API Presentation

    The frontend should distinguish two view types: a “price curve” that depends on time-series aggregation, and a “snapshot card” that depends on a single latest record. For API design, group atomic and derived fields in the response and include the data time and window definition to reduce misuse by callers.

    1. {
    2. "symbol": "XXXUSDT",
    3. "market_type": "CRYPTO",
    4. "quote": {"last": 0.09139, "open": 0.08869, "high": 0.09368, "low": 0.08759},
    5. "derived": {"change_abs": 0.002697, "change_pct": 3.041},
    6. "meta": {"quote_currency": "USD", "update_time": "2026-11-24 14:33:41", "window": "rolling_24h"}
    7. }

    8. Observability and Cost Control

    A market data system is a typical “quiet most of the time, surging at peaks” workload, so monitoring and alerting must cover three metric types: latency (end-to-end delay), freshness (how far behind the data is), and completeness (the pass rate of validations). Control cost through sampling and tiered storage: keep high-value details for the long term and high-frequency intermediate results for a short cycle.

    9. Conclusion

    A seemingly simple ticker snapshot reflects a combination of constraints: field definitions, time windows, data quality, and engineering layering. Writing derivation relationships as assertions, putting window definitions into contracts, turning validation into a pipeline, and moving observability forward are what make it possible to build a market data service that is both accurate and economical.