Skip to main content

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

Project description

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 LISTING_OF_COV_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 LISTING_OF_MANAGERS 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

precise-0.16.7.tar.gz (149.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

precise-0.16.7-py3-none-any.whl (146.2 kB view details)

Uploaded Python 3

File details

Details for the file precise-0.16.7.tar.gz.

File metadata

  • Download URL: precise-0.16.7.tar.gz
  • Upload date:
  • Size: 149.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.15

File hashes

Hashes for precise-0.16.7.tar.gz
Algorithm Hash digest
SHA256 d01e08da24186d85c27e1287c0b8dec94231f67549aa36b7c26850e7738638f9
MD5 2b362b27ae77e22fddb757bc6546a7fb
BLAKE2b-256 2913b90ca443437c9549b896d37061ecda3154c6d37f79d6b7992db52a7b089a

See more details on using hashes here.

File details

Details for the file precise-0.16.7-py3-none-any.whl.

File metadata

  • Download URL: precise-0.16.7-py3-none-any.whl
  • Upload date:
  • Size: 146.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.15

File hashes

Hashes for precise-0.16.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f5a3c5efe6b201e7b1b7b968d07e7afdd126482bbef6faa6858d02568f06c963
MD5 200ef398a159792d5c157e89c0de444b
BLAKE2b-256 ba9e0fa3e6e3cc0413fba34785705b373aaa19bb71e20a7827a32b61ba921166

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page