-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Description I am looking to evolve Quant Lab Alpha from a static portfolio analyzer into a dynamic backtesting suite. The goal is to implement a Walk-Forward Analysis (WFA) framework that utilizes Hidden Markov Models (HMM) to identify market regimes (e.g., Bull, Bear, Volatile) and adjust portfolio policy accordingly.
The Vision Standard backtests often suffer from look-ahead bias and "overfitting." By implementing a Walk-Forward approach, we can optimize parameters on an in-sample "training" window and validate them on an out-of-sample "forward" window.
Proposed Workflow:
-
Regime Detection (HMM): Use hmmlearn to categorize historical data into N states based on mean returns and variance. -
Modular Policy: Create a "Policy" class where users can define rules (e.g., "If HMM State = 'High Volatility', tilt 20% more toward HmL (Value) and Rm−Rf (Beta) < 0.8"). -
Walk-Forward Execution: * - Window 1: Train/Optimize (In-Sample). - Window 2: Trade/Evaluate (Out-Sample). - Shift window and repeat.
Technical Objectives:
-
Regime Modeling: Integration of hmmlearn or statsmodels for the Markov switching. -
Backtest Engine: A vectorized or event-driven loop that tracks equity curves, drawdowns, and turnover. -
Visualizations: A "Regime Map" overlaying the price chart, showing which state the HMM identified over time.
Requirements:
-
Must be compatible with existing FF5 and Monte Carlo modules. -
Results should integrate with the (proposed) PDF Report Generator. -
Clear separation between data fetching, signal generation, and performance attribution.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels