Market Data Pipeline for Digital Assets: Collection, Parsing, and Engineering Practices

    This article explains how to build an engineered market data pipeline for digital assets, covering field modeling, time and timezone handling, layered data quality validation, hot and cold storage, observability, and deployment. It shows how a simple price snapshot can be turned into a reliable foundation for display, risk control, and backtesting, with predictable degradation when data sources become unstable.

    1. Why Market Data Pipelines Need Engineering

    In digital asset business scenarios, market data is the most fundamental and most easily underestimated component. Many teams initially just fetch a snapshot on a schedule, write it to a database, and consider the integration complete. But once the business starts relying on this data for display, risk control, or strategy backtesting, problems surface together: inconsistent timestamps break cross-market alignment, unfiltered extreme values pollute metrics, ambiguous field semantics cause duplicate calculations, and update delays go unnoticed.

    A typical market snapshot usually contains the following elements: trading pair identifier, market type, quote currency, latest traded price, 24-hour change amount and percentage, open price, high price, low price, overall market cap, market cap ranking, and data update time. As an example from one collection, the latest price was about USD 0.09359, the 24-hour change was about 0.107%, the open was 0.09349, the high was 0.09539, the low was 0.09119, the market cap was about USD 93.73 million, the rank was about 164, and the update time was 2026-12-01 19:51:20. These numbers are not special in themselves, but they are enough to support a discussion of a complete data processing specification.

    2. Field Modeling: Turning Snapshots into Computable Table Structures

    The first step in engineering is to define field semantics and types clearly, so that later definitions do not become chaotic. It is recommended to divide fields into four categories:

    • Identifier fields: trading pair code, market type, quote currency. Market type should be enumerated (such as crypto spot, crypto derivatives) to avoid free-form string input.
    • Price fields: latest price, open price, high price, low price. Use high-precision fixed-point storage uniformly; do not store binary floating-point values directly in the database.
    • Derived fields: change amount, change percentage. These can be derived from price fields, should be marked as “redundant fields” when stored, and the original snapshot should be retained for traceback.
    • Metadata fields: market cap, market cap rank, update time. Rank is a high-frequency changing field and needs to be decoupled from price in update frequency.

    An illustrative table structure definition is as follows:

    1. CREATE TABLE market_snapshot (
    2. symbol VARCHAR(32) NOT NULL, -- Trading pair code
    3. market_type SMALLINT NOT NULL, -- Market type enum
    4. quote_ccy CHAR(8) NOT NULL, -- Quote currency
    5. last_price DECIMAL(28,10) NOT NULL, -- Latest price
    6. open_price DECIMAL(28,10) NOT NULL,
    7. high_price DECIMAL(28,10) NOT NULL,
    8. low_price DECIMAL(28,10) NOT NULL,
    9. change_24h DECIMAL(28,10), -- Derived: change amount
    10. change_pct DECIMAL(18,8), -- Derived: change percentage
    11. market_cap DECIMAL(28,10),
    12. cap_rank INT,
    13. source_ts TIMESTAMP(3) NOT NULL, -- Data source update time
    14. ingest_ts TIMESTAMP(3) NOT NULL, -- Local ingestion time
    15. PRIMARY KEY (symbol, source_ts)
    16. );

    The key design here is to keep both source_ts and ingest_ts. The former describes when the data was “produced”, and the latter describes when the data “arrived”. The difference between them is the end-to-end latency, which is a core metric for later monitoring.

    3. Time and Timezones: The Most Easily Overlooked Pitfall

    The update time in the sample does not carry timezone information, which is the most common hidden risk in practice. There are three standard practices:

    1. Convert to timezone-aware UTC time on ingestion, and render in the user’s timezone at the presentation layer.
    2. Clearly distinguish “snapshot time” from “fetch time”, and do not overwrite the data source time with the local system time.
    3. For 24-hour window calculations, use a sliding window rather than natural day splitting, to avoid metric jumps at midnight every day.

    The calculation logic for the 24-hour change percentage should remain reproducible:

    1. change_pct = (last_price - open_price_24h) / open_price_24h

    Here open_price_24h is the corresponding price 24 hours ago on a rolling basis, not the day’s open price. Many definition disputes come from mixing these two concepts.

    4. Data Quality Validation: Five Lines of Defense

    Before data enters the business layer, it is recommended to set up layered validation:

    • Structural validation: missing required fields or type mismatches are directly discarded and counted as errors.
    • Consistency validation: the high price must be greater than or equal to the latest price and the low price, and the low price must be less than or equal to the latest price; the signs of the change amount and change percentage must be consistent.
    • Reasonableness validation: when the change percentage exceeds a preset threshold (such as a single-period fluctuation over 50%), mark it as pending manual confirmation rather than storing it directly.
    • Freshness validation: if current time - source_ts exceeds the tolerance window, the data is considered stale, and the business side should degrade the display.
    • Continuity validation: when the price jump between adjacent snapshots exceeds a threshold, trigger an alert, which may indicate a data source anomaly rather than real market movement.

    Run a validation on the sample data: high 0.09539 ≥ latest 0.09359 ≥ low 0.09119, the change percentage is positive and the change amount is positive, so consistency passes; the market cap rank of 164 is consistent with a market cap of about USD 93.73 million in magnitude, so reasonableness passes.

    5. Storage and Query: Hot and Cold Tiering

    Market data is write-intensive with fixed read patterns, making it suitable for tiered storage. Recent snapshots are placed in online storage that supports high-throughput writes for real-time dashboard queries; historical data is archived to object storage by day or week, compressed and stored in a columnar format for backtesting and auditing. On the query side, it is recommended to provide two interfaces: fetching details by trading pair and time range, and fetching the latest record by trading pair. The latter should be cached, with the cache key including the trading pair and data freshness requirement.

    6. Observability: Making Latency and Missing Data Visible

    Having data alone is not enough; the pipeline itself must be observable. The minimum viable monitoring set includes collection success rate, end-to-end latency percentiles, validation failure rate, latest data age per trading pair, and duplicate data ratio. It is recommended to configure at least two levels of alerts: a reminder when data age exceeds the tolerance threshold, and escalation to a critical event when there is no data for multiple consecutive periods. Logs and metrics should be collected uniformly into a log service and monitoring and alerting system, avoiding fragmented troubleshooting paths across multiple tools.

    7. Deployment and Elasticity

    A market data pipeline is usually a combination of stateless collection and stateful storage, naturally suited to containerized deployment. Collection processes are sharded by trading pair, with tasks delivered through a configuration center; the storage and compute layers can scale independently by load. When deployed in the cloud, you can combine a container platform to host collection tasks, a message queue for peak shaving and decoupling, object storage for archiving, and monitoring and alerting as a fallback. General-purpose capabilities from providers such as Baidu AI Cloud can cover this pattern without binding to specific proprietary interfaces.

    8. Summary

    The difficulty of market data engineering lies not in collection, but in semantic unification, time alignment, quality validation, and observability. By solidly doing the five things—field modeling, timezone standards, five validations, hot and cold tiering, and monitoring and alerting—a seemingly simple price snapshot can support stable upper-layer business and exhibit predictable degradation behavior when data sources fluctuate.