Where the code from my articles lives now

Most of my data articles end with a short Python script. Until this week, the only way to run one was to copy it out of the web page, paste it into an editor and hope the indentation survived.

That has changed in two ways.

On Kaggle, five of those scripts now run as notebooks. You open one, press run, and it prints the figures from the article. Nothing to install. The five cover position sizing and drawdowns, plastics resin output as a lead on manufacturing, implied volatility from Black-Scholes, 25 years of market correlations, and how far non-farm payrolls get revised.

On OSF, the Open Science Framework, fourteen scripts sit as plain files in one project, sorted into folders: volatility, correlation and spreads, energy, macro and risk. They carry the MIT licence, so anyone can reuse them. OSF also gives the project a permanent address, which matters if someone wants to cite the method rather than a web page that might move.

Why both? Kaggle is for the reader who wants to see the numbers appear. OSF is for the one who wants the file on their own machine, to change a date range or point it at another ticker.

The payrolls notebook is the one I'd run first. The headline jobs number is revised twice after release, and the script reads the archived first and third estimates for every month from ALFRED, the St. Louis Fed's vintage database. How far apart those two columns sit is what the article is about.

A practical warning. Yahoo Finance fills gaps and adjusts old closes now and then, so a fresh run of the price-based scripts can drift a little from what I published. FRED series move too.

The links:

Kaggle notebooks: kaggle.com/caiomarchesani
OSF project: osf.io/abrdp
The articles themselves: caiomarchesani.com/category/articles

Comments

Popular posts from this blog

The crack spread, cut down to one page

Historical volatility with a pencil and ten prices