feat: improve US alpha pipeline and regime filters

Expand alpha pipeline with additional factors and scoring logic.
Update regime filters and add comprehensive test coverage.
This commit is contained in:
2026-05-14 12:52:55 +08:00
parent 0a2d646b26
commit 47755ff630
3 changed files with 295 additions and 31 deletions

View File

@@ -17,7 +17,10 @@ def build_regime_filter(etf_close: pd.DataFrame, market_col: str = "SPY") -> pd.
rs = prices.pct_change(RS_WINDOW, fill_method=None)
non_market_rs = rs.drop(columns=[market_col], errors="ignore")
leader_ok = non_market_rs.gt(rs[market_col], axis=0).any(axis=1)
if non_market_rs.shape[1] == 0:
leader_ok = pd.Series(True, index=prices.index)
else:
leader_ok = non_market_rs.gt(rs[market_col], axis=0).any(axis=1)
regime = (market_ok & leader_ok).astype(bool)
return regime.shift(1, fill_value=False)