Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 1.34 KB

File metadata and controls

23 lines (14 loc) · 1.34 KB

Portfolio-optimization-with-Python-and-Interactive-Visualization

Python code to select a portfolio of stock (data directly grab from Yahoo Finance) and find the composition who optimizes both expected return and volatility Library to use :

-numpy -pandas -matplotlib.pyplot -pandas_datareader -scipy.stats -yfinance

For this code we will use the Modern Portfolio Theory based on H.Markowitz hypothesis (1952). For simplify the calculation we will use this formula of the Sharpe ratio : where we supposed that risk free rate equal to 0 : image

Interactive visualization : image

Correlation Matrix : image

At the end we will have a plot of the x combinaisons calculated by Python with the optimal portfolio :

image

image

image