Skip to main content

Online covariance, precision, portfolios and ensembles

Project description

precise docs tests tests-scipy-173License: MIT

Methods for online covariance forecasting and portfolio construction. See the documentation and M6 Competition successes.

Usage example: covariance

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.

Usage example: 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.

Other uses

This article illustrates the connection between portfolio theory and model ensembles. See also the colab notebook on which is is based.

Install

pip install precise 

or for latest:

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

Trouble?

pip install --upgrade pip
pip install --upgrade setuptools 
pip install --upgrade wheel
pip install --upgrade osqp   # <-- Can be tricky on some systems see https://github.com/cvxpy/cvxpy/issues/1190#issuecomment-994613793
pip install --upgrade pyportfolioopt
pip install --upgrade riskparityportfolio
pip install --upgrade scipy
pip insatll --upgrade precise 

Miscellaneous remarks

  • 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. 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.10.28.tar.gz (80.8 kB view details)

Uploaded Source

Built Distribution

precise-0.10.28-py3-none-any.whl (137.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: precise-0.10.28.tar.gz
  • Upload date:
  • Size: 80.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for precise-0.10.28.tar.gz
Algorithm Hash digest
SHA256 98f22057bfe2033d4d0d1c55011ba12c6405711736fcbe076b938054b9caf2c3
MD5 b8d05928bb3f5d3ceb796575c3e98e44
BLAKE2b-256 83203ea37a74cfc37ebbb8df49d929b10f68849f5c05b7b67aada26601cdec46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: precise-0.10.28-py3-none-any.whl
  • Upload date:
  • Size: 137.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for precise-0.10.28-py3-none-any.whl
Algorithm Hash digest
SHA256 7777bb58fe648cd6c312faad351598a5450bfda067441b83dbfdbab672f268ed
MD5 a47082cdbfef5d275579aa9e36e551d1
BLAKE2b-256 f3c163f4cb04792da955d6a99b889759aec2b8b7c806aa851f42c43d9ebdd8c0

See more details on using hashes here.

Supported by

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