The first time I put funding into a perp backtest, a strategy I was fairly proud of stopped working. It was a simple long-bias thing on a large-cap perp, held through trends, and on paper it printed. Then I subtracted the funding it would have actually paid to hold those positions, and the equity curve rolled over and died. Nothing about the entries or exits changed. The trades were the same trades. The only new input was the cost of borrowing the exposure, and that cost was enough to flip a winner into a loser. That is the whole problem in one sentence, and almost every perp backtest I see quietly ignores it.
Why funding is not a rounding error
A perpetual future has no expiry, so there is no settlement date to drag its price back to spot. The funding rate is the mechanism that does that job instead. When the perp trades above the underlying, longs pay shorts. When it trades below, shorts pay longs. The payment happens on a fixed schedule, and on most venues that schedule is every eight hours, so three times a day. The rate itself is small per interval, often a fraction of a basis point up to a few basis points, but you pay it three times a day, every day you hold, and it compounds against you if you are on the crowded side.
Do the arithmetic on a crowded long in a hot market and it stops looking small. A funding rate that sits at the high end of a venue's normal range, paid three times a day, annualizes into the tens of percent without much trouble, and on genuinely euphoric names it can run past 50 percent annualized for stretches. If your strategy is structurally long the popular side of the book, you are paying that the whole time. A backtest that skips it is not modeling your strategy. It is modeling a free version of your strategy that does not exist.
Sourcing the historical rates
You need the actual realized funding rate at each settlement, per symbol, per venue. Not the predicted rate you see ticking in the UI, and not a daily average. The realized value that was charged at the moment of settlement is the number that hit real accounts, so it is the number your backtest has to use.
Most major derivatives venues expose a funding rate history endpoint, and it is one of the more reliable pieces of public market data you can pull. A workable pipeline looks like this:
- Pull the full funding history for every symbol you plan to test, straight from the venue that actually lists the perp. Rates differ across venues for the same underlying, so do not borrow one exchange's funding for a position you are modeling on another.
- Store each record as a timestamp, a symbol, and a signed rate. Keep the sign convention explicit. A positive rate almost always means longs pay shorts, but confirm it against the venue's own documentation rather than assuming.
- Confirm the interval. Eight hours is the common default, but some venues shorten the interval when rates get extreme, and a few symbols run on different clocks. If you hard-code three payments a day and the venue switched to hourly during a blowup, your backtest will understate the cost of exactly the episode you most want to model.
- Reconcile against the mark price series you already use, so a funding timestamp always has a price to value the position against.
One quiet failure mode here is survivorship. If you only pull funding for symbols that still trade, you drop every delisted or expired perp, and those tend to be the ones that had the ugliest funding right before they died. Pull the history for symbols as they existed during the test window, not as the venue lists them today.
Applying it at the right timestamp
This is where most homegrown backtests go wrong, and the mistake is subtle. Funding is only owed if you are holding a position at the exact settlement timestamp. If you open a long a minute after the 08:00 settlement and close it a minute before the 16:00 one, you paid nothing, regardless of how long the position felt. If you hold across 16:00 by a single second, you owe the full interval. It is a snapshot at a fixed clock time, not an accrual that ticks continuously like spot margin interest.
So the accrual logic is a discrete event loop, not a smooth integral. The rule I use is straightforward:
- Walk your position ledger and your funding schedule together on the same timeline.
- At every funding timestamp, check whether a position was open at that instant. Half-open intervals matter here, so be deliberate about whether "open at 16:00:00" counts, and apply the same convention the venue does.
- If open, compute the charge as position notional times the signed funding rate, where notional is the mark price at settlement times the position size.
- Sign it by side. A long pays when the rate is positive and receives when it is negative. A short is the mirror. Getting this sign backwards is the single most common bug, and it is dangerous because it turns a cost into phantom income and makes a bad strategy look great.
- Subtract the charge from the strategy's running equity at that timestamp, not lumped in at the end, so drawdowns and any compounding reflect reality.
Notional is worth dwelling on. Funding is charged on the value of the position, which moves with the mark price, not on the capital you posted as margin. A 10x leveraged position pays funding on the full 10x notional, so leverage scales your funding bill just as directly as it scales your gains. Test a levered strategy without scaling funding to notional and you will flatter it badly.
The case that flipped
Back to the strategy that died. It was long-bias by construction, and the market regime it did best in was exactly the regime where everyone else was also long, which is precisely when funding is highest. So the strategy's best conditions and its worst funding conditions were the same conditions. Gross of funding it looked like a clean trend follower. Net of funding, the trades it held longest through the most crowded rallies bled the most, and those had been its biggest paper winners. The edge was not fake. It was just smaller than the rent on the exposure, which is a different and more honest thing to know before you size real money into it.
The fix is not to abandon long-bias strategies. It is to test them against their real cost and see what survives. Sometimes the answer is that you need to fade extreme funding rather than pay it. Sometimes it is that shorter holds keep you out of enough settlements to stay net positive. You cannot reason about any of that until funding is a first-class input in the backtest instead of an afterthought.
A short checklist before you trust a perp result
Whenever I look at a perp backtest now, mine or someone else's, I run the same quick sanity pass.
- Is realized funding in the model at all, and is it the per-venue realized rate rather than a predicted or averaged one.
- Is the sign convention verified against the venue, so longs actually pay in the crowded case.
- Is funding charged on mark notional and scaled by leverage, not on posted margin.
- Are half-open intervals handled deliberately, so holding across a settlement by a second costs a full interval and not zero.
- Does the symbol universe include perps that delisted during the window, so you are not filtering out the worst funding episodes.
None of this is exotic. It is a couple of extra columns in your data pipeline and one event loop that runs alongside your fills. When I build backtests on Blockcircle I treat funding as part of the cost model from the start, the same way you would never leave out fees or slippage, because a perp result that ignores it is not conservative or optimistic, it is just wrong. The honest version of the question is not whether your strategy makes money, it is whether it makes money after paying rent on the exposure, and that is the only version worth running real size against.