Dr. Yves J. Hilpisch
The Python Quants GmbH
http://tpq.io | training@tpq.io
mvportfolio
is a simple Python package to analyze and manage investment portfolios according to the Mean-Variance Portfolio (MVP) theory.
Open a terminal an execute
git clone http://github.com/yhilpisch/mvportfolio
cd mvportfolio
python setup.py install
Open a terminal and execute
pip install git+https://github.com/yhilpisch/mvportfolio.git
Open a terminal and execute
pip install --index-url https://test.pypi.org/simple/ mvportfolio
Some imports first.
from pylab import plt
import mvportfolio as mvp
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.1379220899637485
p.portfolio_volatility()
0.6462235282900842
Fourth, the minimum risk portfolio weights.
opt = p.minimum_risk_portfolio()
opt['x']
array([0.93891629, 0.06108371])
© The Python Quants GmbH | MIT License.