quantlab.portfolio.predefined.active_risk.ActiveRiskOptimizer#
- class quantlab.portfolio.predefined.active_risk.ActiveRiskOptimizer(config)[source]#
Bases:
MeanVarianceOptimizerMean-variance weights that price active risk against a benchmark.
See the module docstring for the problem solved.
- Parameters:
- configActiveRiskConfig
MeanVarianceConfig’s fields, thebenchmarkfactor, itsbenchmark_weightoutput and the optionaltracking_error.
- Raises:
- ValueError
If
benchmarkis missing or lacksbenchmark_weight, ortracking_erroris not positive; and asMeanVarianceOptimizer.
Examples
With
use4a builtUse4RiskModelandindex_weighta factor with the outputbenchmark_weight:from quantlab.portfolio.config import ( ActiveRiskConfig, FactorRiskStoreEstimatorConfig, GrinoldExpectedReturnConfig, ) from quantlab.portfolio.predefined.expected_return import GrinoldExpectedReturn from quantlab.portfolio.predefined.factor_risk import FactorRiskStoreEstimator rule = ActiveRiskOptimizer(ActiveRiskConfig( expected_return_label="ret_5", covariance=FactorRiskStoreEstimator(FactorRiskStoreEstimatorConfig(risk_model=use4)), expected_return=GrinoldExpectedReturn(GrinoldExpectedReturnConfig(ic=0.02)), risk_aversion=10.0, weight_cap=0.05, benchmark=index_weight, tracking_error=0.02, ))
- axis_factors()[source]#
The benchmark’s weights: its symbols without a prediction are in the reference book.
Examples
>>> rule.axis_factors() == (rule.config.benchmark_weight,) True
- config_cls#
alias of
ActiveRiskConfig
- declared_inputs()[source]#
The optimiser’s declaration, and the benchmark among the factors.
Examples
>>> rule.declared_inputs().factors[-1] is rule.config.benchmark True