Skip to content
← Blog
Tutorial

Forecasting Hyperliquid funding: a 10-minute tutorial

Pull hourly Hyperliquid funding with the Python SDK, measure how sticky it is, and build the innovation series that actually carries the forecast. Free over the trailing month.

Perpetual funding on Hyperliquid looks easy to forecast. It's sticky: today's hourly rate is a good guess for tomorrow's. But "tomorrow ≈ today" is a base rate, not a forecast. Anyone can read it off the last price. The real question is what's left after you subtract that stickiness.

This is a follow-along tutorial. You'll need the Python SDK and a free API key. Funding is free over the trailing month, and a one-off bundle adds the history behind it. By the end you'll have pulled real hourly funding, measured exactly how sticky it is, and built the innovation series (funding minus its own trailing average), which is where any genuine forecast has to live.

Set up

Install the SDK and export your key:

pip install "tessera-api[polars]"
export TESSERA_API_KEY="..."   # from https://tesseralytics.dev

Funding is free over the trailing month, so a free key reads the last month of hours with no card. The script below reaches further back; a one-off bundle is what buys that history: bundles.

Pull hourly funding

gold_funding_1h is hourly funding, partitioned per (coin, month). Read BTC, ETH and SOL for six months, projecting just the columns we need:

import polars as pl
import tessera

client = tessera.TesseraClient()  # reads $TESSERA_API_KEY

funding = client.read(
    "gold_funding_1h",
    coin=["BTC", "ETH", "SOL"],
    month=tessera.MonthSpan("2026-01", "2026-06"),
    columns=["time", "coin", "funding_rate"],
)

# Autocorrelation of hourly funding at increasing lags, per coin.
lags = [1, 6, 12, 24, 72, 168]   # hours

def autocorr(s: pl.Series, h: int) -> float:
    # Pearson correlation of the series against itself, lagged by h rows.
    df = pl.DataFrame({"x": s.slice(0, s.len() - h), "y": s.slice(h)})
    return df.select(pl.corr("x", "y")).item()

rows = []
for coin in funding["coin"].unique().to_list():
    s = funding.filter(pl.col("coin") == coin).sort("time")["funding_rate"]
    rows.append({"coin": coin, **{f"{h}h": round(autocorr(s, h), 3) for h in lags}})

pl.DataFrame(rows)
How sticky is hourly funding? Autocorrelation of hourly funding against itself, averaged over BTC, ETH and SOL.

Close to 0.9 at a one-hour lag, fading to almost nothing within a week. That slow decay is the base rate: "tomorrow ≈ today".

Subtract the stickiness

Define the innovation as funding minus its own 7-day trailing mean (168 hourly bars). Persistence lives in the level; strip it off and see how much survives:

d = (
    funding.sort("coin", "time")
    .with_columns(
        pl.col("funding_rate")
        .rolling_mean(window_size=168, min_samples=1)
        .over("coin")
        .alias("trailing_7d")
    )
    .with_columns(
        (pl.col("funding_rate") - pl.col("trailing_7d")).alias("innovation")
    )
    .drop_nulls()
)

for name in ("funding_rate", "innovation"):
    s = d.filter(pl.col("coin") == "BTC").sort("time")[name]
    print(f"{name:>13}  24h: {autocorr(s, 24):.3f}   72h: {autocorr(s, 72):.3f}")

The level's decay, read off the sample behind the chart: 0.3478 at a one-day lag, 0.1689 at three days, 0.08 at a week. It slides the whole way down, with no step and no shelf, and that already sets a horizon on the base rate: "tomorrow ≈ today" is worth 0.35 at a day, and by the end of the week the level is telling you almost nothing. What the subtraction then does to that path is what the snippet above prints: it runs the same autocorrelation over funding_rate and over innovation, side by side, on your own window.

What that means

"Tomorrow ≈ today" is doing almost all of the work, and it is a free base rate anyone can compute: the level still autocorrelates at 0.8812 an hour out and 0.3478 a day out, then falls to 0.08 by the week. A model of funding that stops at the base rate is a model of the trailing average. What the innovation adds beyond it is what you measure when you run the snippet, and that is worth treating as a feature to stack on a model you already have, not a buy/sell button. Everything above runs on one dataset, the funding tile, pulled through the SDK.