A-share market data API: Why a 300-stock report still needs a trading-date check
TickDB Research ·
A-share market data API: Why a 300-stock report still needs a trading-date check
An after-close job can receive all 300 quotes and still contain a quote from the wrong day. In a local replay of a real CSI 300 sample, complete input updated the date in the reader file to November 20. Removing a row or changing one quote to an older date left the file on November 19. The file contained the date and row count only.
You rerun Friday's market report on Saturday. The job counts 300 rows against the CSI 300 list and prepares to replace the report. What if one of those quotes came from Thursday? The row count would still be right, but the resulting rankings would mix two trading days.
Set the target trading date, then check each quote
We fetched the TickDB A-share snapshot on November 21, 2026, and matched all 300 symbols on the frozen CSI 300 list. The quote date was November 20 for all 300. The fetch timestamp tells you when you got the file. Use the quote's source timestamp to check whether each row belongs in the Friday report.
Use the exchange calendar to set the target date and pass it directly on a backfill. After fetching TickDB A-share snapshots, convert each source timestamp to the market time zone before taking the date. Compare each date with the target. List suspensions and unavailable quotes separately so you can decide whether the report can go out with those gaps. TickDB A-Share Market Data API
Three local replays, one switch
We put a file representing the November 19 version in a temporary directory. The test wrote and swapped the file only when validation passed. The file records the date and row count so we can see which version is active. We ran the complete snapshot, then removed one row, then restored that row but changed its quote date to November 19.

| Input | Rows | Validation | Date in local reader file |
|---|---|---|---|
| Complete observed sample | 300 | List and date passed | Nov. 20 |
| One row removed | 299 | Missing 688256.SH | Nov. 19 |
| One quote date changed | 300 | Wrong date for 688256.SH | Nov. 19 |
The previous file's hash stayed the same on both failed runs. This test used a local file replacement within one filesystem. If you deliver reports through object storage or run multiple writers, verify version selection, concurrent writes and reader behavior in that environment.
Hand over the checks and the visible report date
Check HTTP and application-level success. Use an independent, nonempty list to find missing, extra or duplicate symbols and quotes from the wrong day. Let the publishing job switch the reader only after the checks pass. On a failure, log the target date, the affected symbols, the reason and the visible date. Show the date of the visible version to readers.
from collections import Counter
def invalid_rows(expected, records, target):
if not expected:
raise ValueError("Expected symbol list is empty")
counts = Counter(code for code, _ in records)
return {
"missing": sorted(expected - counts.keys()),
"extra": sorted(counts.keys() - expected),
"duplicate": sorted(c for c, n in counts.items() if n > 1),
"wrong_date": sorted(c for c, day in records if day != target),
}
The function takes the actual (symbol, quote_date) pairs and the expected symbol set. An empty expected list raises an error. Hand off to the publishing step only after all four checks are clear. In the stale-row test, the log could read: November 20 target, 688256.SH quote dated November 19, and November 19 still visible.
FAQ
Can I publish a report if all symbols are present but a few quotes are older? Follow the report's freshness rule. If older quotes are acceptable, display their dates and disclose coverage. If the report promises a complete set for one trading day, hold the update and show the date of the visible version.
References
- Frozen CSI 300 list and TickDB A-share snapshot reconciliation. Quote date November 20, 2026, fetched November 21.
- Local candidate-file switch test, complete input and two injected failures.
This week's offer

TickDB Black Friday Subscription Week runs November 23–29, 2026, ending at 11:59 p.m. Beijing time. Save 15% on semiannual billing and get half a month extra, or save 20% on annual billing and get one month extra. The offer applies to new paid subscriptions and renewals. The extra time is added automatically after payment.
7 markets · 42,688 symbols
- US stocks
- 14,386
- Hong Kong market
- 3,354
- China stocks, ETFs & bonds
- 7,576
- Forex & metals
- 1,228
- Indices
- 13,960
- Futures
- 1,172
- Crypto
- 1,012