quantlab.portfolio.config.BlackLittermanConfig#
- class quantlab.portfolio.config.BlackLittermanConfig(*, expected_return_label=None, covariance, risk_aversion, expected_return=None, 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', span=None, factor_views=(), market_views=(), market=None, market_weight='benchmark_weight', tau, omega='he_litterman', confidence=None, views_relative_to_prior=False)[source]#
Bases:
MeanVarianceConfigConfig of
BlackLittermanOptimizer:MeanVarianceConfig, the market andtau.The optimiser blends the equilibrium return of
marketwith the views (the symbol views ofexpected_return, the user’sfactor_viewsandmarket_views) by Bayes’ rule and optimises on the posterior expected return and covariance;risk_aversionis the equilibrium’sdeltatoo.covariancemust be aFactorRiskStoreEstimator.Examples
With
use4a builtUse4RiskModelandcap_weightaMembershipCapWeightover the roster’s membership:>>> cfg = BlackLittermanConfig( ... expected_return_label="ret_5", ... covariance=FactorRiskStoreEstimator(FactorRiskStoreEstimatorConfig(risk_model=use4)), ... expected_return=RawExpectedReturn(RawExpectedReturnConfig()), ... risk_aversion=10.0, weight_cap=0.05, market=cap_weight, tau=0.05, ... ) >>> cfg.market_weight, cfg.tau, cfg.omega, cfg.views_relative_to_prior ('benchmark_weight', 0.05, 'he_litterman', False)
- confidence = None#
Idzorek’s confidence
Cin(0, 1]: 1 puts the posterior on the views, near 0 leaves it at the prior. Required withomega="idzorek", refused otherwise.
- expected_return = None#
How
expected_return_label’s prediction becomes the symbol views, one per predicted candidate, over the span (a total return or an alpha,views_relative_to_prior).None: no symbol views, only the user’s.
- expected_return_label = None#
The label whose prediction gives the symbol views, with
expected_return;Nonewithout symbol views.
- factor_views = ()#
The user’s views on risk-model factors’ returns: absolute (
FactorReturnView) or one factor less another (RelativeFactorReturnView).
- market = None#
The factor giving the market portfolio’s weights, the equilibrium’s
w(MembershipCapWeightover the roster’s membership, say).
- market_views = ()#
The user’s views on the market portfolio’s return (
MarketReturnView).
- market_weight = 'benchmark_weight'#
The market factor’s output holding the weights.
- omega = 'he_litterman'#
The symbol views’ uncertainty
omega_j:"he_litterman"(tau * Sigma_jj),"idzorek"(tau * (1 - C) / C * Sigma_jj, Walters’ closed form of Idzorek’s confidenceC = confidence) or"specific"(tau * D_j, the specific variance).
- span = None#
The span in bars of the expected return and the covariance. Required without
expected_return; with it the span is the label’s, and aspanset here must equal it.
- tau#
The scale of the prior’s uncertainty: the equilibrium return’s covariance is
tautimes the risk model’s. One over the length of the window the covariance is estimated from, or 0.025 to 0.05 by convention; positive.
- views_relative_to_prior = False#
True: a symbol view is an alpha added to the symbol’s equilibrium return. False: it is the total return over the span.