BACKTESTING · FUNDING

Funding Costs in Perpetual Backtests: Use Settlement Timestamps

Funding is charged at specific settlement times. A backtest that spreads it evenly, or ignores it, misstates the cost of holding perpetual positions.

Short answer

In perpetual backtests, apply funding only at actual settlement timestamps, and only to positions open at those moments: notional × funding rate for that settlement, paid or received depending on side and sign. Use historical funding rates (Binance's fundingRate history includes fundingTime) and each contract's interval (some Binance symbols have adjusted intervals; Hyperliquid pays hourly). Positions opened and closed between settlements pay no funding; positions held across many settlements can pay more than fees.

Method

Applying funding in a backtestApplying funding in a backtest. Steps: 1. Load funding history — Rate and fundingTime; 2. Check interval — Per contract; 3. At each settlement — Is position open?; 4. Charge or credit — Notional × rate × side; 5. Accumulate — Report separately1Load fundinghistoryRate andfundingTime2Check intervalPer contract3At eachsettlementIs position open?4Charge or creditNotional × rate ×side5AccumulateReport separately
Funding is event-based, not continuous. Original ChartsPod editorial graphic.

Example

SettlementRatePosition (long)Funding
00:00+0.010%$50,000−$5.00
08:00+0.030%$50,000−$15.00
16:00−0.005%$50,000+$2.50

Illustrative: a long held across three settlements pays $17.50 net. A trade opened at 01:00 and closed at 07:00 pays nothing.

Illustrative cost breakdown for a 3-day long ($)Illustrative cost breakdown for a 3-day long ($): Fees 50 $; Slippage 30 $; Funding 95 $.ILLUSTRATIVE COST BREAKDOWN FOR A 3-DAY LONG ($)Fees$50Slippage$30Funding$95
For held positions, funding can be the largest cost. Original ChartsPod editorial graphic.

Pitfalls

Funding in backtestsFunding in backtests: Use historical rates, not a constant; Use each contract's interval; Apply only at settlement times; Sign by side (long pays positive); Report funding separately from fees.FUNDING IN BACKTESTSUse historical rates, not a constantUse each contract's intervalApply only at settlement timesSign by side (long pays positive)Report funding separately from fees
Most errors come from constant or continuous funding. Original ChartsPod editorial graphic.

Related: Crypto Funding Rates: Compare One-Hour and Eight-Hour Payments, ChartsPod Backtesting: Set Fees and Slippage Before Comparing Results, Annualized Futures Premium: Calculate Carry After Fees and Funding.

Example: a strategy that only works without funding

Illustrative: a trend strategy on a perpetual holds positions for an average of five days, mostly long during rallies when funding is positive. Before funding, return is +22% a year; with historical funding applied at settlement times, it falls to +9%. The strategy is still positive, but funding is its largest cost, larger than fees. Testing a spot or dated-future version, or filtering entries when funding is extreme, becomes a sensible next step.

Conclusion

Apply historical funding at real settlement timestamps to positions open at those times, and report it separately.

Include funding when backtesting perpetual strategies.

Open the ChartsPod terminal

Compare Funding Costs in Perpetual Backtests across Binance, Bybit, OKX and Hyperliquid markets.

Open markets in ChartsPod

Questions readers ask

Do I pay funding if I close before settlement?

No; funding applies to positions open at settlement.

Can I use an average funding rate?

It hides timing and sign changes; use historical rates.

How often is funding paid?

Depends on venue and contract: often 8 hours; Hyperliquid hourly.

Sources and methodology

Backtesting principles follow TradingView's Pine Script documentation on strategies, repainting and non-standard charts, and ChartsPod's strategies-and-backtests guide summary, as read on 17 October 2026. All numbers are illustrative and do not describe a real strategy's performance. Funding mechanics from Binance and Hyperliquid documentation.

  1. Binance: USD-M market data (long/short ratios, OI statistics, klines) — ratio definitions, 30-day retention, kline open/close time.
  2. Hyperliquid docs: Funding — hourly payments, 1/8 of the 8-hour rate, oracle price for notional.
  3. TradingView Pine Script: Strategies — simulated fills and assumptions.

This article explains research tools and workflows. It is not financial advice, does not recommend buying or selling any asset and does not predict prices. Crypto derivatives carry a risk of rapid and total loss of margin.

CHARTSPOD EDITORIAL EDITION · RESEARCH AND EDUCATION ONLY · NOT FINANCIAL ADVICE.