Methodology

How to backtest a funding-rate strategy on Hyperliquid

A six-step recipe: pick a funding signal (level, dispersion, or custom), define entry and exit, size for carry with vol targeting, plot decomposed price-vs-funding P&L to validate the source of return, and stress-test across regimes. Real components, single-venue HL.

By Keel Research Team · Updated May 18, 2026

What a funding-rate strategy actually is

A funding-rate strategy earns from the funding cashflow paid between perp longs and shorts — not from price prediction. On Hyperliquid, funding is paid every hour. The mechanical version: if the funding rate is positive (longs pay shorts), a short collects funding while taking price risk on the asset; if it is negative, a long collects funding while taking the opposite price risk.

The right framing is carry, not alpha. The carry is real — funding cashflow is a deterministic payment, not a forecast — but you accept directional price exposure to receive it. The job of the backtest is to find the regimes and entry rules where the carry outpaces the price risk, and the universe and sizing rules that keep the strategy alive when it doesn’t.

Two carry shapes worth distinguishing up front. Time-series carry takes positions in single assets based on the level of their funding rate — short BTC when BTC funding is rich, flat otherwise. Cross-sectional carry takes a long-short basket each rebalance: long the assets with the lowest funding, short the assets with the highest. Cross-sectional carry has lower per-asset directional exposure (the longs and shorts partially offset on market-wide moves) and is usually the right starting shape on Hyperliquid’s top-30-perp universe.

Step 1 — Pick a funding signal

Keel ships two funding-aware regime components — FundingLevelRegime and FundingDispersionRegime. You can also write a custom signal that consumes the funding series directly. Drop either into the visual builder from the components panel and click through to inline docs to see the full parameter spec.

SignalShapeUse when
FundingLevelRegimeEmits a regime when funding is above/below configurable thresholdsTime-series: you want to be short only in high-funding regimes
FundingDispersionRegimeCross-sectional regime over the universe — wide vs narrow funding dispersionCross-section: you want to long-lowest / short-highest funding
Custom SignalComponentAnything that consumes the funding series and emits a normalized signalYou have a research view that does not fit either pattern

Start with FundingLevelRegime as a gate on top of a simple short-bias signal — that is the most robust shape and the most interpretable when something goes wrong.

Step 2 — Define entry and exit

Two rules, in order. First, a threshold gate: do not enter at all unless funding is above the regime threshold (e.g. annualized funding over 30% on a 7-day average). This avoids taking carry positions in flat regimes where the price risk is uncompensated. Second, a regime scaling: when in-regime, scale the target position by how far above the threshold funding has moved, so the book leans into stronger carry regimes and shrinks as carry fades.

Exit on either of two conditions: funding drops back below the threshold for a configurable hold (e.g. 24 hours), or the cross-sectional rank of the asset changes for dispersion strategies. Avoid pure time-based exits — they ignore the actual source of the strategy’s edge.

A separate question is whether to use a hard threshold or a smooth normalizer. A hard threshold (above X annualized funding equals enter, otherwise flat) is the easiest shape to reason about and the easiest to OOS-test, but it produces step changes in the book and high turnover near the boundary. A smooth normalizer (z-score of funding over a trailing window, clipped into a target weight) generates a continuously sized book that drifts in and out with funding magnitude. Both work; start with the hard threshold because the failure mode is louder when it’s wrong.

Step 3 — Size for carry, not for momentum

Carry trades are short-vol in shape: you collect a steady drip and occasionally take a large adverse move. Size accordingly:

  • Per-leg vol target of 10-15% annualized. Lower than for momentum strategies (15-20% is typical), because the carry-strategy P&L distribution has fatter left tails.
  • Gross leverage cap of 1-2x. The vol target alone is not enough — without a gross cap, a 30-asset book each at 12% leg vol can sit at 5-6x gross in a calm regime and then take a portfolio-wide hit when funding normalizes.
  • Universe filter on liquidity. Restrict to the top 30-50 perps by 30-day dollar volume. Funding prints on thin names look enormous and invert next bar — they are not a tradable edge.

Step 4 — Decomposed P&L plot

The diagnostic that matters most for a funding-rate strategy is the decomposed equity curve — price-only vs funding-only on the same run. The Keel app renders all three (funding-only, price-only, combined) on the backtest detail page; open any backtest from the strategy view and the curves overlay by default with per-series toggles.

Driving Keel from a terminal or an AI agent? The keel-trade CLI returns the same three series in the results JSON so you can compute funding attribution in your own notebook:

pipx install keel-trade
keel auth login
keel strategy create funding_carry_top30.py
keel backtest run str_abc123 --start-date 2024-08-15 --end-date 2026-03-11
keel backtest results bt_xyz789   # decomposed equity series in JSON

A healthy funding strategy shows a smooth positive funding-only curve and a noisy near-zero price-only curve. If the funding-only curve is positive but the price-only curve has a steady negative drift, you are running a short-bias strategy with a carry hat — the carry is being eaten by the underlying. Decomposition makes the source of return explicit; without it, you cannot tell whether you have a carry edge or just luck on the price leg.

Step 5 — Validate

