Skip to content

Latest commit

 

History

History
75 lines (54 loc) · 3.24 KB

README.md

File metadata and controls

75 lines (54 loc) · 3.24 KB

PyPI version Apache 2.0 License PyPI download month Coverage Status

Open in GitHub Codespaces

Motivation

We stand on the shoulders of CVXPY.

We solve problems arising in portfolio construction following the ideas of Harry Markowitz. Markowitz gave diversification a mathematical home in the 1950s.

Our assumption is that we solve multiple problems of the same type in a row. The input for the $n$th problem may depend on the outcome of a previous problem, e.g. the $n-1$th. Hence, we need to respect their sequential nature and order.

We can however hope that the problems we construct are DPP compliant. The first time a DPP-compliant problem is solved, CVXPY compiles it and caches the mapping from parameters to problem data. As a result, subsequent rewritings of DPP problems can be substantially faster.

In practice, the problems are not constant in size. Assets are added or removed, factors are added or removed, and so on. We expect the user is providing the number of assets a priori. We can then construct a problem suitable for a number of assets equal or smaller than the one provided. Using this approach, we keep the number of assets fixed by setting the weights for the assets not used to zero. Hence we do not need to recompile the problem as a new asset has to be added.

Every problem has be constructed by a Builder. Here's a builder for a classic minimum variance problem. The builder inherits from the Builder and implements the abstract method build. The builder remains flexible. At this stage it is possible to add or remove constraints, Only once we trigger the build() method, we construct the problem and compile it.

For injecting values for data and parameter into the problem, we use the update method.

Installation

You can install the package via PyPI:

pip install cvxmarkowitz

Poetry

We assume you share already the love for Poetry. Once you have installed poetry you can perform

make install

to replicate the virtual environment we have defined in pyproject.toml and fixed in poetry.lock.

Support for Jupyter

you could install JupyterLab within your new virtual environment. Executing

make jupyter

installs JupyterLab in your virtual environment for the project.