Market data

Backtest with historical OHLCV

A backtest needs clean, dense candles over a long window. OHLCV is computed per DEX pool (EVM chains only — there is no DEX-pool OHLCV for Bitcoin), so pick the pool, pull 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 empezar
  • A live API key
  • The chain, pool address, interval and window you want to test

1Pull the historical window

Request the chain, pool, interval and limit. 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 candle carries time, open, high, low, close, volume and a trade count. Sort by time 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.

Preguntas frecuentes

How do I cover a multi-month window?

Raise limit and repeat the pull, walking the window in batches (candles come back newest-first). 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.

Sigue leyendo

Recarga, obtén tu clave y publica.

Autoservicio. Paga en cripto o con tarjeta. Medido por créditos: las primitivas pesadas cuestan más, las simples son baratas.

Obtener clave API