markowitz.backtest.strategies¶
markowitz.backtest.strategies
¶
Portfolio strategies for use inside :class:WalkForward.
Each strategy implements the :class:Strategy protocol: given an in-sample
window of asset returns it produces a weight vector (numpy array) summing
to one. Strategies are kept dependency-light so the backtest layer remains
usable even when the convex-optimization extras are not installed.
GMVSample
¶
Global Minimum Variance with the sample covariance, closed form.
MaxSharpeNaive
¶
Tangency portfolio with sample mean and sample covariance.
Falls back to :func:markowitz.optimizer.MeanVariance when available,
otherwise uses the closed-form Sigma^{-1} (mu - rf) solution.
OneOverN
¶
Equal-weight benchmark of DeMiguel, Garlappi, Uppal (2009).
RiskParity(*, max_iter: int = 500, tol: float = 1e-08)
¶
Equal-risk-contribution portfolio via cyclical coordinate descent.
Solves the Spinu (2013) / Griveau-Billion-Richard-Roncalli (2013)
convex programme min_x 0.5 x'Sigma x - sum_i b_i log(x_i) with
b_i = 1/n (equal risk targets), then renormalizes to sum to one.
Source code in src/markowitz/backtest/strategies.py
Strategy
¶
Bases: Protocol
Static portfolio-construction protocol used by :class:WalkForward.