Mean-reversion strategy using dynamic S&P 500 membership.
Pipeline covers: data preparation (historical index membership + Yahoo Finance OHLCV), rolling z-scores, and an equally-weighted long/short Backtrader strategy with basic performance metrics.
- Handles changing S&P 500 constituents over time
- Downloads OHLCV via
yfinance - Computes rolling z-scores (lookback + 1-bar shift to avoid lookahead)
- Rebalances on a fixed frequency; equal-weight long/short
- Reports Sharpe, total return, start value, end value, max drawdown
- Saves CSVs and an equity curve plot
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
pip install -e . # so `alpha_factor_research` is importable