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.

The local reader file shows November 20 for complete input. It keeps November 19 when a row is deliberately removed or made stale

InputRowsValidationDate in local reader file
Complete observed sample300List and date passedNov. 20
One row removed299Missing 688256.SHNov. 19
One quote date changed300Wrong date for 688256.SHNov. 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

Original TickDB Black Friday banner

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
11/25/2026

Related articles

Did Your Watchlist Follow the Index? A Midday Review with a Real-Time China A-Share Stock API

On November 23, the ChiNext Index opened lower and was up 1.22% by midday. Yet 209 stocks in our example watchlist were still below their previous close. Use opening prices, previous closes, and midday quotes from a real-time China A-share stock API to see which stocks rebounded, which turned positive, and whether your watchlist still warrants a risk flag.

TickDB Research ·

US stock kline API: How to check batch downloads for missing and duplicate bars

How do you verify coverage after downloading US daily bars in batches? A complete AAPL response contained 15 bars. The same window with limit=2 returned the final two. Splitting the 15 bars offline produced either an extra row or a missing date at the boundary. Here is how to distinguish those cases and check your downloaded batches against a trading calendar.

TickDB Research ·

Financial data in a backtest: When can you use earnings reported after the close?

If your stock screen runs at 4 p.m. New York time, when can it use Apple's latest quarterly net income? Using EDGAR acceptance as a proxy, the July 31 screen cannot use the figure, while the August 1 screen can. We verify the amount against TickDB's response and the SEC exhibit, then show a cutoff check you can run on your own records.

TickDB Research ·

US stock minute data API: Where to look first in a post-session watchlist review

Two watchlist entries gained about 1% from the open to the final one-minute close. Which part of the session should you review first? In two archived TickDB samples, AAPL ended 0.20% below its intraday high and NVDA ended 0.82% below its high. Record the minute containing the high alongside those two percentages to find where to start.

TickDB Research ·