Math-first swing options (7–45 DTE) simulation and recommendation platform. Evolves bot configs via genetic search; no live trading.
| Before (0DTE) | Now (swing) |
|---|---|
| Intraday minute bars | Daily bars |
| Same-day expiry | 7–45 DTE, target ~30 |
| Intraday gamma scalping | Multi-day hold, 50% profit / 21 DTE manage |
| Open vs close labels | Forward 10-day regime labels |
| 5 indices | 6 indices + NSLI: MEII, RVRI, IVRI, TSTI, PDI, LSI |
| Layer | Source |
|---|---|
| Underlying OHLCV | yfinance (real daily bars) |
| VIX | yfinance |
| Option marks | Black–Scholes with 20-day realized vol (entry and exit) |
| Strikes | ~20Δ via BS delta solver (not fixed % OTM) |
| Expiry | Nearest listed Friday in 7–45 DTE window |
| Slippage | 3% on entry credit and exit mark (configurable) |
| Historical option chains | Optional Polygon if POLYGON_API_KEY is set |
| Macro calendar | Forex Factory JSON feed merged into data/economic_calendar.csv |
The user simulation (swingopt simulate) walks forward day-by-day: you read the morning advisory at the open, enter only when gates pass, and hold until stop / take-profit / 21 DTE manage / strike breach on real daily high/low.
Walk-forward retraining every 25 days (configurable) keeps the classifier fresh inside the backtest.
cd evolving-options-trader
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"Optional for historical option marks:
export POLYGON_API_KEY=your_key_here# Train classifier + strategy table on config symbol (default SPY)
swingopt train --start 2020-01-01
# Daily advisory (CommunicationAgent — same path as simulation)
swingopt analyze
swingopt analyze --symbol NVDA --date 2025-06-16
# User morning-advisory backtest on real data (strict gates)
swingopt simulate --symbols NVDA,SPXW --days 100| Index | Meaning |
|---|---|
| MEII | Macro events in next 7 days |
| RVRI | VIX + ATR vol regime |
| IVRI | IV rank (percentile vs 252d) |
| TSTI | Term structure proxy (VIX / realized vol) |
| PDI | 5-day price momentum |
| LSI | Options liquidity stress |
| NSLI | Classifier confidence |
- Confidence < 40% → NO TRADE
- LSI > 0.80 → NO TRADE (liquidity) — skipped in backtest (no historical bid/ask)
- MEII > 0.85 → NO TRADE (macro cluster)
- IVRI < 35% → NO TRADE (premium too cheap for short strategies)
- Entry at market open on real daily bar
- Strikes at ~20Δ short leg; wing width scales with symbol (NVDA ~2.5%, SPX ~0.4%)
- Exit at 50% of max profit (spread PnL vs entry credit)
- Stop at 2× credit received
- Manage/close at 21 DTE
- Strike breach on real daily high/low
src/swingopt/
├── pricing.py # BS marks, delta strikes, slippage
├── pipeline.py # Advisory pipeline + execution on real bars
├── advisory_backtest.py # User morning simulation (walk-forward)
├── data/
│ ├── polygon_options.py
│ ├── expiry.py
│ └── calendar_feed.py
├── labels.py # Forward-looking regime labels
├── indices.py # MEII, RVRI, IVRI, TSTI, PDI, LSI
├── simulation/ # Strategy-table training sim
├── strategy_table.py # Regime → strategy (utility-maximized)
├── training.py # Offline fit
└── agents/ # Data, Regime, Gate, Strategy, Levels, Communication
Research and simulation only. Not financial advice. Options involve substantial risk.