Using the Precise Package to Enter the M6-Financial Forecasting Contest

Microprediction
Geek Culture
Published in
3 min readFeb 4, 2022

--

Lest I be accused of burying the lead, you can create entries for the M6 Financial Forecasting contest as easily as this:

Minimalist creation of an M6 Entry

Naturally, you may wish to modify the entry afterward according to your stock preferences and views. This post explains how you can also modify the creation of the baseline entries provided by the Python precise package

The Output

The M6 Contest requires you to produce a CSV file with a combination of quintile probabilities and a portfolio (the Decision column). The portfolio’s absolute values should sum to unity. Each row of quintile probabilities should also sum to unity. I refer you to the official site and invite you to register.

Diversity is a strength. This short note is intended to encourage more people to enter and upload CSV files as required. I’ve heard from many of you that you are intimidated by the need to create quintile probabilities or portfolios. Please don’t be.

I’ve made it easy here but I also hope you treat this as merely a jumping-off point, or even less than that — just a set of utilities so you don’t have to reinvent every part of the workflow. If you do wish to use the precise package then of course pip install precise. The remainder of this post describes how you can alter the defaults.

Choose the portfolio creation method

This example uses the hierarchical risk parity method published by Marcos Lopez de Prado (paper).

You’ll find many more “port” functions in precise/skaters

Choose the covariance estimator

Pretty easy too, as illustrated by an example script.

Illustrates how to specify a method of estimating stock and ETF covariance

The precise package provides a number of ways of estimating running covariance — that’s its reason for existence, mostly. If you want the full list of so-called covariance skaters you should use the cov_skater_manifest function, as illustrated in this colab notebook.

Things are pretty fluid.

Tilt towards or away from tickers

Naturally, you can do what you like with the output, as noted, but you also have the option of providing a list of stocks you love and a list of stocks you hate.

Tilt towards stocks you like, or away

Change other details

Hey, it’s just code. Do what you like. And poke around skatertools/m6 and the functions provided there to see what else you can change. For instance, you can modify the sampling interval of historical data used to generate a covariance matrix.

Don’t run it on Colab

A quick tip: don’t run this on colab. It may fail elsewhere in the cloud too, due to data API restrictions. I suggest you run locally.

Ask Questions

My GitHub homepage contains a slack invitation. There is an M6 channel.

--

--