markowitz.backtest.turnover¶
markowitz.backtest.turnover
¶
One-sided, drift-adjusted portfolio turnover.
compute_turnover(weights_new: np.ndarray, weights_prev: np.ndarray, returns_between: np.ndarray) -> float
¶
Return one-sided drift-adjusted turnover.
Let w_prev be the weights at the start of the period, r the
realized asset returns over that period and w_new the target
weights set at the rebalance date. The portfolio drifts to
w_drift = w_prev * (1 + r) / (1 + w_prev . r)
and the turnover charged on the rebalance is
TO = 0.5 * sum(|w_new - w_drift|).