Modern Portfolio Theory-Effect of Diversification on the Optimal Portfolio-Portfolio Management in Python

Subscribe to newsletter

In the previous installments, we presented the concept of Modern Portfolio Theory. We also provided an optimization algorithm, written in Python, for searching for the optimal portfolio.

To continue, we are going to perform some numerical experiments. Specifically, we are going to use the portfolio optimization program developed in the previous post in order to study the effect of diversification.

In finance, diversification is the process of allocating capital in a way that reduces the exposure to any one particular asset or risk. A common path towards diversification is to reduce risk or volatility by investing in a variety of assets. If asset prices do not change in perfect synchrony, a diversified portfolio will have less variance than the weighted average variance of its constituent assets, and often less volatility than the least volatile of its constituents.

Subscribe to newsletter https://harbourfrontquant.beehiiv.com/subscribe Newsletter Covering Trading Strategies, Risk Management, Financial Derivatives, Career Perspectives, and More

… Every equally weighted, uncorrelated asset added to a portfolio can add to that portfolio’s measured diversification. When assets are not uniformly uncorrelated, a weighting approach that puts assets in proportion to their relative correlation can maximize the available diversification. Read more

It’s well-known that if we add an asset that is negatively correlated with the existing assets in the portfolio, then it will likely result in a higher risk-adjusted return, i.e. a higher Sharpe ratio. For this reason in the previous examples Gold was included as a diversifier.

In this post, we expand our 3-ETF portfolio by adding volatility-related instruments that are known to be negatively correlated with the equity market. We will use our Python program and explore whether the inclusion of a negatively correlated asset would enhance the portfolio’s risk-adjusted return.

Adding VXX ETF

We first add VXX, a volatility Exchange Traded Fund, to the portfolio and run the Python program. The picture below shows the optimal portfolio’s composition and the Sharpe ratio.

portfolio management in python

It’s interesting to note that the program determined the weight of VXX to be zero, and consequently the Sharpe ratio is unchanged. This is probably because the return of VXX is too negative (-66% per annum) so there is no benefit of adding it to the portfolio. Also, the volatility of VXX is high, and adding a volatile asset to a portfolio is not diversification.

Adding spot VIX

We next add spot VIX to the portfolio. Note that spot VIX is not a tradable asset. We do this exercise merely for the sake of numerical experimentation.

portfolio optimization in python

The figure below shows the optimal portfolio’s composition and the Sharpe ratio.  This time we obtained indeed a higher Sharpe ratio (an increase from 1.17 to 1.45). It’s interesting to note that Gold is now eliminated from the portfolio.

portfolio diversification in python

In summary, this post is an exploration of how to use the optimization algorithm to study the effect of diversification. Readers are encouraged to experiment with other asset classes.

Last and not least, do not forget the assumptions of the Modern Portfolio Theory.

To download the accompanying Excel workbook or Python program for this post:
1. Subscribe to the newsletter. If you're already a subscriber, go to the next step
2. Once subscribed, refer a friend
After completing these steps, you’ll gain access to the file for this post, along with files for a dozen other posts.

Subscribe to newsletter https://harbourfrontquant.beehiiv.com/subscribe Newsletter Covering Trading Strategies, Risk Management, Financial Derivatives, Career Perspectives, and More

Further questions

What's your question? Ask it in the discussion forum

Have an answer to the questions below? Post it here or in the forum

LATEST NEWSNorth Star Network acquires leading casino affiliate Bojoko
North Star Network acquires leading casino affiliate Bojoko

NAXXAR, Malta, Feb. 18, 2025 (GLOBE NEWSWIRE) — North Star Network and Bojoko are delighted to announce the digital sports media group’s acquisition of the leading iGaming affiliation as NSN looks to take a decisive step into the casino space. The deal, which includes all…

Stay up-to-date with the latest news - click here
LATEST NEWSBOE’s Bailey Says Trump Tariffs Cause Unwelcome Bond Volatility
BOE’s Bailey Says Trump Tariffs Cause Unwelcome Bond Volatility

Bank of England Governor Andrew Bailey said he’d like to see less volatility in bond markets, much of which he puts down to a flurry of announcements around US tariffs.

Stay up-to-date with the latest news - click here
LATEST NEWSMedtronic earnings beat by $0.03, revenue fell short of estimates
Medtronic earnings beat by $0.03, revenue fell short of estimates
Stay up-to-date with the latest news - click here
LATEST NEWSUgoWork to showcase cutting-edge lithium-ion solutions and industry insights at ProMat 2025
UgoWork to showcase cutting-edge lithium-ion solutions and industry insights at ProMat 2025

Driving efficiency and cost savings in material handling QUEBEC, Feb. 18, 2025 (GLOBE NEWSWIRE) — UgoWork™, a leading provider of lithium-ion energy solutions for the material handling industry, is set to make an impact at ProMat 2025, March 17-20 at McCormick Place, Chicago, IL. Visit…

Stay up-to-date with the latest news - click here
LATEST NEWSAmerican Lamprecht Enhances Visibility for Air and Ocean Shipments Using Descartes Solution
American Lamprecht Enhances Visibility for Air and Ocean Shipments Using Descartes Solution

ATLANTA, Georgia and AMERSFOORT, The Netherlands, Feb. 18, 2025 (GLOBE NEWSWIRE) — Descartes Systems Group (Nasdaq:DSGX) (TSX:DSG), the global leader in uniting logistics-intensive businesses in commerce, announced that Illinois-based freight forwarder American Lamprecht is providing its customers with real-time visibility into the location and status…

Stay up-to-date with the latest news - click here

Leave a Reply