liveBook · Manning

Black–Litterman model

As explained in Build a Robo-Advisor with Python (From Scratch)

The Black–Litterman model is an asset-allocation framework that combines market-implied equilibrium returns with investor views to produce adjusted return estimates and portfolio weights.

The Black–Litterman model is an asset-allocation framework for reducing the sensitivity of mean-variance optimization to expected-return inputs. It begins with equilibrium returns implied by a reference portfolio, then blends them with investor views to produce posterior expected returns and covariance estimates for portfolio optimization. section 12.0 section 12.5

Equilibrium returns are the expected returns that would make the reference portfolio optimal in mean-variance optimization: μ = λΣp. Here, p is the reference weights, Σ is asset-return covariance, and λ reflects risk aversion; any vector proportional to Σp is sufficient. The reference can be the market portfolio, but may instead use float-adjusted market-cap weights, a subset of investors, or risk-parity weights. section 12.1 section 12.1.2

Treat both equilibrium returns and views as uncertain. Expected-return uncertainty is represented by C, often set to τΣ; views take the linear form AR = b and carry view-error covariance Ω. A view can state a single asset return, a return spread between assets, or the relative performance of two portfolios. Higher uncertainty in a view gives it less influence on the posterior. section 12.3.1 section 12.3.2 section 12.3.4

Under normality assumptions, Bayesian updating combines the equilibrium prior with the views. The posterior mean weights the prior mean μ and view targets b by their respective uncertainties; the posterior covariance incorporates return covariance plus remaining uncertainty about expected returns. Use these posterior quantities in the usual constrained optimization problem rather than treating views as certain forecasts. section 12.3.3 section 12.5

Listing 12.1 Posterior mean and covariance
import numpy as np
import pandas as pd 

def compute_posterior_mean(mu, C, A, b, omega):
    c_inv = np.linalg.inv(C)
    a_t_oinv = A.T @ np.linalg.inv(omega)  #1

    er = np.linalg.inv(c_inv + a_t_oinv @ A) @ (c_inv @ mu + a_t_oinv @ b)

    return pd.Series(er, index=mu.index)

def compute_posterior_cov(sigma, C, A, omega):
    return sigma + np.linalg.inv((np.linalg.inv(C) + A.T @ omega @ A))    

Two NumPy and pandas functions calculate a general posterior mean and covariance from μ, C, A, b, and Ω; the implementation does not require C = τΣ or diagonal Ω. section 12.3.3

Sector views and portfolio tilts

For US sector ETFs, construct a view that defensive sectors outperform cyclical sectors by 1% and that real estate returns 2%. Compute posterior estimates with τ = 0.05 and optimize subject to market-level volatility, full investment, and long-only constraints. With low view uncertainty, the resulting allocation concentrates in health care and information technology; as Ω grows, it converges toward market weights. section 12.4.1 section 12.4.1

Global allocation with cryptocurrency

A global portfolio combines US, developed ex-US, and emerging equities, US bonds, Bitcoin, and Ethereum. Weekly prices avoid mismatched crypto weekend observations; bullish 10% Bitcoin and 15% Ethereum views, each with 5% standard deviation, raise their posterior returns and modestly increase optimized crypto weights while retaining a bond-heavy allocation. section 12.4.2 section 12.4.2

How Build a Robo-Advisor with Python (From Scratch) covers it

How deep it goes
Derives equilibrium and posterior quantities, implements general Python functions, and applies constrained optimizations; defers the Bayesian derivation.
Examples
Uses US sector ETFs with defensive-versus-cyclical views and a global allocation containing Bitcoin and Ethereum.
What it assumes
Assumes familiarity with expected returns, covariance matrices, and mean-variance optimization while introducing Bayesian view updating.
What you can do after
Apply it via NumPy, pandas, yfinance, and cvxpy to turn reference weights and uncertain views into optimized allocations.
How it connects
Connects mean-variance optimization, equilibrium returns, Bayesian updating, covariance matrices, risk parity, and market portfolios.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Robo-Advisor with Python (From Scratch). The section links point to the parts of the book it draws on.