Short answer
Call TikTape's GET /api/v1/ohlcv in a loop with startTime, stepping forward 10,000 candles at a time, and load the rows into pandas or write them to CSV. The script below works with any TikTape key, which reads back to 2025-03-23 at every interval, and 1d back to each market's first Hyperliquid candle (BTC from 2020-08-19).
Script: Hyperliquid candles to CSV
import csv, os, time
import requests
API = "https://tiktape.xyz/api/v1/ohlcv"
KEY = os.environ["TIKTAPE_API_KEY"]
STEP_MS = {"1m": 60_000, "5m": 300_000, "15m": 900_000, "1h": 3_600_000, "4h": 14_400_000, "1d": 86_400_000}
def fetch(coin, interval, start_ms, end_ms, limit=10_000):
rows, cursor = [], start_ms
while cursor < end_ms:
r = requests.get(API, headers={"X-API-Key": KEY}, timeout=60,
params={"coin": coin, "interval": interval,
"startTime": cursor, "limit": limit})
if r.status_code == 429:
time.sleep(int(r.headers.get("Retry-After", "5")))
continue
r.raise_for_status()
rows += [row for row in r.json()["data"] if row[0] < end_ms]
cursor += limit * STEP_MS[interval]
return rows
now = int(time.time() * 1000)
candles = fetch("BTC", "1m", now - 7 * 86_400_000, now) # 7 days of 1m bars
with open("hyperliquid_btc_1m.csv", "w", newline="") as f:
w = csv.writer(f)
w.writerow(["timestamp_ms", "open", "high", "low", "close", "volume"])
w.writerows(candles)
print(len(candles), "candles")
Seven days of 1m bars is about 10,080 candles: more than the 5,000 that Hyperliquid's own API returns, in two requests.
Into pandas
import pandas as pd
df = pd.DataFrame(candles, columns=["ts", "open", "high", "low", "close", "volume"])
df["ts"] = pd.to_datetime(df["ts"], unit="ms", utc=True)
df = df.set_index("ts").astype(float)
Already using CCXT?
pip install ccxt-tiktape, then swap ccxt.hyperliquid() for ccxt_tiktape.tiktape({"apiKey": ...}). fetch_ohlcv() keeps the same symbols, timeframes and return format but reads the archive, so params={"paginate": True} goes past 5,000 candles. Code and more runnable examples: github.com/tiktape/ccxt-tiktape.
Details that trip people up
startTimeis inclusive andendTimeexclusive, both Unix milliseconds.- Prices and volume arrive as strings; convert before doing math.
- Spot markets use Hyperliquid ids such as
@1, HIP-3 markets thedex:COINform such ascash:NVDA. - Keys allow 60 requests per minute; a 429 carries
Retry-After.