Collecting and Parsing Digital Asset Market Data: A Practical Guide
This article walks through the practical engineering work behind digital asset market data pipelines, using a sample spot ticker snapshot as the starting point. It covers unified data modeling with separated dimensions and facts, fixed-point precision, dual timestamps for event and ingest time, rule-based validation, collection strategies that combine push and polling, layered storage and computation, timezone handling, reproducibility, and monitoring for data trustworthiness. Readers will find concrete schema examples, validation logic, and operational guidance for building reliable market data systems.
1. Starting With a Single Ticker Snapshot
When building a market data system, the first problem to solve is not “what to display” but “how to reliably and accurately obtain and interpret the data.” Below is a typical spot market ticker snapshot (fields have been neutralized):
{"symbol": "GLMUSDT","market_type": "CRYPTO","base_asset": "Golem","quote_currency": "USD","last_price": 0.09359,"open_24h": 0.09349,"high_24h": 0.09539,"low_24h": 0.09119,"change_24h": 0.00009989,"change_rate_24h": 0.107,"market_cap": 93733100,"rank": 164,"update_time": "2026-12-01 19:49:31"}
This record carries little information, yet it is enough to raise a full set of engineering questions: how to handle price precision, whether the change amount and change rate are self-consistent, how market cap and rank are updated, how to unify timestamp timezones, and how to fill in missing data. Each layer is unpacked below.
2. Unified Modeling of Market Data
2.1 Separating Dimensions From Facts
Market data is essentially a structure of “dimensions plus facts.” Dimensions include the trading pair, market type, quote currency, and asset name. Facts include the latest price, open price, high, low, change amount, change rate, market cap, and rank.
When designing the table or message structure, keep dimensions stable and facts extensible:
CREATE TABLE ticker_snapshot (symbol VARCHAR(32) NOT NULL,market_type VARCHAR(16) NOT NULL,quote_ccy VARCHAR(8) NOT NULL,last_price DECIMAL(28,12),open_24h DECIMAL(28,12),high_24h DECIMAL(28,12),low_24h DECIMAL(28,12),change_24h DECIMAL(28,12),change_rate DECIMAL(18,6),market_cap DECIMAL(28,4),rank_no INT,event_time TIMESTAMP NOT NULL,ingest_time TIMESTAMP NOT NULL,PRIMARY KEY (symbol, event_time));
The key point is that price fields must use high-precision fixed-point numbers; floating point is prohibited. A decimal like 0.09359 produces trailing-digit drift under floating point, and that error is amplified once it accumulates into aggregate statistics.
2.2 Dual Timelines: Event Time and Ingest Time
event_time marks when the data was produced; ingest_time marks when the system received it. The difference between the two is the core indicator for judging data freshness. Keeping only one time field makes it very difficult to investigate “data delay” and “data duplication” later.
3. Data Validation: Stopping Errors Before They Are Stored
The three most common problems in market data can all be intercepted with rule-based validation.
First, consistency validation. The change amount should roughly equal the latest price minus the 24-hour open: 0.09359 − 0.09349 = 0.00010, which is consistent with the given 0.00009989 within precision tolerance; the change rate should roughly equal the change amount divided by the previous close. If the deviation between the two exceeds a threshold, the data source is using a different internal calculation basis, and the record should be flagged rather than discarded outright.
def validate(t):errs = []if t["high_24h"] < t["low_24h"]:errs.append("high<low")if not (t["low_24h"] <= t["last_price"] <= t["high_24h"]):errs.append("last_out_of_range")calc = t["last_price"] - t["open_24h"]if abs(calc - t["change_24h"]) > 1e-6:errs.append("change_inconsistent")return errs
Second, range validation. Prices must be positive; the reasonable range for the change rate should be set according to the volatility characteristics of the asset; market cap and rank should fall within a monotonic, explainable range.
Third, sequence validation. The event time for the same trading pair must increase monotonically. A regression usually means the data source has switched or a cache is being replayed, and deduplication is required.
4. Collection Layer Design: Choosing Between Polling and Push
Market data ingestion typically comes in two modes. Polling is simple to implement and offers strong controllability, making it suitable for snapshot data, but it introduces fixed latency and wasted requests. Push offers better real-time performance but requires handling reconnection, heartbeat keep-alive, and out-of-order messages.
The more robust engineering approach is “push as primary, polling as fallback”: normally rely on incremental push to maintain low latency, while pulling snapshots at a lower frequency for reconciliation. Once push is interrupted or the validation failure rate rises, automatically degrade to polling.
Collection Scheduler├─ Incremental channel (long connection, 15s heartbeat, exponential backoff reconnect)├─ Snapshot channel (30s interval, for reconciliation and gap filling)└─ Validator → message queue → compute layer / storage layer
For reconnection, use exponential backoff with jitter to avoid a flood of clients hitting the server at the moment it recovers.
5. Layering Storage and Computation
Different use cases call for different storage choices, and this is the main cost variable in a market data system.
- Detailed snapshots: written to a time-series database or columnar storage, partitioned by event time, with a configurable retention period;
- Latest state: written to a high-performance key-value store, keyed by trading pair, valued as the latest snapshot, for sub-second reads by the frontend;
- Aggregate metrics: minute-level, hour-level, and day-level open/high/low/close and volume generated on a rolling basis by stream computing jobs;
- Cold data: archived to object storage, partitioned by day as columnar files, for backtesting and auditing.
On Baidu AI Cloud, you can combine a message queue to absorb traffic peaks, a container platform to host collection and compute jobs, time-series and relational databases to handle details and metadata respectively, and log and monitoring services to close the observability loop. The benefit of this layering is that the read path and write path are decoupled, so historical queries do not slow down the real-time pipeline.
6. Precision, Timezone, and Reproducibility
Three details that are easy to overlook but costly to get wrong.
Precision: use fixed-point numbers or integer minimum units for all price arithmetic, and format only at the presentation layer. Convert before aggregating, and avoid mid-way truncation.
Timezone: store in a standard time format with timezone, and render in the user’s timezone at the presentation layer. If the time in the original snapshot carries no timezone, its source timezone must be made explicit at ingestion and fixed into the metadata; otherwise cross-day statistics will inevitably be wrong.
Reproducibility: retain the original payload (key fields alone are enough) and the parser version number. When a change in parsing logic alters the metric basis, you can trace back and recompute. This is the dividing line for whether a data system can be trusted by the business.
7. Monitoring and Alerting
Monitoring a market data system cannot stop at “is the service alive”; it must also answer “is the data trustworthy.” At least four categories of metrics are recommended:
- Freshness: the quantiles of the gap between event time and current time;
- Completeness: the gap between the expected set of trading pairs and the set that actually arrives;
- Validation failure rate: broken down by rule, to locate whether the problem lies with the data source or the parser;
- Consistency deviation: the proportion of differences between the latest state and snapshot reconciliation.
Alerts should be tiered: a slight rise in freshness is logged first, while a spike in validation failure rate or the appearance of a trading pair gap triggers immediate notification. Every alert should include the timestamp of the most recent successful data, so the blast radius can be judged quickly.
8. Summary
A seemingly simple ticker snapshot expands into systems engineering across six areas: modeling, validation, collection, storage, computation, and monitoring. The core methodology boils down to three sentences: use fixed-point numbers and dual timelines to keep data trustworthy, use rule-based validation to stop problems before storage, and use layered storage with stream-batch combination to balance real-time performance and cost. Get these three solid, and everything downstream — market dashboards, strategy backtesting, or risk metric calculation — has a reliable foundation.
