precise

World beating online covariance and portfolio construction.

https://github.com/microprediction/precise

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
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.3%) to scientific vocabulary

Keywords

covariance-estimation covariance-matrix investment-portfolio portfolio
Last synced: 10 months ago · JSON representation

Repository

World beating online covariance and portfolio construction.

Basic Info
  • Host: GitHub
  • Owner: microprediction
  • License: other
  • Language: Jupyter Notebook
  • Default Branch: main
  • Homepage:
  • Size: 13.7 MB
Statistics
  • Stars: 307
  • Watchers: 10
  • Forks: 52
  • Open Issues: 26
  • Releases: 70
Topics
covariance-estimation covariance-matrix investment-portfolio portfolio
Created over 4 years ago · Last pushed 11 months ago
Metadata Files
Readme License

README.md

precise docs tests tests_312 tests-sans-ppo License: MIT

Contents:

  1. A collection of online (incremental) covariance forecasting and portfolio construction functions. See docs.

  2. "Schur Complementary" portfolio construction, a new approach that leans on connection between top-down (hierarchical) and bottom-up (optimization) portfolio construction revealed by block matrix inversion. See my posts on the methodology and its role in the hijacking of the M6 contest.

  3. A small compendium of portfolio theory papers tilted towards my interests. See literature.

One observes that tools for portfolio construction might also be useful in optimizing a portfolio of models.

NEW: Some slides for the CQF talk.



Usage

See the docs but briefly ...

Covariance estimation

Here y is a vector:

from precise.skaters.covariance.ewapm import ewa_pm_emp_scov_r005_n100 as f 
s = {}
for y in ys:
    x, x_cov, s = f(s=s, y=y)

This package contains lots of different "f"s. There is a LISTINGOFCOV_SKATERS with links to the code. See the covariance documentation.

Portfolio weights

Here y is a vector:

    from precise.skaters.managers.schurmanagers import schur_weak_pm_t0_d0_r025_n50_g100_long_manager as mgr
    s = {}
    for y in ys:
        w, s = mgr(s=s, y=y)

This package contains lots of "mgr"'s. There is a LISTINGOFMANAGERS with links to respective code. See the manager documentation.

Install

Supported for Python 3.11 or earlier

pip install precise 

or for latest:

pip install git+https://github.com/microprediction/precise.git

Trouble? It probably isn't with precise per se.

pip install --upgrade pip
pip install --upgrade setuptools 
pip install --upgrade wheel
pip install --upgrade ecos   # <--- Try conda install ecos if this fails
pip install --upgrade osqp   # <-- Can be tricky on some systems see https://github.com/cvxpy/cvxpy/issues/1190#issuecomment-994613793
pip install --upgrade pyportfolioopt # <--- Skip if you don't plan to use it
pip install --upgrade riskparityportfolio
pip install --upgrade scipy
pip install --upgrade precise 

Miscellaneous

  • Here is some related, and potentially related, literature.
  • This is a piece of the microprediction project aimed at creating millions of autonomous critters to distribute AI at low cost, should you ever care to cite the same. The uses include mixtures of experts models for time-series analysis, buried in timemachines somewhere.
  • If you just want univariate calculations, and don't want numpy as a dependency, there is momentum. However if you want univariate forecasts of the variance of something, as distinct from mere online calculations of the same, you might be better served by the timemachines package. In particular I would suggest checking the time-series elo ratings and the "special" category in particular, as various kinds of empirical moment time-series (volatility etc) are used to determine those ratings.
  • The name of this package refers to precision matrices, not numerical precision. This isn't a source of high precision covariance calculations per se. The intent is more in forecasting future realized covariance, conscious of the noise in the empirical distribution. Perhaps I'll include some more numerically stable methods from this survey to make the name more fitting. Pull requests are welcome!
  • The intent is that methods are parameter free. However some not-quite autonomous methods admit a few parameters (the factories).

Disclaimer

Not investment advice. Not M6 entry advice. Just a bunch of code subject to the MIT License disclaimers.

Owner

  • Name: Peter Cotton
  • Login: microprediction
  • Kind: user
  • Location: 06820

GitHub Events

Total
  • Release event: 6
  • Watch event: 44
  • Issue comment event: 4
  • Push event: 45
  • Pull request review event: 2
  • Pull request event: 5
  • Fork event: 9
  • Create event: 5
Last Year
  • Release event: 6
  • Watch event: 44
  • Issue comment event: 4
  • Push event: 45
  • Pull request review event: 2
  • Pull request event: 5
  • Fork event: 9
  • Create event: 5

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 949
  • Total Committers: 10
  • Avg Commits per committer: 94.9
  • Development Distribution Score (DDS): 0.086
Past Year
  • Commits: 83
  • Committers: 2
  • Avg Commits per committer: 41.5
  • Development Distribution Score (DDS): 0.036
Top Committers
Name Email Commits
Peter Cotton 5****n 867
Peter Cotton p****n@n****l 28
Peter Cotton p****r@P****l 19
microprediction i****o@3****g 14
Peter Cotton p****n@P****l 8
microprediction p****n@j****m 5
Marco Edward Gorelli m****i@p****m 3
Max m****v@g****m 3
OVVO-Financial o****s@g****m 1
Ian Klasky i****y@I****l 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 29
  • Total pull requests: 10
  • Average time to close issues: 4 months
  • Average time to close pull requests: 1 day
  • Total issue authors: 11
  • Total pull request authors: 5
  • Average comments per issue: 1.41
  • Average comments per pull request: 0.7
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 4 hours
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 7.0
  • Average comments per pull request: 2.5
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • microprediction (18)
  • pcotton-intech (2)
  • chogui (1)
  • mpugna (1)
  • smodlich (1)
  • HugoDelatte (1)
  • MarcoGorelli (1)
  • venu-analytics (1)
  • MaxHalford (1)
  • Marzio-USI (1)
  • kno10 (1)
Pull Request Authors
  • maxmarkov (4)
  • MarcoGorelli (3)
  • OVVO-Financial (3)
  • iklasky (1)
  • ryanrussell (1)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 323 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 2
  • Total versions: 64
  • Total maintainers: 1
pypi.org: precise

The home of Schur Hierarchical Portfolios: an aesthetically pleasing version of Hierarchical Risk Parity

  • Versions: 64
  • Dependent Packages: 1
  • Dependent Repositories: 2
  • Downloads: 323 Last month
Rankings
Dependent packages count: 4.8%
Stargazers count: 5.3%
Forks count: 7.2%
Average: 7.7%
Downloads: 9.6%
Dependent repos count: 11.6%
Maintainers (1)
Last synced: 11 months ago

Dependencies

.github/workflows/deploy.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/tests_sans_ppo.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/tests_scipy_173.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
requirements.txt pypi
  • collinearity *
  • kmeans1d *
  • momentum >=0.2.7
  • numpy *
  • pandas *
  • pandas_datareader *
  • pyportfolioopt *
  • scikit-learn *
  • scipy *
  • tomark *
  • yfinance *
setup.py pypi
  • collinearity *
  • kmeans1d *
  • latextable *
  • momentum >=0.2.7
  • numpy *
  • pandas *
  • pandas_datareader *
  • pyportfolioopt *
  • scikit-learn *
  • scipy >=1.7.3
  • tomark *
  • yfinance *