fetch_candle_snapshot

Documentation for eth_defi.hyperliquid.api.fetch_candle_snapshot function.

fetch_candle_snapshot(session, *, coin, interval, start_time, end_time, timeout=30.0)

Fetch up to 5,000 OHLCV candles for a single coin.

Calls the candleSnapshot Info endpoint. The response is capped at HYPERLIQUID_CANDLE_SNAPSHOT_LIMIT candles regardless of window width, so callers needing longer histories must paginate.

Pre-launch candles (before ~April 2023) are returned but have zero volume — these are backfilled price data, not authentic Hyperliquid trades. Filter by volume > 0 for real bars only.

Uses HyperliquidSession.post_info() for automatic proxy rotation on rate-limit or connectivity failures.

Example:

from datetime import datetime
from eth_defi.hyperliquid.api import fetch_candle_snapshot
from eth_defi.hyperliquid.session import create_hyperliquid_session

session = create_hyperliquid_session()
candles = fetch_candle_snapshot(
    session,
    coin="BTC",
    interval="4h",
    start_time=datetime(2023, 5, 1),
    end_time=datetime(2023, 6, 1),
)
print(f"{len(candles)} candles, first close={candles[0].close}")
Parameters
Returns

Candles in ascending time order. Empty list if no data.

Return type

list[eth_defi.hyperliquid.api.HyperliquidCandle]