https://github.com/cvxgrp/cvxmarkowitz

https://github.com/cvxgrp/cvxmarkowitz

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: cvxgrp
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 71.3 MB
Statistics
  • Stars: 26
  • Watchers: 5
  • Forks: 4
  • Open Issues: 15
  • Releases: 2
Created about 3 years ago · Last pushed about 1 year ago
Metadata Files
Readme Contributing License Code of conduct

README.md

cvxmarkowitz

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:

bash pip install cvxmarkowitz

uv

You need to install task. Starting with

bash task markowitz:install

will install uv and create the virtual environment defined in pyproject.toml and locked in uv.lock.

marimo

We install marimo on the fly within the aforementioned virtual environment. Executing

bash task markowitz:marimo

will install and start marimo.

Owner

  • Name: Stanford University Convex Optimization Group
  • Login: cvxgrp
  • Kind: organization
  • Location: Stanford, CA

GitHub Events

Total
  • Create event: 33
  • Release event: 1
  • Issues event: 9
  • Watch event: 5
  • Delete event: 23
  • Issue comment event: 24
  • Push event: 121
  • Pull request review event: 2
  • Pull request event: 56
  • Fork event: 2
Last Year
  • Create event: 33
  • Release event: 1
  • Issues event: 9
  • Watch event: 5
  • Delete event: 23
  • Issue comment event: 24
  • Push event: 121
  • Pull request review event: 2
  • Pull request event: 56
  • Fork event: 2

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 61
  • Total pull requests: 151
  • Average time to close issues: 3 days
  • Average time to close pull requests: about 21 hours
  • Total issue authors: 4
  • Total pull request authors: 5
  • Average comments per issue: 1.38
  • Average comments per pull request: 0.7
  • Merged pull requests: 138
  • Bot issues: 0
  • Bot pull requests: 70
Past Year
  • Issues: 5
  • Pull requests: 53
  • Average time to close issues: 29 minutes
  • Average time to close pull requests: about 17 hours
  • Issue authors: 1
  • Pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.75
  • Merged pull requests: 46
  • Bot issues: 0
  • Bot pull requests: 30
Top Authors
Issue Authors
  • tschm (54)
  • dependabot[bot] (2)
  • phschiele (2)
  • sunilshah (1)
Pull Request Authors
  • dependabot[bot] (136)
  • tschm (87)
  • pre-commit-ci[bot] (6)
  • phschiele (3)
  • kasperjo (1)
Top Labels
Issue Labels
dependencies (2) python (2)
Pull Request Labels
dependencies (136) python (116) github_actions (7)

Dependencies

.github/workflows/basic.yml actions
  • actions/checkout v3 composite
  • cvxgrp/.github/actions/test main composite
  • pre-commit/action v3.0.0 composite
.github/workflows/book.yml actions
  • JamesIves/github-pages-deploy-action v4.2.2 composite
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • cvxgrp/.github/actions/jupyter main composite
  • cvxgrp/.github/actions/sphinx main composite
  • cvxgrp/.github/actions/test main composite
.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • cvxgrp/.github/actions/test main composite
.github/workflows/release.yml actions
  • actions/checkout v3 composite
  • cvxgrp/.github/actions/release main composite
poetry.lock pypi
  • 191 dependencies
pyproject.toml pypi
  • black ^23.1.0 develop
  • clarabel ^0.5.1 develop
  • cvxpyanalyzer * develop
  • cvxsimulator * develop
  • jupyter-book 0.15.1 develop
  • jupyterlab * develop
  • loguru * develop
  • mock * develop
  • mosek * develop
  • pandas * develop
  • plotly * develop
  • pre-commit * develop
  • pylint * develop
  • pytest 7.2.0 develop
  • pytest-cov 4.0.0 develop
  • ruff ^0.0.275 develop
  • scikit-learn * develop
  • yfinance * develop
  • click *
  • cvxpy *
  • numpyencoder *
  • python >=3.8,<4.0
  • requests *
.devcontainer/Dockerfile docker
  • mcr.microsoft.com/devcontainers/python 1-3.9-bookworm build