Quantitative Finance & Time Series

13 tutorials· Ordered reading path

Finance provides some of the richest and most challenging data for machine learning. This path covers methods used by quant researchers: detecting market regimes, building trading strategies, and modelling risk.

You will implement changepoint detection, test for cointegration, build Markowitz portfolios, fit hidden Markov models to market data, and apply survival analysis to real-world outcomes.

1

Changepoint Detection: Finding Regime Shifts in Financial Data

Detect volatility regime shifts in the S&P 500 with the PELT algorithm. Compare PELT vs Binary Segmentation and align changepoints with financial crises.

2

Bayesian Online Changepoint Detection in Python

Detect regime shifts in real time with BOCD. Track posterior probabilities on S&P 500 data, choose your detection threshold, and compare with offline PELT.

3

Five Markets, 22 Years: Every Crisis from Price Data

Run a Bayesian changepoint detector across S&P 500, oil, gold, EM equities, and the dollar. 22 years, 69 detections: 47 genuine, 10 plausible, 12 tenuous.

4

Cointegration Test for Pairs Trading in Python: Engle-Granger and Johansen

Test cointegration between ETF pairs using Engle-Granger and Johansen methods in Python. Build a pairs trading strategy with z-score signals on real data.

5

GARCH Model in Python: A 36-Day Shock Half-Life

Fit a GARCH model in Python with NumPy and SciPy, verify it against arch, and compare volatility forecasts with EWMA on pinned S&P 500 returns.

6

Modern Portfolio Theory from Scratch: The Efficient Frontier

Build the Markowitz efficient frontier in Python with matrix algebra and Monte Carlo. Optimal portfolios, the Sharpe ratio, and the capital market line.

7

Kelly Criterion in Python: Half Kelly, Estimated Inputs

Implement the Kelly criterion in Python. Simulate uncertain returns, compare fractional Kelly and inspect a GARCH allocation with explicit costs.

8

Hidden Markov Models: When Clusters Have Memory

Hidden Markov Models via the weather-umbrella analogy. Forward and Viterbi algorithms from scratch, stock market regime detection, and HMM vs K-Means.

9

Time Series as Dynamical Systems: Delay Embedding

Reconstruct a chaotic attractor from a single time series with Takens delay embedding, then forecast it with simplex projection, from scratch in NumPy.

10

LSTM from Scratch: The Forget Bias Sets the Memory

Build an LSTM from scratch, check the NumPy cell against PyTorch and measure how forget bias changes recall across 100 sequence steps.

11

Cox Proportional Hazards in Python with lifelines

Fit Cox proportional hazards in Python on real recidivism data: partial likelihood, hazard ratios, Schoenfeld diagnostics, and time-dependent covariates.

12

Bayesian Survival Analysis with PyMC: Modelling Customer Churn

Bayesian accelerated failure time model in PyMC for customer churn. Censored data with pm.Potential, Weibull vs Log-Logistic, and ArviZ survival curves.

13

MCMC for Mixture Models: Inferring Earthquake Regimes

Build a Metropolis-Hastings sampler from scratch to infer hidden regimes in earthquake data. Full posterior distributions instead of point estimates.

Related Tools

Stay in the loop

Get notified when new tutorials and deep-dives are published. No spam, unsubscribe anytime.

Quantitative Finance FAQ

Common questions about this topic