• Stars
    star
    150
  • Rank 245,822 (Top 5 %)
  • Language
    Python
  • License
    Other
  • Created over 2 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

World beating online covariance and portfolio construction.

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.

More Repositories

1

timemachines

Predict time-series with one line of code.
Python
395
star
2

microprediction

If you can measure it, consider it predicted
Jupyter Notebook
326
star
3

humpday

Elo ratings for global black box derivative-free optimizers
Python
103
star
4

timeseries-notebooks

Hello world univariate examples for a variety of time series packages.
Jupyter Notebook
50
star
5

winning

Inference of relative ability from winning probabilities
Jupyter Notebook
36
star
6

m6

M6-Forecasting competition
Jupyter Notebook
30
star
7

optimizer-elo-ratings

Assigns Elo Ratings to Python Global Optimizers
19
star
8

timeseries-elo-ratings

Elo ratings for time-series forecasting packages
Python
18
star
9

m6entry

Python
13
star
10

microactors-causality

Examples of causality maps for time series driven by GitHub actions
Jupyter Notebook
13
star
11

muid

Memborable Unique Identifier
Python
10
star
12

building_an_open_ai_network

MIT Press
9
star
13

momentum

Running mean, variance, skew, and kurtosis
Python
9
star
14

embarrassingly

robust optimization
Python
8
star
15

pandemic

A 2d contagion model with commuting modeled as regime switching Ornstein-Uhlenbeck walks on the plane
Python
8
star
16

tuneup

Comparison of global optimization algorithms, including scipy, optuna, hyperopt, platypus, facebook-ax, pysot and others.
Python
6
star
17

monteprediction_colab_examples

Monte Carlo Submission Examples
Jupyter Notebook
6
star
18

gptprobe

For unmanned missions into GPT returning structured data
Python
5
star
19

offline

Demonstrates one pattern for offline estimation
Python
4
star
20

firstdown

NFL first down strategy
Jupyter Notebook
4
star
21

microactors

Examples of scheduled jobs estimating copulas at www.microprediction.org
Python
4
star
22

home

home page of sorts
4
star
23

microconventions

Conventions used at MicroPrediction.Org
Python
3
star
24

midterms

3
star
25

timemachines-testing

Testing optimizers and time-series algorithms, and assigning them Elo ratings.
Python
3
star
26

timeseries-data

static benchmarking timeseries data
Jupyter Notebook
3
star
27

schooled

Experiments in what NN's can learn, or not
Python
2
star
28

csvsdataset

Dataset from multiple CSV files
Python
2
star
29

diffracting

Diffracting probability
2
star
30

chattychattybangbang

Forcing ChatGPT to do its own QA, and other strategies.
Python
2
star
31

curiouskids

questions for kids
2
star
32

rediz

Supporting community nowcasts at www.microprediction.org
Python
2
star
33

barbell

Notes on the interpretation of a barbell bond portfolio
2
star
34

autotds

Automatically generates "Towards Data Science" quality articles
Python
2
star
35

awesome-python-benchmarks

Benchmarking for python analytic packages
2
star
36

successor

Predicts the next number in a sequence, or next k
Python
1
star
37

predictionserver

Development version of microprediction server (not working yet)
Python
1
star
38

marketstacker

Financial market data in pandas using marketstack API
1
star
39

chess

Blitz and bullet chess ratings
HTML
1
star
40

realdata

Simple real time series data
Python
1
star
41

diffraction

Diffracting probability
1
star
42

helicopter

Helicopter Julia Challenge
Python
1
star
43

automl-notebooks

Quick and dirty first pass analysis
Jupyter Notebook
1
star
44

echochamber

Using an echo state network to enter a contest at microprediction.org
Python
1
star
45

awesome-hype

Listing of repositories for independent benchmarking and debunking
1
star
46

getjson

Very limited mini-package for retrieving JSON data with backoff and failover
Python
1
star
47

monteprediction

Monte Prediction Utilities
Python
1
star
48

correlationbounds

Tiny utility for correlation bounds by brute force
Jupyter Notebook
1
star