Skip to main content

precise docs tests tests-scipy-173 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.



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

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.

Metadata

Release files for precise 0.14.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for precise 0.14.1
File Size Uploaded
precise-0.14.1.tar.gz 130.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for precise 0.14.1
File Interpreter ABI Platform
precise-0.14.1-py3-none-any.whl Python 3 none any Details

Total release size: 288.5 kB

Release files / precise-0.14.1.tar.gz

Download URL precise-0.14.1.tar.gz
Size 130.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9dd823141c5af3518fea93d0973be37ab7ffecaa1e55d270e356fa60fa8b92f1
BLAKE2b-256 checksum
How to use checksums
1f25d7d1f39981b4afb7193554c36d47a5221718baf2dcbd413f73f4550bcbd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / precise-0.14.1-py3-none-any.whl

Download URL precise-0.14.1-py3-none-any.whl
Size 157.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8be5694417d6427e6d938f2ec6191c9e9afee58e693bb609c05ad73e7bc7a44
BLAKE2b-256 checksum
How to use checksums
c9f4a842c68e8de6d4d2f9200cedd44b07eee23ea084ffcf9a562dc57d7b2396
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

1.1.0

2 release files

1.0.0

2 release files

0.16.7

2 release files

This release

0.14.1 This release

2 release files

0.14.0

2 release files

0.13.5

2 release files

0.13.2

2 release files

0.13.0

2 release files

0.12.8

2 release files

0.12.7

2 release files

0.12.5

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.9

2 release files

0.11.8

2 release files

0.11.7

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.5

2 release files

0.9.1

2 release files

0.8.7

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.5

2 release files

0.7.3

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.5.21

2 release files

0.5.16

2 release files

0.5.11

2 release files

0.5.9

2 release files

0.5.7

2 release files

0.5.5

2 release files

0.4.18

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page