roboluc / universal-portfolios

Collection of algorithms for online portfolio selection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

universal-portfolios

The purpose of this package is to put together different online portfolio selection algorithms and provide unified tools for their analysis. If you do not know what online portfolio is, look at Ernest Chan blog, CASTrader or a recent survey by Bin Li and Steven C. H. Hoi.

In short, the purpose of online portfolio is to choose portfolio weights in every period to maximize its final wealth. Examples of such portfolios could be Markowitz portfolio or Universal portfolio. Currently there is an active research in the are of online portfolios and even though its results are mostly theoretic, algorithms for practical use starts to appear.

Several algorithms from the literature are currently implemented, based on the available literature and my understanding. Contributions or corrections are more than welcomed.

Resources

There is an IPython notebook explaining the basic use of the library. Paul Perry followed up on this and made a comparison of all algorithms on more recent ETF datasets. Also see the most recent notebook about modern portfolio theory. There's also an interesting discussion about this on Quantopian.

The original authors of some of the algorithms recently published their own implementation on github - On-Line Portfolio Selection Toolbox in MATLAB.

If you are more into R or just looking for a good resource about Universal Portfolios, check out blog and package logopt by Marc Delvaux.

If you don't want to install the package locally, you can run both notebooks with Binder - modern-portfolio-theory.ipynb Binder or On-line portfolios.ipynb Binder

Installation

pip install universal-portfolios

Development

It uses poetry to manage dependencies. Run poetry install to install virtual environment and then poetry shell to launch it.

Exporting dependencies to requirements.txt file is done via

poetry export --without-hashes -f requirements.txt > requirements.txt
poetry export --dev --without-hashes -f requirements.txt > test-requirements.txt

this is needed for mybinder.org.

Publishing to PyPi

poetry publish --build

Tests

poetry run python -m pytest --capture=no --ff -x tests/

About

Collection of algorithms for online portfolio selection

License:Other


Languages

Language:Jupyter Notebook 99.1%Language:Python 0.9%