regimes
/regimes
Estimates which market regime is in force, as a probability for each regime, from relative features such as the ratio of short to long volatility, trend strength, drawdown, and cross asset correlation, using only data available at each date. Use when asked what kind of market we are in, whether volatility or stress is rising, for regime probabilities, or for exposure that adapts to the regime.
- Author
- ruujOnChain ↗
- Repository
- HedgeFund-Skills ↗
- Licence
- MIT
- Last repository change
- 07.11.2026
Assessment and security
- Files in this package
- 3
- Scripts
- 1
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 07.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 1 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: scripts/regimes.py
What it does and when to use it
Estimates which market regime is in force, as a probability for each regime, from relative features such as the ratio of short to long volatility, trend strength, drawdown, and cross asset correlation, using only data available at each date. Use when asked what kind of market we are in, whether volatility or stress is rising, for regime probabilities, or for exposure that adapts to the regime.
Original author description
Estimates which market regime is in force, as a probability for each regime, from relative features such as the ratio of short to long volatility, trend strength, drawdown, and cross asset correlation, using only data available at each date. Use when asked what kind of market we are in, whether volatility or stress is rising, for regime probabilities, or for exposure that adapts to the regime.
How it works
- Inputs
- Procedure
- Checks
- Output
- Explaining the result
SKILL.md preview
---
name: regimes
description: Estimates which market regime is in force, as a probability for each regime, from relative features such as the ratio of short to long volatility, trend strength, drawdown, and cross asset correlation, using only data available at each date. Use when asked what kind of market we are in, whether volatility or stress is rising, for regime probabilities, or for exposure that adapts to the regime.
license: MIT
compatibility: Requires Python 3.9 or later with numpy and pandas.
metadata:
owner: research
version: "1.0"
---
# Regime detection
Answers one question: what kind of market are we in? Fits a Gaussian hidden Markov model (Hamilton, 1989) to relative features and reports filtered probabilities. Every number comes from `scripts/regimes.py`.
## Inputs
- `prices.csv`: a date column, then daily price levels. One column is the series whose regime is measured (for example an equity index). Extra columns, such as bonds, credit, or currencies, feed the average correlation feature.
- At least three years of daily history: one year to warm up the features and enough to train and then report.
- A training end date. The model is fitted only on data up to that date; report dates after it are out of sample. If the user gives none, the script uses the midpoint of the history and flags it.
- Optional: a target exposure for each regime, ordered from lowest to highest volatility. These are the user's own policy. Never propose them yourself.
## Procedure
1. Confirm the series, the correlation series, the number of regimes (2 or 3), and the training end date.
2. Run the model:
```bash
python scripts/regimes.py --prices prices.csv --asset INDEX --states 3 \
--train-end 2019-12-31 --exposures 1.0,0.6,0.2 --history regimes_history.csv
```
3. Read the JSON. If `passed` is false, report the failed check and stop.
4. Report the probability of each regime, the most likely regime, the feature values behind it, and the blended exposure when targets were given.
## Checks
- Probabilities sum to one on every date.
- No future data: probabilities recomputed from prices cut at a check date match the full run exactly.
- The EM fit converged.
- The report date lies after the training period.
## Output
`results.probabilities` (one per regime: `low_vol`, `normal`, `high_vol`, or two of them), `results.most_likely`, `results.features`, `results.regime_means`, `results.transition_matrix`, `results.expected_duration_days`, and with targets `results.blended_exposure`. `--history` writes the daily probabilities to a CSV.
## Explaining the result
- Lead with the probabilities, not only the most likely label; a 55 to 45 split is a different message from 95 to 5.
- Tie the answer to the features: for example, short term volatility running above its one year level with a falling trend and rising correlation.
- Regimes are labeled by their average volatility ratio. Describe them with the `regime_means`, which show what each regime looked like in training.
- Expected duration comes from the transition matrix and describes typical persistence in the training period.
- The blended exposure moves smoothly as probabilities change, which avoids abrupt switches on noisy signals.
For features, the model, and the filter, see [references/methodology.md](references/methodology.md).
Files in this package (3)
- SKILL.md 3 KB
- references/methodology.md 2 KB
- scripts/regimes.py 10 KB
Versions
The database has no other skills named regimes.
Database snapshot: 13.11.2026 · package version f84eac9d25af (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 95ml4t-regime-features
Features capturing market regime - volatility state, trend strength, and liquidity conditions. Use when building regime-aware models or conditioning on changing market environments. - 100market-regime
Use when characterizing the current market environment. Covers trend and volatility regimes, risk-on versus risk-off signals, macro context, and matching strategy to regime rather than fighting it. Trigger on "what kind of market are we in", "is it risk on or risk off right… - 100market-regime
Classify the current market regime for any index, ETF or crypto benchmark - risk-on uptrend, selective uptrend, choppy, correction or risk-off - from trend (50/200-SMA), momentum, volatility percentile, drawdown and optional breadth across a watchlist, with a suggested exposure… - 100crypto-regime
Read the crypto market regime - Bitcoin, Ethereum, Solana and other coins' trend, drawdown from the five-year peak, 30-day realised volatility and correlation with the Nasdaq, the ETH/BTC ratio, and large-speculator positioning in CME Bitcoin futures from the CFTC. Use when the… - 95ml4t-regime-awareness
Market regimes as conditioning features for risk scaling, not timing signals. Use when incorporating regime detection into strategy logic. - 90cross-asset-correlation-regime-shifts
Use when a multi-asset or risk-parity book depends on bonds hedging equities and you need to detect the regime shift where that relationship breaks, using a normalised matrix distance between correlation snapshots.