Project 3 Market Regime Detection

This tool finds the calm and the wild phases of a market and shows how risk changes between them.

Already bought a plan? Sign in to open this project.

Sign in

How this project is built

The whole project consists of these six steps.

  1. Volatility and tails, window by windowThe first step shows that calm and wild phases exist at all, because volatility and tails change from window to window.
  2. Memory in the size of returnsLarge moves tend to follow large moves, and this memory is the reason why past data can reveal the phase.
  3. A first phase rule, fitted by likelihoodA simple rule then labels each day as calm or wild from past volatility, and a fitted distribution describes each phase.
  4. Links that changeWith the labels in place, the tool measures how correlation and beta shift between calm and wild days.
  5. Risk by phaseThe labels pay off here, because value at risk and expected shortfall are measured for each phase on its own.
  6. A model with two regimesA hidden Markov model comes last as a second way to label the days, and it is compared with the simple rule.
  7. After the last step, all six parts run together in one program, regime_tool.py. What the finished tool does

What the finished tool does

You give it a price history, and it marks every day as calm or wild, once with a simple rule and once with a hidden Markov model. It then shows how volatility, correlation and the hedge ratio change from one phase to the other.

What you get

  1. 01The six steps with their code Each step explains its idea, walks through its code piece by piece and names its limits.
  2. 02The working tool, regime_tool.py The full program in one file, with its settings and experiments to try.
  3. 03Defend it in an interview Typical follow-up questions, each with the reasoning you need to answer it.
  4. 04Use it with real data Which data the tool needs, how to load it and what to change in the code.

See pricing