Member-only story

Automating Portfolio Optimization and Allocation using Python

Compute optimized asset weights and allocation for your portfolio using the modern portfolio theory in Python

Sanket Karve
Towards Data Science
6 min readJun 7, 2020

--

Photo by Nick Chong on Unsplash

Modern Portfolio Theory — (MPT)

Modern Portfolio Theory (MPT) or mean-variance analysis is a mathematical model/study for developing and creating a portfolio which aims to maximize the return for a given amount of risk. The math is largely based on the assumption and experience that an average human prefers a less risky portfolio. The risk mitigation can be done by either investing in traditional safe havens or by diversification — a cause championed by the MPT.

The theory was introduced by Henry Markowitz in the 1950s, for which he was awarded the Nobel prize. While the MPT has had its fair share of criticisms, partly due to its backward looking tendencies and inabilities to factor in force majeures/trends in business and economy, I find the tool valuable to gauge the risk of one’s portfolio holdings by measuring the volatility as a proxy.

Basics of the Model

I will be using Python to automate the optimization of the portfolio. The concepts of the theory are mentioned below in brief:-

--

--

Towards Data Science
Towards Data Science

Published in Towards Data Science

Your home for data science and AI. The world’s leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.

Sanket Karve
Sanket Karve

Written by Sanket Karve

Investment Analyst, Trader, Programmer

Responses (7)