regime_features¶
Defined in fynance.features.regime
- regime_features(X, w=21, period=252)[source]
Build the causal regime feature matrix: trailing vol and mean return.
Both columns use trailing windows (past only), so the matrix is causal — the value at
tdepends onX[:t+1]only.- Parameters:
- Xnp.ndarray
One-dimensional price/level series.
- wint
Rolling window.
- periodint
Annualization factor for the volatility column.
- Returns:
- np.ndarray
Shape
(len(X), 2)—[realized_volatility, rolling_mean_log_return].