Backtesting

Get Klines

Query historical OHLCV klines for backtesting.

The archive stores closed 1-minute bars. interval (1m default, or 5m, 15m, 30m, 1h, 4h, 1d) aggregates them per request on the UTC grid: t is the bar open, and n says how many 1-minute bars went into it, so a bar with a gap, or one still forming at end, is visible. start is floored to the interval. Until 2026-10-10 interval was not read at all and every call returned 1m bars.

grain says what a row is, coverage where local rows start and stop for this symbol, and next_cursor / has_more page the window without re-fetching a boundary bar. An aggregated page scans at most ~278 days of 1m rows, so a long 1d request pages early. An unrecognised query parameter is a 400.

get/api/v1/backtesting/klines

Request

  • Base URL: https://cryptodataapi.com
  • URL: https://cryptodataapi.com/api/v1/backtesting/klines
  • Auth: API key in header X-API-Key

Query parameters

symbolstring required

Trading pair, e.g. BTCUSDT (Binance) or BTC (Hyperliquid)

exchangestring

binance or hyperliquid

intervalstring

Bar width: 1m (as stored), or 5m, 15m, 30m, 1h, 4h, 1d, aggregated from the 1m bars on the UTC grid

startstring required

Start time (ISO 8601 or unix ms)

endstring

End time (ISO 8601 or unix ms, defaults to now). EXCLUSIVE — the range is [start, end), so consecutive windows do not repeat a boundary row.

boundsstring

Interval convention for start/end. half-open (default) is [start, end) — end is EXCLUSIVE, so consecutive windows tile without repeating a boundary row. closed is [start, end] — end INCLUSIVE, the pre-2026-08-08 behaviour; use it only to keep an existing integration byte-identical.

limitinteger
cursorstring nullable

Opaque page cursor — the next_cursor of the previous response, verbatim. Resumes strictly after the last row served, keyed on the table's full primary key, so a page boundary inside a same-millisecond burst loses nothing (unlike start = last.time + 1). start / end still bound the window.

formatstring

json or csv. CSV has no envelope: paging state travels in the X-Has-More / X-Next-Cursor response headers.

Response

Successful Response

next_cursorstring nullable
has_moreboolean
symbolstring required
exchangestring required
intervalstring required
countinteger required

Changes

No recorded changes to this operation across all 1 revision of this API.