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: MeanVarianceConfig

Config of BlackLittermanOptimizer: MeanVarianceConfig, the market and tau.

The optimiser blends the equilibrium return of market with the views (the symbol views of expected_return, the user’s factor_views and market_views) by Bayes’ rule and optimises on the posterior expected return and covariance; risk_aversion is the equilibrium’s delta too. covariance must be a FactorRiskStoreEstimator.

Examples

With use4 a built Use4RiskModel and cap_weight a MembershipCapWeight over 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 C in (0, 1]: 1 puts the posterior on the views, near 0 leaves it at the prior. Required with omega="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; None without 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 (MembershipCapWeight over 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 confidence C = 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 a span set here must equal it.

tau#

The scale of the prior’s uncertainty: the equilibrium return’s covariance is tau times 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.