Market data

Backtest with historical OHLCV

A backtest needs clean, dense candles over a long window. Pull historical OHLCV by interval and count, page through the window, and cache it — the reads are cheap C1 so the cost of a full backtest is dominated by your compute, not the API.

Antes de começar
  • A live API key
  • The token id, interval and date window you want to test

1Pull the historical window

Request the id, interval and limit for each page of history. OHLCV is a C1 read, so pulling a long window stays cheap.

curl "https://api.1st-node.com/v1/market/ohlcv?id=btc&interval=1h&limit=168" \
  -H "Authorization: Bearer sk_live_..."

2Read and normalize the candles

Each row is timestamp, open, high, low, close and volume. Sort by timestamp and check for gaps before you run the strategy over the series.

> { "candles": [
>   [1712000000, 68120.0, 68540.2, 67980.1, 68410.5, 1204.7] ] }

3Cache once, iterate many times

Historical candles are immutable, so pull the window once and cache it locally. A tuning loop then reruns over cached data without spending credits on every pass.

Perguntas frequentes

How do I cover a multi-month window?

Page the OHLCV endpoint with interval and limit, walking the window in batches. Concatenate the pages in timestamp order into one series.

Will repeated backtests burn credits?

Only the initial pull. OHLCV is a cheap C1 read and historical candles never change, so cache the series and rerun your strategy for free.

Continue lendo

Recarregue, pegue a chave e publique.

Autoatendimento. Pague em cripto ou cartão. Medido por créditos: primitivas pesadas custam mais, as simples são baratas.

Obter chave de API