Market Data Pipeline Engineering: Collection, Parsing, and Governance for Digital Asset Tickers
This article explains how to build a reliable market data pipeline for digital asset tickers, covering data contracts, field semantics, timestamp and precision handling, validation, deduplication, storage selection, and monitoring. It shows why derived fields such as 24-hour change must be recomputed rather than trusted, how to normalize raw snapshots with Python, and how to design a five-layer pipeline that turns error-prone quotes into traceable data assets for quantitative research and risk monitoring. Sample JSON, Python, and SQL snippets are included.
1. Why Market Data Needs Engineering Governance
In digital asset trading, quantitative research, and risk monitoring, ticker snapshots are the most fundamental and highest-frequency data input. A single record that looks simple often carries more than a dozen fields: trading pair identifier, market type, last traded price, 24-hour absolute and percentage change, open, high, low, market cap, market cap rank, and update time. Without unified governance, these fields can pick up discrepancies across collection, transport, storage, and computation, which eventually leads to distorted backtests and false risk threshold triggers.
Here is a typical snapshot (the data only illustrates the structure and is not a live quote):
{"symbol": "GLM","pair": "GLMUSDT","market": "CRYPTO","name": "Golem","last": 0.09359,"quote": "USD","change24h": 0.00009989,"changePercent24h": 0.107,"open24h": 0.09349,"high24h": 0.09539,"low24h": 0.09119,"marketCap": 93733100,"rank": 164,"updatedAt": "2026-12-01 19:49:31"}
The engineering goal is to make this kind of structure parse reliably across different sources, frequencies, and precisions, while preserving traceable context.
2. Field Semantics and the Data Contract
The first step is to define an explicit data contract so that identical field names do not carry different meanings. It helps to group fields into four categories:
- Identity:
symbol,pair,market,name, used as keys and for routing; - Price:
last,open24h,high24h,low24h, which need consistent precision and rounding rules; - Derived:
change24h,changePercent24h, which are computed results and must record how they were calculated; - Metadata:
marketCap,rank,updatedAt, used for sorting, filtering, and freshness checks.
Derived fields deserve extra caution. The absolute and percentage changes are not collected independently; they are derived from the last price and the 24-hour open. If the upstream refreshes the open at one moment but does not refresh the last price at the same time, the change will no longer be consistent with the price. The parsing layer should therefore keep the raw values and recompute downstream on demand instead of blindly trusting the derived fields.
def normalize(raw: dict) -> dict:last = float(raw["last"])open24 = float(raw["open24h"])return {"symbol": raw["symbol"].upper(),"pair": raw["pair"].upper(),"last": last,"open24h": open24,"change_abs": round(last - open24, 8),"change_pct": round((last - open24) / open24 * 100, 4) if open24 else None,"ts": parse_ts(raw["updatedAt"]),}
3. Timestamps, Precision, and Numerical Stability
Two hidden pitfalls in market data are time and precision. A timestamp must state its timezone and semantics: is it the collection time, the exchange matching time, or the ingestion time? Mixing the three breaks cross-source alignment. A practical rule is to convert everything to timezone-aware UTC inside the pipeline while keeping the original string in the metadata.
For precision, price fields should be carried as fixed-point numbers or strings to avoid binary floating-point tail differences during accumulation and comparison. If floating point is unavoidable, fix the number of rounding digits and introduce a tolerance when comparing:
EPS = 1e-8def price_gt(a: float, b: float) -> bool:return a - b > EPS
Percentage fields such as the change rate also need attention to their unit. A value of 0.107 means 0.107%, not 10.7%, so the unit should be stated explicitly on ingestion to prevent downstream misuse.
4. Validation, Deduplication, and Exception Handling
A ticker stream is high-frequency, out of order, and possibly duplicated. The parsing layer should implement at least three kinds of checks:
- Range check:
low24h <= last <= high24h, andopen24hfalls within a reasonable range for the day; - Consistency check: the deviation between the derived change and the recomputed value stays within tolerance;
- Freshness check: if
updatedAtdiffers from the current time by more than a threshold, mark the record as stale.
Deduplication can use (pair, updatedAt) as an idempotency key, combined with a message queue to achieve idempotent consumption under at-least-once delivery. For out-of-order data, use a dual criterion of version number plus timestamp, and discard expired versions.
def is_valid(d: dict) -> bool:if not (d["low24h"] <= d["last"] <= d["high24h"]):return Falseif d["open24h"] <= 0:return Falsereturn abs(d["change_pct"] - d["change_pct_recalc"]) < 0.01
5. Storage Selection and Query Patterns
Query patterns determine the storage choice. If only the latest snapshot is needed, an in-memory key-value store is enough. If historical lookback and aggregation are required, use a columnar or time-series store, partitioned by pair and ordered by time, to support range scans and downsampling. Raw payloads should be archived to object storage for auditing and replay.
A simplified table definition:
CREATE TABLE ticker_snapshot (pair VARCHAR(32) NOT NULL,ts TIMESTAMPTZ NOT NULL,last NUMERIC(20,8),open24h NUMERIC(20,8),high24h NUMERIC(20,8),low24h NUMERIC(20,8),change_pct NUMERIC(10,4),rank INT,PRIMARY KEY (pair, ts));
6. Pipeline Architecture and General Cloud Capabilities
A typical pipeline has five layers: collection, buffering, parsing, storage, and alerting. The collection layer handles multi-source pulling with rate limiting and backoff. The buffering layer uses a message queue to smooth peaks and prevent downstream services from being overwhelmed by bursts. The parsing layer performs stateless transformation so it can scale horizontally. The storage layer separates hot and cold data. The alerting layer triggers on monitoring metrics.
On Baidu AI Cloud, a message queue can carry the ticker stream, object storage can archive raw payloads, a container platform can host the stateless parsing service, and log and monitoring services can track latency, drop rate, and the proportion of stale data. These are general-purpose capabilities; refer to the official product documentation for specific parameters.
7. Monitoring Metrics and Capacity Planning
At minimum, monitor these metrics: end-to-end latency percentiles, message backlog per unit time, parsing failure rate, stale data ratio, and the number of out-of-range prices. For capacity planning, reserve buffer at 2 to 3 times the peak message rate, and keep the parsing service stateless so it can auto-scale based on CPU and backlog.
8. Summary
The core of market data engineering is not “getting a quote,” but keeping quotes trustworthy and traceable across sources, times, and precisions. With an explicit data contract, unified time and precision, strict validation and deduplication, layered storage, and an elastic pipeline built on general cloud capabilities, teams can turn error-prone raw snapshots into stable data assets that support quantitative research and risk monitoring.
