The Black-Litterman Model: A smart integration of our market view

In partnership with

`

Invest in the Next Digital Frontier

DeFi Technologies Inc. (CAD: DEFI & US: DEFTF) is revolutionizing access to the digital economy. With a strong financial performance and Nasdaq ambitions, DeFi offers regulated pathways into DeFi, Bitcoin, and Web3 investments. Discover why DeFi is a leader in the future of finance.

Exciting News: Paid Subscriptions Have Launched! 🚀

On September 1, we officially rolled out our new paid subscription plans at GuruFinance Insights, offering you the chance to take your investing journey to the next level! Whether you're just starting or are a seasoned trader, these plans are packed with exclusive trading strategies, in-depth research paper analysis, ad-free content, monthly AMAsessions, coding tutorials for automating trading strategies, and much more.

Our three tailored plans—Starter Investor, Pro Trader, and Elite Investor—provide a range of valuable tools and personalized support to suit different needs and goals. Don’t miss this opportunity to get real-time trade alerts, access to masterclasses, one-on-one strategy consultations, and be part of our private community group. Click here to explore the plans and see how becoming a premium member can elevate your investment strategy!

The Black-Litterman model stands as one of the most sophisticated approaches to portfolio optimization, combining market equilibrium with investor insights. Developed by Fischer Black and Robert Litterman at Goldman Sachs in 1990, this model addresses critical limitations of traditional portfolio optimization methods while providing a more robust framework for investment decisions.

The Theoretical Foundation:

Market Equilibrium as a Starting Point

The model begins with a crucial assumption: the market portfolio represents an equilibrium state. This equilibrium serves as a neutral starting point, derived from the Capital Asset Pricing Model (CAPM). The mathematical representation of the expected return in the Black-Litterman model is:

E(R) = [(τΣ)^(-1) + P^T Ω^(-1)P]^(-1) × [(τΣ)^(-1)Π + P^T Ω^(-1)Q]

Where:

  • Ď„ represents uncertainty in CAPM distribution

  • ÎŁ is the covariance matrix of returns

  • P represents the matrix of investor views

  • Ω is the confidence in views

  • Π represents implied equilibrium returns

  • Q represents expected returns from views

The Fastest Way to Get Foreign Currency In Hand

Last-minute travel plans? Forgot to order currency? No problem! With Currency Exchange International, you can get your foreign currency delivered quickly from the same provider banks use. Order online today for home delivery and be ready for your trip in no time!

Incorporating Investor Views

The model’s unique feature is its ability to incorporate investor views while maintaining mathematical rigor. These views can be:

  • Absolute: “Asset A will return 10%”

  • Relative: “Asset A will outperform Asset B by 3%”

Mathematical Implementation:

Let’s examine how this works in practice using the provided Python code example.

We will first need to download the python packages, you can install the pypfopt library using the following command (note that the package is not yet compatible with python 3.13)

Set up and Imports

pip install PyPortfolioOpt
import pandas as pd
import yfinance as yf

from pypfopt import expected_returns, risk_models, black_litterman
from pypfopt.black_litterman import BlackLittermanModel
from pypfopt.efficient_frontier import EfficientFrontier

import warnings
warnings.filterwarnings("ignore")

Then we continue by downloading the historical stock price data for a set of companies. We use Yahoo Finance to get the data.

Downloading the Data

mag_7 = [
    "AAPL",
    "AMZN",
    "NVDA",
    "TLSA",
    "GOOGL",
    "META",
    "MSFT",
]

prices = yf.download(mag_7, start="2018-01-01")["Adj Close"]

We define a list of major tech companies, often referred to as the “Magnificent 7”. We then use the yfinance library to download the adjusted closing price of these stocks starting from January 1, 2018. This data will be used to calculate returns and risks for our portfolio optimization.

Next, we define our own views on the expected returns for each stock and gather market capitalization data.

Define our View

views = {
    "AAPL": 0.10, 
    "AMZN": 0.20,  
    "NVDA": 0.30,  
    "TLSA": 0.50, 
    "GOOGL": -0.10,  
    "META": 0.10,  
    "MSFT": 0.15   
}

mcaps = {
    "AAPL": 2.5e12,
    "AMZN": 1.3e12,
    "NVDA": 1.0e12,
    "TLSA": 0.9e12,
    "GOOGL": 1.4e12,
    "META": 0.7e12,
    "MSFT": 2.0e12,
}

We define our views on the expected returns for each stock. These views represent our subjective beliefs about the future performance of these companies. For example, we expect Apple’s return to be 10% and Amazon’s to be 20%.

Additionally, we provide the market capitalizations of each company, which reflect their total market value. This information will be used in the Black-Litterman model to incorporate market views.

Compute the Market’s Variables

We calculate historical expected returns and the covariance matrix to assess the risk and return of our portfolio.

expected_returns_mean = expected_returns.mean_historical_return(prices)
cov_matrix = risk_models.sample_cov(prices)
delta = black_litterman.market_implied_risk_aversion(prices)
market_prior = black_litterman.market_implied_prior_returns(mcaps, delta, cov_matrix)

We compute the historical expected returns for each company using the mean of their historical returns. The covariance matrix measures how the returns of the stocks move together, providing insight into the portfolio’s risk.

We also calculate the market’s implied risk aversion, which reflects the market’s overall attitude towards risk. With the market capitalizations and risk aversion, we estimate the market’s prior expected returns, which serve as a baseline before incorporating our views.

Create a Black-Litterman model and optimize the portfolio

We create a Black-Litterman model using our views and optimize the portfolio to maximize the Sharpe ratio.

bl = BlackLittermanModel(
    cov_matrix,
    absolute_views=views,
    pi=market_prior
)

bl_returns = bl.bl_returns()
ef = EfficientFrontier(bl_returns, cov_matrix)
weights = ef.max_sharpe()

bl_weights = pd.DataFrame(
    list(weights.items()), 
    columns=["symbol", "weight"]
).set_index("symbol")

performance = ef.portfolio_performance(verbose=True)

We create a Black-Litterman model using the covariance matrix, our views on expected returns, and the market’s prior returns. This model adjusts the market’s baseline expectations with our views, resulting in a set of expected returns that reflect both market data and personal insights.

We then use these adjusted returns to construct an efficient frontier, which shows the best possible returns for a given level of risk.

We optimize the portfolio to achieve the maximum Sharpe ratio, which balances risk and return, and derive the optimal weights for each stock. The calculated performance metrics provide an overview of the portfolio’s return, volatility, and risk-adjusted return.

The Process:

Market Equilibrium Returns

First, the model calculates equilibrium returns using market capitalization weights and the CAPM framework. This provides a starting point that reflects market consensus.

View Integration

Investor views are then integrated using Bayesian statistics. The confidence in each view affects how much it influences the final portfolio weights. The model combines:

  • Market equilibrium returns (Π)

  • Investor views (Q)

  • Confidence levels (Ω)

Portfolio Optimization

The final step involves optimizing the portfolio using the adjusted expected returns:

bl = BlackLittermanModel(
    cov_matrix,
    absolute_views=views,
    pi=market_prior
)

bl_returns = bl.bl_returns()
ef = EfficientFrontier(bl_returns, cov_matrix)
weights = ef.max_sharpe()

This is the key part of the script, luckily the python package is handeling all the optimization for us.

Visualizing the Results:

You can view the changes in the allocated weights using the following code

import matplotlib.pyplot as plt

# Calculate initial market weights
market_weights = {symbol: mcaps[symbol] / sum(mcaps.values()) for symbol in mcaps}

# Convert to DataFrame for plotting
market_weights_df = pd.DataFrame.from_dict(market_weights, orient='index', columns=['Market Weight'])
bl_weights_df = bl_weights.rename(columns={'weight': 'BL Weight'})

# Combine both DataFrames
weights_df = market_weights_df.join(bl_weights_df)

# Plot the weights
weights_df.plot(kind='bar', figsize=(10, 6))
plt.title('Market Weights vs Black-Litterman Adjusted Weights')
plt.ylabel('Weight')
plt.xlabel('Asset')
plt.xticks(rotation=45)
plt.show()

Additionally, you can track how your rebalanced portfolio is performing against the market:

# Calculate cumulative returns for market weights
market_cumulative_returns = (prices.pct_change().dot(pd.Series(market_weights)) + 1).cumprod()

# Calculate cumulative returns for Black-Litterman adjusted weights
bl_cumulative_returns = (prices.pct_change().dot(bl_weights['weight']) + 1).cumprod()

# Plot the cumulative returns
plt.figure(figsize=(12, 6))
plt.plot(market_cumulative_returns, label='Market Weights')
plt.plot(bl_cumulative_returns, label='Black-Litterman Adjusted Weights')
plt.title('Cumulative Returns: Market Weights vs Black-Litterman Adjusted Weights')
plt.xlabel('Date')
plt.ylabel('Cumulative Return')
plt.legend()
plt.show()

Practical Applications:

Risk Management

The Black-Litterman model helps manage risk by:

  • Avoiding extreme allocations

  • Incorporating uncertainty in views

  • Maintaining diversification principles

Portfolio Rebalancing

The model provides a systematic approach to portfolio rebalancing by:

  • Starting from market equilibrium

  • Adjusting based on new views

  • Maintaining stability in allocations

Institutional Implementation

Professional investors use the model to:

  • Incorporate research insights

  • Manage large portfolios

  • Balance multiple investment objectives

Advantages Over Traditional Methods:

  1. Stability: The model produces more stable portfolios compared to traditional mean-variance optimization.

  2. Flexibility: Investors can express views on any subset of assets, not requiring views on all assets.

  3. Intuitive Results: The portfolios tend to be more diversified and aligned with practical investment constraints.

Conclusion:

The Black-Litterman model represents a significant advancement in portfolio optimization theory. By combining market equilibrium with investor views in a mathematically rigorous framework, it provides a practical tool for portfolio managers. The model’s ability to handle uncertainty and incorporate varying levels of confidence in different views makes it particularly valuable in real-world applications.

While the mathematical complexity might seem daunting, the fundamental principle is straightforward: start with market equilibrium and adjust based on your views, while considering the uncertainty in those views. This approach leads to more robust and intuitive portfolio allocations, making it a valuable tool for modern portfolio management.

This article provides both theoretical understanding and practical implementation of the Black-Litterman model, demonstrating its value in portfolio diversification strategies.