# Trade JSONL reference (VRP + IV overlays)

All **overlay** logs below use realized P&amp;L on **`exit_date`** with **`pnl_total`** (except **VRP**, which uses **`pnl_usd`**). Downstream tools: `scan_iv_overlay_correlation.py`, `portfolio_vrp_iv_sleeves.py`, `iv_mispricing_complement.py` (single overlay).

Default log directory: `RenTech/data/logs/` (create if missing).

| Sleeve | Producer script | Example output file | Notes |
|--------|-----------------|---------------------|--------|
| **VRP main** | `vrp_backtest_theta.py --export-trades-jsonl` | `vrp_trades.jsonl` | `pnl_usd` on exit date |
| **Stress long-vol straddle** | `backtest_iv_stress_long_vol.py --structure straddle --out-trades` | `stress_longvol_straddle.jsonl` | `pnl_total` |
| **Stress long-vol OTM put** | `backtest_iv_stress_long_vol.py --structure otm_put --out-trades` | `stress_longvol_otm_put.jsonl` | `pnl_total` |
| **IV mispricing straddle** | `backtest_iv_mispricing_straddle.py --out-trades` | `iv_mispricing_straddle_trades.jsonl` | `pnl_total` |
| **Bear call spread** | `backtest_iv_rich_vol_bear_call_spread.py --out-trades` | `bear_spread.jsonl` | `pnl_total` |
| ~~**Calendar**~~ (long far / short near call) | `backtest_iv_calendar_risk_reversal.py --mode calendar --out-trades` | `calendar_spread.jsonl` | `pnl_total`; term structure. **DROPPED** — lost -$10.5K (Sharpe -5.61), removing it improved portfolio Sharpe +0.069 (Apr 2026 analysis). |
| **Risk reversal** (long OTM put / short OTM call) | `backtest_iv_calendar_risk_reversal.py --mode risk_reversal --out-trades` | `risk_reversal.jsonl` | `pnl_total`; skew |
| **Iron condor** (short OTM call/put + long wings; XGB ranks **rich** shorts) | `backtest_iv_iron_condor_xgb.py --out-trades` | `iron_condor.jsonl` | `pnl_total`; short-vol complement |

## Ready-to-run sequence

1. **Export VRP trades** (if you do not already have `vrp_trades.jsonl`):

   ```bash
   python RenTech/strategy_stack/vrp_backtest_theta.py --export-trades-jsonl RenTech/data/logs/vrp_trades.jsonl
   ```

2. **Build overlay JSONLs** (artifact = your trained `vol_mispricing_xgb.joblib`):

   ```bash
   ART=RenTech/data/models/vol_mispricing_xgb.joblib
   python RenTech/strategy_stack/backtest_iv_stress_long_vol.py --artifact "$ART" --structure straddle --out-trades RenTech/data/logs/stress_longvol_straddle.jsonl
   python RenTech/strategy_stack/backtest_iv_stress_long_vol.py --artifact "$ART" --structure otm_put --out-trades RenTech/data/logs/stress_longvol_otm_put.jsonl
   python RenTech/strategy_stack/backtest_iv_calendar_risk_reversal.py --artifact "$ART" --mode calendar --out-trades RenTech/data/logs/calendar_spread.jsonl
   python RenTech/strategy_stack/backtest_iv_calendar_risk_reversal.py --artifact "$ART" --mode risk_reversal --out-trades RenTech/data/logs/risk_reversal.jsonl
   python RenTech/strategy_stack/backtest_iv_iron_condor_xgb.py --artifact "$ART" --out-trades RenTech/data/logs/iron_condor.jsonl
   ```

3. **Batch correlation scan** (all `*.jsonl` in the folder except VRP):

   ```bash
   python RenTech/strategy_stack/scan_iv_overlay_correlation.py \
     --vrp-trades RenTech/data/logs/vrp_trades.jsonl \
     --overlay-dir RenTech/data/logs \
     --out-csv RenTech/data/logs/overlay_scan.csv
   ```

4. **Combined equity + drawdowns** (VRP + optional sleeves; includes calendar + risk reversal when paths are passed):

   ```bash
   python RenTech/strategy_stack/portfolio_vrp_iv_sleeves.py \
     --vrp-trades RenTech/data/logs/vrp_trades.jsonl \
     --put-trades RenTech/data/logs/stress_longvol_otm_put.jsonl \
     --straddle-trades RenTech/data/logs/stress_longvol_straddle.jsonl \
     --calendar-trades RenTech/data/logs/calendar_spread.jsonl \
     --risk-reversal-trades RenTech/data/logs/risk_reversal.jsonl \
     --capital-main 100000 --capital-put 10000 --capital-straddle 10000 \
     --capital-calendar 10000 --capital-risk-reversal 10000 \
     --out-equity-csv RenTech/data/logs/portfolio_equity_daily.csv
   ```

**Next step after editing overlays:** re-run step 3 or 4 so CSV / JSON summary reflects the new files.
