Skip to content
← All work

04 · Market regimes · Quant

Multi-Asset Regime Risk Monitor

Labels the current regime for crypto, US ETFs and JSE stocks from volatility, trend and drawdown, then has an LLM explain the structured output, never predict prices.

Assets: BTC, ETH, SOL, SPY, QQQ, NPN, SOL.JO, SBK, MTN
9
Trend-strength threshold
±3%
Drawdown regime cut-offs
−5/−10/−20%
KMeans clusters (optional)
4

The regime classifier, live

Move the sliders. The labels follow the exact rules in models/regimes.py.

risk_regime

medium_volatility_sideways

volatility
medium
trend
sideways
drawdown
normal

Problem

Market data is noisy and most dashboards either show raw prices or a black-box signal. A risk monitor should say which regime an asset is in, why, and whether past alerts were followed by real risk.

Approach

  1. 01Free data only: ccxt for crypto OHLCV, yfinance for ETFs and JSE stocks, cached locally.
  2. 02Rule-based labels you can read. Volatility is bucketed per asset at its own 33rd and 66th percentiles. Trend strength above +3% is bullish, below −3% bearish. Drawdowns of 5, 10 and 20% mark mild, elevated and severe.
  3. 03Drawdown overrides everything, high volatility comes next, and calm regimes are named only when volatility is low. KMeans on standardized features and PELT change points from ruptures are optional cross-checks.
  4. 04An evaluation module measures future risk after each alert. The LLM layer writes the analyst summary from those numbers. It is not asked to forecast.

Results

A Streamlit dashboard with regime timelines on the price chart, portfolio risk ranking across presets (crypto, US tech, JSE, mixed), and downloadable Markdown risk reports.

The repo does not commit alert-evaluation results, so this page shows the classifier itself rather than a performance claim.

Next

Publish a fixed backtest of alert precision per regime, and compare the rule labels against the KMeans clusters over the same window.