Rebalancing & delayΒΆ

Composable, strictly causal (T, N) transforms between an allocator/signal and backtest: the effective book drifts with asset returns and trading is throttled on a calendar (rebalance_calendar), inside a no-trade band (rebalance_band) or under a per-bar turnover budget (rebalance_turnover_cap), plus whole-lot discretization (discretize) and an execution delay (delay).

rebalance_calendar(W, X[, every])

Rebalance to target weights on a fixed calendar, drift between.

rebalance_band(W, X[, band, mode])

Rebalance only when the drift leaves a no-trade band around the target.

rebalance_turnover_cap(W, X[, budget])

Move toward the target each bar under a per-bar turnover budget.

discretize(W, prices[, capital, lot, ...])

Round a target weight book to whole lots on a fixed capital base.

delay(W[, steps])

Shift a weight book forward by a fixed number of bars.