SkillAgentSearch skills...

MarkowitzPortfolioOptimization

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

Install / Use

/learn @rshemet/MarkowitzPortfolioOptimization
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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

Related Skills

View on GitHub
GitHub Stars49
CategoryDevelopment
Updated10mo ago
Forks14

Languages

Python

Security Score

67/100

Audited on Jun 7, 2025

No findings