markowitz.views.black_litterman¶
markowitz.views.black_litterman
¶
Black-Litterman posterior using the Theil mixed-estimation form.
The implementation follows He & Litterman (1999) and only ever factorises the
K x K matrix P tau Sigma P^T + Omega (not the N x N posterior
precision), which is numerically advantageous when K << N and avoids
explicit inversion of the prior covariance.
Notation
Sigma-- prior asset-return covariance (N x N).w_mkt-- market-cap weights (N).pi-- equilibrium-implied excess returns,delta * Sigma * w_mkt.P-- view pick matrix (K x N).Q-- view target vector (K).Omega-- view uncertainty (K x K, typically diagonal).tau-- prior scaling,0.05by default (He-Litterman convention).
BlackLitterman(cov: pd.DataFrame, market_weights: pd.Series, views: Views | None = None, *, tau: float = 0.05, delta: float = 2.5, omega: np.ndarray | None = None, omega_method: str = 'he_litterman', posterior_covariance_mode: str = 'full', risk_free_rate: float | None = None)
¶
Construct a Black-Litterman posterior from a covariance prior and views.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cov
|
DataFrame
|
Prior covariance matrix as a labelled |
required |
market_weights
|
Series
|
Market-cap weights series aligned to the covariance index. |
required |
views
|
Views | None
|
:class: |
None
|
tau
|
float
|
Prior-scaling parameter. Must be strictly positive. Defaults to
|
0.05
|
delta
|
float
|
Representative-investor risk-aversion coefficient. Defaults to
|
2.5
|
omega
|
ndarray | None
|
Optional pre-computed view-uncertainty matrix; if supplied,
|
None
|
omega_method
|
str
|
Strategy used to derive |
'he_litterman'
|
posterior_covariance_mode
|
str
|
|
'full'
|
risk_free_rate
|
float | None
|
Optional metadata used by :meth: |
None
|
Source code in src/markowitz/views/black_litterman.py
implied_returns() -> pd.Series
¶
Return the equilibrium-implied prior pi = delta * Sigma * w_mkt.
Source code in src/markowitz/views/black_litterman.py
posterior_covariance() -> pd.DataFrame
¶
Return the posterior covariance matrix.
Source code in src/markowitz/views/black_litterman.py
posterior_returns() -> pd.Series
¶
Return the Black-Litterman posterior excess-return vector.
posterior_weights(*, constrained: bool = False) -> pd.Series
¶
Return the unconstrained tangency weights implied by the posterior.
w_BL = (delta * Sigma_BL)^{-1} * mu_BL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
constrained
|
bool
|
If |
False
|
Source code in src/markowitz/views/black_litterman.py
summary() -> pd.DataFrame
¶
Return a per-asset table with prior, posterior and weight tilts.