quantlab.portfolio.config.ActiveRiskConfig#

class quantlab.portfolio.config.ActiveRiskConfig(*, expected_return_label, covariance, risk_aversion, expected_return, turnover_penalty=0.0, min_trade=0.0, weight_cap=1.0, direction='long_only', candidate_top_k=None, max_names=None, mip_gap=None, volatility_label=None, exposure_factors=(), exposure_bounds=<factory>, solver='CLARABEL', benchmark=None, benchmark_weight='benchmark_weight', tracking_error=None)[source]#

Bases: MeanVarianceConfig

Config of ActiveRiskOptimizer: MeanVarianceConfig and the benchmark risk is measured against.

The optimiser prices the active risk (w - b) @ Sigma @ (w - b), b the benchmark’s weights at the bar, and caps it with tracking_error when that is set.

Examples

With index_weight a factor whose output benchmark_weight holds an index’s weights (MembershipCapWeight, say):

>>> cfg = ActiveRiskConfig(
...     expected_return_label="ret_5",
...     covariance=LedoitWolfEstimator(LedoitWolfEstimatorConfig(lookback_bars=252)),
...     expected_return=GrinoldExpectedReturn(GrinoldExpectedReturnConfig(ic=0.05)),
...     risk_aversion=10.0, weight_cap=0.05,
...     benchmark=index_weight, tracking_error=0.02,
... )
>>> cfg.benchmark_weight, cfg.tracking_error
('benchmark_weight', 0.02)
benchmark = None#

The factor giving the benchmark’s weights.

benchmark_weight = 'benchmark_weight'#

The benchmark factor’s output holding the weights.

tracking_error = None#

Cap on the forecast active volatility over the expected-return label’s span; None for none.