Market regimeΒΆ

Unsupervised market-regime labelling by clustering rolling volatility / return features. detect_regimes is the in-sample convenience (for analysis); RegimeDetector is the causal fit-on-train / assign-online variant for backtests.

detect_regimes(X[, n_regimes, w, period, seed])

Label market regimes by k-means on rolling vol / return features.

regime_features(X[, w, period])

Build the causal regime feature matrix: trailing vol and mean return.

RegimeDetector([n_regimes, w, period, seed])

Causal market-regime detector (fit on the past, assign online).