You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The engine has no way to apply periodic funding cash flows to open perpetual-futures positions. There is no funding concept in the source. The only workaround is to write broker.cash directly from strategy code (or patch broker._update_time), which bypasses accounting: the transfers do not appear in fills, trades or the equity decomposition, and they are easy to apply at the wrong time relative to marks.
Requested:
A funding input keyed by asset and timestamp (rate, or payment per unit of notional), applied to positions held at the funding time, long pays positive rate and short receives.
Funding reported as its own cash-flow series in the result, so gross P&L, costs and funding can be separated.
Clear timing: which mark the notional uses and whether a position opened at the funding timestamp pays.
A backtest of a perpetual-futures strategy without funding is wrong by the full carry, which for a funding-driven strategy is the whole return.
Verified on PR #119 at commit 8343029. The focused tests in tests/futures/test_funding.py passed locally (15 passed); the remote coverage job passed. Perpetual funding changes cash and equity and survives artifact export and recovery; the LEAN crypto pair passes in retained real-strategy evidence. Real-strategy evidence records the supported LEAN crypto comparison.
Activity
feat(funding): account for perpetual funding cash flows
stefan-jansen commentedon Sep 24, 2026
Verified on PR #119 at commit 8343029. The focused tests in tests/futures/test_funding.py passed locally (15 passed); the remote coverage job passed. Perpetual funding changes cash and equity and survives artifact export and recovery; the LEAN crypto pair passes in retained real-strategy evidence. Real-strategy evidence records the supported LEAN crypto comparison.