Recipe 48 of 65
Backtest a trading strategy on Hyperliquid 1-minute candles
Page /v1/hyperliquid/ohlcv with interval=1m and limit=5000, moving start one minute past each page's last candle, and write the bars to a CSV your backtester reads.
GET /v1/hyperliquid/ohlcv answers it with interval=1m: up to 5,000 one-minute bars per call, built from
Hyperliquid's own fills.
There is no cursor: page by moving start to one minute after the last bar you received. A month of one coin is 9 calls.
/ohlcv/export streams the same page as NDJSON if your tool prefers lines. The full parameter lists are on
Candles and Candle export.
Quick answer
Ask for the first page of the window.
# the first page of a backtest window: up to 5,000 BTC minutes from 2026-10-01 00:00 UTC
curl -H "X-API-Key: $VIKE_API_KEY" \
"https://data.vike.io/v1/hyperliquid/ohlcv?symbol=BTC&interval=1m&start=2026-10-01T00:00:00Z&limit=5000"The whole window, written to CSV.
import csv
import os
import requests
H = {"X-API-Key": os.environ["VIKE_API_KEY"]}
URL = "https://data.vike.io/v1/hyperliquid/ohlcv"
start, end = 1788220800000, 1790812800000 # 2026-09-01 to 2026-10-01 UTC, epoch ms, end exclusive
rows = []
while start < end:
r = requests.get(URL, params={"symbol": "BTC", "interval": "1m", "start": start, "end": end, "limit": 5000},
headers=H, timeout=60)
r.raise_for_status()
page = r.json()["candles"]
if not page:
break
rows += page
start = page[-1]["ts"] + 60_000 # one minute after the last bar
with open("btc-1m-2026-09.csv", "w", newline="") as f:
w = csv.DictWriter(f, fieldnames=["ts", "open", "high", "low", "close", "volume", "volume_usd", "n_trades"])
w.writeheader()
w.writerows(rows)Example response
Captured from the live API on 2026-10-24 at 17:16 UTC with limit=3, all three rows shown.
ts is the start of the minute in epoch milliseconds (1790812800000 is 2026-10-01 00:00 UTC). volume is BTC and
volume_usd is USD, both counting each trade once, on the taker side. n_trades is the number of trades in the minute.
{
"symbol": "BTC",
"market": "perp",
"dex": "HL",
"interval": "1m",
"tz": "UTC",
"source": "1m fills rollup",
"candles": [
{
"ts": 1790812800000,
"open": 83607.0,
"high": 83648.0,
"low": 83563.0,
"close": 83563.0,
"volume": 33.734410000000004,
"volume_usd": 2820502.6821699985,
"n_trades": 366
},
{
"ts": 1790812860000,
"open": 83563.0,
"high": 83564.0,
"low": 83532.0,
"close": 83537.0,
"volume": 16.909280000000003,
"volume_usd": 1412738.51764,
"n_trades": 233
},
{
"ts": 1790812920000,
"open": 83532.0,
"high": 83533.0,
"low": 83527.0,
"close": 83527.0,
"volume": 9.619589999999999,
"volume_usd": 803543.4793899999,
"n_trades": 106
}
]
}Variations
The same page as NDJSON. One header line, then one line per bar; billed 2 credits per call instead of 1.
# 5,000 BTC minutes as NDJSON, saved to a file
curl -H "X-API-Key: $VIKE_API_KEY" \
"https://data.vike.io/v1/hyperliquid/ohlcv/export?symbol=BTC&interval=1m&start=2026-10-01T00:00:00Z&limit=5000" \
-o btc-1m-page1.ndjsonOn the same capture with limit=3, the header line named symbol, market, dex, interval, tz and source, and
the next three lines carried the same three bars as the Example response.
Coarser bars for a quick first pass. 5m, 15m, 30m, 1h, 4h and 1d come from the same fills; 5,000 hourly bars cover 208 days.
# 5,000 hourly BTC bars
curl -H "X-API-Key: $VIKE_API_KEY" \
"https://data.vike.io/v1/hyperliquid/ohlcv?symbol=BTC&interval=1h&limit=5000"Funding for a perp backtest. A perp strategy that holds through the hour pays or earns funding. The hourly panel has it beside the close.
# BTC hourly close, open interest, funding rate and premium for September 2026
curl -H "X-API-Key: $VIKE_API_KEY" \
"https://data.vike.io/v1/hyperliquid/symbols/hourly?symbols=BTC&start=2026-09-01T00:00:00Z&end=2026-10-01T00:00:00Z"Before you rely on it
A minute with no trade has no bar
Bars are built from fills, so a minute in which nothing traded is missing, not a zero-volume bar. On BTC that is rare;
on a thin coin it is common. Reindex to a full minute grid and forward-fill close (with zero volume) before you feed a
backtester that assumes evenly spaced bars. The Quick answer's loop also stops at an empty page, so on a coin that can go quiet
for 5,000 minutes, step start forward instead.
end is exclusive and the newest bar may be forming
start is inclusive and end exclusive, in ISO-8601 UTC or epoch milliseconds. Without end the window runs to now,
and the last bar is the minute in progress. Drop it before you save, or pin end to a minute boundary in the past.
Ask your agent
Connected to the Vike MCP server (https://vike.io/mcp) in Claude, ChatGPT or Cursor, ask it in plain words.
The hl_ohlcv tool answers with interval: 1m, 5,000 bars per call at most, at 1 credit a call.
Get the 1-minute BTC candles on Hyperliquid from 2026-10-01 00:00 to 03:00 UTC