zhaoy99 / MarkowitzPortfolioOptimization

Computing a solution for the optimal mean-variance tradeoff (maximising Sharpe Ratio) of a portfolio according to MPT.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MarkowitzPortfolioOptimization

Computing a solution for the optimal mean-variance tradeoff (maximising Sharpe Ratio) of a portfolio according to MPT.

This repository contains code that allows you to extract the composition and performance of any exchange-traded fund and attempt to allocate its constituent assets differently, according to the mean-variance optimization framework.

Algorithms supported:

  • Unconstrained optimization
  • Constrained (sum weights = 1) optimization
  • Short-selling constrained optimization

Blog-like Description:

https://towardsdatascience.com/beating-the-etf-portfolio-optimisation-using-python-and-some-linear-algebra-e48d0e0e44f

Instructions

Data/ETF/ should have two .csv files for the benchmark fund: one with performance and one with composition
Data/Stocks/ should have all the stock files downloaded from Kaggle

Required libraries:

  • pandas
  • numpy
  • matplotlib
  • time
  • os
  • shutil
  • datetime
  • (pdb)
  • scipy

About

Computing a solution for the optimal mean-variance tradeoff (maximising Sharpe Ratio) of a portfolio according to MPT.


Languages

Language:Python 100.0%