Backtesting & results
Margin, liquidation, and funding
How a leveraged backtest is judged like a Binance futures account — when a position is liquidated, what the "approximate" notice means, and how perpetual funding shows up in your result.
Updated 2026-09-19·Rev. 2026.09
Spera judges a leveraged backtest the way Binance judges a USDⓈ-M futures account. Two exchange rules apply to every run and can't be switched off: liquidation when you trade on leverage, and funding on futures pairs. If a result changed, or a trade in the log says Liquidated, this page explains why.
Why a re-run can differ from an older result
Older runs were scored without funding, and without Binance's maintenance-margin tiers. Re-running the same strategy applies both. A long held through a stretch of positive funding pays for it now, and a highly leveraged run that used to survive a deep wick may now be liquidated.
Buying power: the three margin modes
Open Backtest settings from the Builder's bottom panel. The Margin section's Buying power setting decides how a position is funded, and whether it can be liquidated.
| Buying power | How a position is funded | Can it be liquidated? |
|---|---|---|
| Cash (1×) | The full value of the position, like spot. | No. The account is fully funded. A short that loses more than the account holds closes as Bankrupt. |
| Leverage | Up to leverage × equity. Each position ties up its size ÷ leverage as initial margin. | Yes. Maintenance comes from Binance's leverage brackets for the pair. |
| Margin % | Initial margin is a percent of the position's value, set separately for longs and shorts (Margin long %, Margin short %). | Yes. Maintenance is always the approximation described below. |
There is no margin-call setting. The account model decides when a position is closed.
When a position is liquidated
Two amounts decide it:
- Margin balance: your cash plus the unrealized profit or loss of every open position.
- Maintenance margin: the minimum the exchange requires to keep a position open. It grows with the position's size, in tiers Binance publishes for each pair.
A position is liquidated when the margin balance falls to the maintenance margin. At that point Binance's margin ratio has reached 100%.
On every bar with an open position, Spera works out the price that would cause this and checks whether the bar reached it:
- Your stops go first. A stop that sits between the bar's open and the liquidation price fills at the stop, because the price got there first. A stop placed beyond the liquidation price never fills.
- The position closes at the liquidation price, or at the bar's open if the market gapped straight through it. With several positions open, the one with the largest loss goes first, then the check repeats for what's left.
- A liquidation fee is charged: a percentage of the closed position's value, capped at what's left of the account.
Liquidation is checked before the bar's take-profits and signals. An exit your strategy would have decided at the close can't save a position the bar had already liquidated.
The whole margin balance backs your positions. That means the liquidation price depends on how much of the account a position uses, not only on its leverage. A long that uses all its buying power at 10× is liquidated by a fall of a little under 10%. The same leverage on a quarter of the account can withstand a much bigger move.
Keep your stop inside the liquidation price
A stop placed beyond the liquidation price is never reached: the position is liquidated first, and it pays the fee. If the trade log shows Liquidated where you expected Stop loss, reduce the leverage or the position size, or tighten the stop.
Which price is used
| Run | Judged on |
|---|---|
| Deep backtests, comparisons, portfolio legs | Binance's mark price, the price the exchange itself liquidates on. A bar with no mark data is judged on its candle. |
| Quick backtests | The candle's last price. A wick in the last price is harsher than the mark, so a quick run can liquidate earlier than a deep run on the same window. |
Entries the account refuses
Before an entry fills, the account must be able to afford its initial margin from what's still available. Binance also limits how large a position each leverage allows. An entry that fails either check is refused rather than opened. A quick run lists refused entries in its notice with the reason, for example "…would take the position past Binance's maximum size at this leverage".
"Maintenance margin is approximate"
Spera reads each pair's leverage brackets from Binance when the run starts. If they can't be read, the run uses a simpler rule: maintenance margin is half the initial margin, at every position size. The Backtest panel raises a Maintenance margin is approximate notice when this happens.
What it means for the result:
- On Binance, large positions sit in higher tiers and carry proportionally more maintenance margin. The approximation doesn't, so a large position can survive a move in the backtest that would have liquidated it on the exchange.
- Re-run once the brackets are available to price liquidation exactly.
Margin % mode always uses the half-of-initial rule, because it doesn't follow Binance's leverage tiers.
Old windows use today's brackets
Binance doesn't publish a history of its leverage brackets, so a run over 2021 uses today's tiers. Those are usually stricter than the ones that applied then, so the result errs toward liquidating too early, not too late.
Funding
Perpetual futures have no expiry. Instead, longs and shorts pay each other a funding payment at regular settlements, usually every 8 hours and more often on some pairs. Spera charges the settlements Binance actually made, including any change of interval.
- A positive rate means longs pay shorts. A negative rate means shorts pay longs.
- The payment is the position's size × the mark price × the rate, taken from the account's cash at the settlement.
- It applies to every futures run: quick, deep, comparisons, portfolios, and paper bots. Spot pairs never pay funding. Your strategy doesn't need a funding-rate node for funding to be charged.
When a position pays
A position pays a settlement only if it's held through it. An entry placed at the close of the bar that the settlement falls on doesn't pay it. An exit placed at that close does, because the order reaches the exchange just after the settlement.
On a bar longer than the funding interval (12h, 1d, 1w…), several settlements fall inside one candle. All of them are charged on the position that was still open after that bar's stops and take-profits.
Reading funding in your result
- Funding metric. On a futures run, More metrics (and the deep-run metrics grid) includes a Funding cell. It's shown as a cash flow on the account: −$12.40 means the run's closed trades paid funding, and +$3.10 means they received it. A hedge-mode run that traded both sides splits it into long and short.
- Already inside PnL. Funding is part of each trade's profit or loss, like fees. The Funding cell isn't an extra charge on top of Total PnL. In the trade log, hover a trade's PnL to see "Includes funding…".
- Open trades have already paid funding up to the end of the run. Their unrealized PnL includes it, but the Funding metric counts closed trades only.
- The buy & hold benchmark pays funding too. It holds the same perpetual, so your strategy isn't compared against a benchmark that carries for free.
“Funding was not charged”
If a futures pair's funding history can't be loaded, the run charges nothing and says so in a notice. The result is then too flattering for any long held through positive funding. Re-run once the history is available.
Next: the risk policy, the rails you choose to put on the account.