Skip to content

Simple portfolio analysis and management.

License

Notifications You must be signed in to change notification settings

rtvt123/mvportfolio

 
 

Repository files navigation

mvportfolio

mvportfolio is a simplistic Python package to analyze and manage investment portfolios according to the Mean-Variance Portfolio (MVP) theory.


Installation

From Source

Open a terminal and execute

git clone http://github.com/yhilpisch/mvportfolio
cd mvportfolio
python setup.py install

Via pip

Open a terminal and execute

pip install --index-url https://test.pypi.org/simple/ mvportfolio

First Steps

Some imports first.

from pylab import plt
import mvportfolio as mvp
plt.style.use('seaborn')
%matplotlib inline

Second, an instance of the main class MVPPortfolio.

p = mvp.MVPPortfolio(['.SPX', '.VIX'], '2017-1-1', '2018-6-30')

Third, some statistics for the equal weights portfolio.

p.weights
[0.5, 0.5]
p.portfolio_return()
0.13792208996374847
p.portfolio_volatility()
0.6462235282900843

Fourth, the minimum risk portfolio weights.

opt = p.minimum_risk_portfolio()
opt['x']
array([0.93891629, 0.06108371])

Fifth, visualization of the data.

p.data.plot(figsize=(10, 6), secondary_y='.VIX');

png

p.returns.plot.hist(figsize=(10, 6), bins=50, subplots=True);

png

Copyright & License

© The Python Quants GmbH | MIT License.

About

Simple portfolio analysis and management.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 87.8%
  • Batchfile 6.2%
  • Makefile 4.6%
  • Shell 1.4%