A historical forex API can return successfully without covering the period you asked for. Split a capped request into smaller windows, then compare the timestamps you received with the minutes the feed is expected to publish. A row count on its own cannot tell you whether data is missing.
A full response can still be incomplete
Suppose you ask for two hours of one-minute EUR/USD candles and expect 120 bars. If the response has 100 rows and your request limit is 100, it has hit the ceiling. That does not tell you which minutes are absent, which direction the server truncated, or whether the underlying series has a gap. Equally, a response below the limit can contain duplicate timestamps and still miss a minute.
TickDB's Candlestick Data reference documents a default limit of 100 and a maximum of 1,000 for historical bar queries. The Free plan can query candlesticks but cannot specify a date range with start_time or end_time. Do not remove those bounds and count a successful unbounded request as evidence for the original period.
In this synthetic example, each smaller window contains all 60 expected minutes. That is evidence of truncation in the broad response in this example, not a general guarantee about the API.
Test adjoining windows with explicit boundaries
Use closed historical periods and a single instrument and interval. Keep adjacent target windows as [start, stop) in your code. Before mapping those bounds to the API, test a short request with known boundary bars and check which timestamps it returns. The TickDB reference specifies millisecond request timestamps; do not assume an inclusive upper bound or a particular return order. Normalize each response to your target window and retain out-of-window rows as a diagnostic.
Build the expected timestamp list separately using the pair's applicable session and the feed's bar-generation rules. A scheduled closure, a provider-defined break, or a minute for which the feed does not publish a bar is not automatically a data defect. If you cannot verify those rules, label a minute as unobserved, not lost. Avoid the current still-forming candle in the test.
A small Python check for known candle starts
The input below is a list of normalized candle-start timestamps in UTC milliseconds for one symbol and one-minute bars. Supply your own independently determined expected timestamps. The example is a local check, not a live API test.
STEP = 60_000
def audit(rows, start, stop, limit, expected):
"""One symbol/interval. Times are verified candle starts in UTC ms."""
if stop <= start or (stop - start) % STEP or limit <= 0:
raise ValueError("invalid window or limit")
grid = set(range(start, stop, STEP))
if not expected <= grid:
raise ValueError("expected minutes outside the window")
seen, duplicates, outside, off_grid = set(), set(), set(), set()
for t in rows:
if not start <= t < stop:
outside.add(t)
elif (t - start) % STEP:
off_grid.add(t)
else:
if t in seen:
duplicates.add(t)
seen.add(t)
return {
"hit_limit": len(rows) >= limit,
"missing_expected": sorted(expected - seen),
"duplicates": sorted(duplicates),
"outside": sorted(outside),
"off_grid": sorted(off_grid),
}
Run it first on the broad response, then on two adjoining smaller responses. In a local synthetic test, a broad response hit its 100-row limit and omitted 20 expected minutes. The two smaller observations passed. The test also caught a duplicate, an off-grid timestamp and a timestamp equal to the excluded stop. If two requests disagree on values for the same timestamp, preserve both responses for investigation; this timestamp check alone cannot settle which value is correct.
A range is ready for this stage of validation only when the sampled windows have no unexplained omissions, duplicates or boundary surprises. That says nothing by itself about price accuracy or tick-level completeness.
Source checked: TickDB Candlestick Data reference. Figure and test data are synthetic.


Top comments (0)