Single-window optimization ships in the Keel app; rolling and anchored walk-forward are roadmap. The practical minimum:

  • Hold out the most recent 3-6 months. Run a backtest with an end-date set 3-6 months before today to fit the threshold and regime parameters on the older slice, then re-run on the held-out window to score.
  • Score across at least two funding regimes. Hyperliquid has had positive-bias, neutral, and inverted funding stretches since launch. A strategy that earns only in one of those is a regime bet, not a carry edge.
  • Check the decomposed curves on every parameter set. If a tweak that raises combined Sharpe is actually shifting return into the price leg (a hidden directional bet), reject it.

Common failure modes

  • Treating funding as a fixed cost. Subtracting a flat haircut per day from price returns destroys the signal — funding is a signed cashflow on the prior position, not a price effect.
  • Ignoring regime. A funding strategy with no regime gate trades aggressively in flat or inverted regimes where the carry is uncompensated. Always gate.
  • Forgetting direction. Funding sign and position sign interact — a long in a positive-funding regime pays funding (cost), a short collects (income). Auditing the weight × funding-rate sign on every bar catches the bug cheaply.
  • Assuming cross-venue carry. A high HL funding rate is not the same as a high Binance funding rate. Keel backtests single-venue HL only; cross-venue spread research has to happen outside the platform and cross-venue execution is not on the near roadmap.
  • Sizing by funding magnitude. A +0.1%/hr print on a thin name often inverts the next bar. Sizing proportionally to funding magnitude exposes the book to the worst noise in the universe. Sort the universe by liquidity first, then take a vol-targeted position on the regime gate.
  • No regime stress test. A strategy backtested only across the 2024 positive-funding regime looks great. The same strategy in the 2025 neutral-funding stretch earns nothing while still paying fees and bleeding on price moves. Always score across at least two regimes.

An end-to-end pattern

Putting the recipe together: a cross-sectional funding-carry strategy on the top-30 HL perps by 30-day dollar volume. The signal is the trailing 7-day average funding rate per asset. The regime gate (FundingDispersionRegime) requires cross-sectional dispersion above a threshold — otherwise the basket has nothing to discriminate on. In-regime the strategy goes long the lowest-funding decile and short the highest. Each leg is vol-targeted to 12% annualized; gross leverage capped at 1.5x.

On a typical run, the price-only equity curve oscillates around zero (the price leg is symmetric long/short by construction), the funding-only curve climbs steadily, and the combined curve looks like the funding-only curve with extra noise. That shape is the whole point — when the price-only curve starts trending negative consistently, the regime gate isn’t working and the strategy needs a refit, not a parameter tweak.

Try it

Build a funding-rate strategy with the real Keel components in the visual pipeline builder, run a backtest with decomposed P&L, and deploy the same pipeline to paper or live against your Hyperliquid account. Terminal and AI-agent users can drive the same flow from the keel-trade CLI.

FAQ

Common questions

What is "carry" in a funding-rate strategy?

Carry is the funding cashflow earned (or paid) for holding a position across funding intervals, independent of price movement. On Hyperliquid, a short in a +0.01%/hour funding regime earns ~7.3% of notional per month in pure carry. The question a funding-rate strategy asks is: when do I take that carry, and when does the price move against me badly enough to wipe it out?

How do I pick a funding signal?

Three patterns work. (1) Level — go short when funding is above a threshold, flat otherwise. The Keel FundingLevelRegime component handles this. (2) Dispersion — trade the cross-section of funding rates, long the lowest and short the highest. The FundingDispersionRegime component handles this. (3) Custom — build your own SignalComponent that consumes the funding series and emits a normalized signal. Start with regime-gated level; it is the most robust.

How should I size positions for a carry strategy?

Vol-target the position to a fixed annualized vol budget — typically 10-15% per leg for carry trades, lower than for momentum because carry strategies are short-vol in shape. Then cap gross leverage at the portfolio level. Avoid sizing by funding magnitude alone: a +0.1%/hour print on a thin name often inverts the next bar, and you have already taken size.

How do I read the decomposed P&L plot?

The Keel app renders the funding-only, price-only, and combined equity curves on the backtest detail page; the same three series come back in the API/CLI results JSON for terminal or agent workflows. A healthy carry strategy has a smooth, positive funding curve and a noisy, near-zero price curve. If the funding curve is positive but the price curve dominates negatively, you are funding-collecting your way into bigger losses than you are earning.

What is the live cost of being wrong?

Carry strategies fail in the direction of their position — a short funding-collector loses when the asset rallies hard, because funding income cannot keep up with the mark-to-market loss. The classic failure mode is a 2-week stretch where funding is +0.02%/hr (great), the asset rallies 40% (bad), and the carry collected covers ~10% of the loss. Vol targeting and regime gating exist to size around this.

Can I backtest cross-venue funding spreads?

No — Keel currently runs single-venue Hyperliquid only. The simulator takes one funding-rate series per asset, tied to the HL price series it is trading. Cross-venue spread strategies (HL vs Binance, HL vs Bybit) are out of scope; you would need to source other-venue funding manually and the platform does not yet model two-venue execution.