Online covariance, precision, portfolios and ensembles
Project description
precise docs
-
A collection of one-line online covariance forecasting and portfolio construction methods. See docs.
-
A home for 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. This got quite a reaction when I posted it, and it is evidently ground-breaking, seminal work.
Here are two articles:
- Schur Complementary Portfolios to unify Modern Portfolio Theory and Machine Learning methodology
- Optimizing a Portfolio of Models
The package was taken for a spin in the M6 Financial Forecasting contest too, and it has been quite successful.
Usage
Again, 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.
Model ensembling
This will depend on what automl convenient tooling you use. But see the article which uses LazyPredict, or 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 # <--- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file precise-0.11.7.tar.gz
.
File metadata
- Download URL: precise-0.11.7.tar.gz
- Upload date:
- Size: 90.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d40c6e61b7b629fc41d7d833839ce21679c119c10e1963d16c57f7a4db47d2f5 |
|
MD5 | 624e7d7367b690d914b42afc8bbced4c |
|
BLAKE2b-256 | 52ed66883185ce2b1925a836b68dfdc4494ab279d562eacf82d66ceb72f6b1f7 |
File details
Details for the file precise-0.11.7-py3-none-any.whl
.
File metadata
- Download URL: precise-0.11.7-py3-none-any.whl
- Upload date:
- Size: 148.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3a534248ae0c84fc36c71b351c6e41eff9d93e3fcf9e3851554e78e5d9cd3dd |
|
MD5 | 3c28f5a62d7921eae69bf4c1890d1132 |
|
BLAKE2b-256 | 9cd0c539c626b053ff7afdfc21ddec31dfcfa3dca3ff633113ef9d0fbf27fdeb |