Skip to content

franklinjtan/Portfolio-Diversification-Correlation-Risk-Management-with-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Portfolio Diversification: Correlation Risk Management with Python

  • Understanding the importance of diversification and a portfolio of uncorrelated returns, I plotted the 5-year returns of several equities, ETFs, and commodities against SPY.
  • I also used linear regression to calculate the beta and correlation, and generated a correlation matrix and a heatmap.

Procedure

  • Imported 5-Year adjusted closing prices of my stock investments using Yahoo Finance
  • Extracted percent change using NumPy
  • Used linear regression to calculate slope (beta) and correlation
  • Plotted % returns and linear regression line
  • Created a correlation matrix and heatmap

Screenshot of Maxtrix and heatmap Generated

Correlation Matrix Heatmap of Portfolio

Inspiration

Libraries Used