quantlab.portfolio.predefined.active_risk#

Mean-variance on active risk against a benchmark: ActiveRiskOptimizer.

A portfolio construction rule built on the extension points of MeanVarianceOptimizer. The benchmark is a Factor whose output benchmark_weight holds each symbol’s weight in it at a bar (an index’s capitalization weights, such as MembershipCapWeight); the rule declares it among its factors (declared_inputs()), so a backtest computes it and an executor injects it like any other factor value. Over the candidates the rule solves

maximise w @ mu - risk_aversion / 2 * (w - b) @ Sigma @ (w - b)
  • turnover_penalty * |w - w_current|_1

subject to the optimiser’s budget, cap and exposure bounds, and, with

tracking_error, (w - b) @ Sigma @ (w - b) <= tracking_error**2

b the benchmark weights at the bar and Sigma the covariance estimator’s, over the expected-return label’s span. With a factor risk model (FactorRiskStoreEstimator) the active risk is priced in factor form; any covariance estimator works. risk_aversion 0 with a tracking_error maximises the expected return inside the cap.

The approximate backtest (quantlab.backtest.approximate) runs it too, without a tracking_error.

Classes

ActiveRiskOptimizer

Mean-variance weights that price active risk against a benchmark.