GithubHelp home page GithubHelp logo

chaitjo / markowitz-portfolio-optimization Goto Github PK

View Code? Open in Web Editor NEW
73.0 7.0 24.0 545 KB

Markowitz portfolio optimization on synthetic and real stocks

Home Page: https://www.chaitjo.com/archived/markowitz-portfolio-optimization/

License: MIT License

Python 100.00%
convex-optimization portfolio-optimization stock-market python cvxpy markowitz financial-engineering

markowitz-portfolio-optimization's Introduction

Markowitz Portfolio Optimization

Modern portfolio theory was pioneered by Harry Markowitz in 1952 and led to him being awarded the Nobel Prize in Economics in 1990. The original essay on portfolio selection has since inspired a multitude of researchers and analysts to develop theories on financial modelling and risk management. Seeking similar inspiration, I studied the classical portfolio optimization technique introduced by Markowitz and applied it to real world data.

Read the blog post here: chaitjo.github.io/markowitz or refer to the technical report for details.

markowitz-portfolio-optimization's People

Contributors

chaitjo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

markowitz-portfolio-optimization's Issues

Issue with sign

Hi, thanks for sharing your work. I am getting the following error and I cannot figure it out if you have any ideas. I already replaced ix by loc and min_ret = Parameters(nonneg=True):


TypeError Traceback (most recent call last)
~/Documents/Python/markowitz-portfolio-optimization-original/main.py in ()
52 while date_index_iter + 20 < end_index:
53 date = index[date_index_iter]
---> 54 portfolio_alloc = MarkowitzOpt(shift_returns_mean.loc[date], shift_returns_var.loc[date], covariance.loc[date], interest_rate, min_return)
55 distribution[date.strftime('%Y-%m-%d')] = portfolio_alloc
56

~/Documents/Python/markowitz-portfolio-optimization-original/markowitz.py in MarkowitzOpt(mean, variance, covariance, interest_rate, min_return)
31 ret = mu.T* w
32 risk = quad_form(w, Sigma)
---> 33 min_ret = Parameter(nonneg=True)
34 min_ret.value = min_return
35 prob = Problem(Minimize(risk), # Restricting to long-only portfolio

/opt/anaconda3/envs/financial-analysis/lib/python3.10/site-packages/cvxpy/expressions/constants/parameter.py in init(self, shape, name, value, id, **kwargs)
59 self._value = None
60 self.delta = None
---> 61 #self.gradient = None
62 super(Parameter, self).init(shape, value, **kwargs)
63 self._is_constant = True

TypeError: Leaf.init() got an unexpected keyword argument 'sign'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.