# Sharpe-opt full book: trade logs agents can reuse

This describes the **artifact layout** produced when you export the merged portfolio that was **Sharpe-optimized** under a drawdown cap (see `portfolio_vrp_plus_vxx.py --optimize-sharpe`). It is **not** a new pricing engine run for IV/VXX — those sleeves use **fixed JSONL histories** from prior engine runs; only **VRP is re-simulated** on Theta so closed trades match the live overlap preset.

## Runner

```bash
cd /Users/robzingale/trading_bot
PYTHONUNBUFFERED=1 .venv/bin/python RenTech/strategy_stack/export_sharpe_opt_fullbook_trades.py \
  --overlap-slice-contracts 2 \
  --capital 100000
```

**Runtime:** Full Theta calendar (~2500+ sessions) is typically **~60–100 minutes** on a laptop (VRP engine only; overlay scaling is seconds). Omit `--no-progress` so tqdm shows ETA. Smoke: `--max-days 45`.

- **VRP preset:** Same as `run_vrp_low_dd_vxx_bundle.py`: `vol_risk_scaling=False`, `r2_crossover_filters=True`, `dd_risk_scaling=True`, `overlap_portfolio=True`, `overlap_slice_contracts` from flag (default **2** to match `vrp_low_dd_ov2_*` naming).
- **Default merge fractions** (override with `--capital-*-pct`): interior optimum from `--sharpe-max-dd-pct 10` on 2026-05-08 — put ~0.523%, straddle ~5.75%, RR ~3.39%, VXX ~23.2% of `--capital`, VRP scale 100%.
- **Overlay sources (defaults):** `engine_iv_*_ivx1.jsonl` and `overall_portfolio_trade_audits/engine_vxx_1pct_2016_2026/*.jsonl`.

## Outputs (under `RenTech/data/logs/`, prefix default `sharpe_opt_10dd_fullbook_ov2`)

| File | Contents |
|------|-----------|
| `{prefix}_vrp_trades.jsonl` | VRP closed trades for `execute_portfolio_merge` |
| `{prefix}_vrp_trade_log_with_legs.csv` | Same trades, human-readable + `legs_json` |
| `{prefix}_iv_put_scaled.csv` | IV OTM put: per trade `pnl_usd_scaled` = raw × (`capital_put` / `ref_put`) |
| `{prefix}_iv_straddle_scaled.csv` | IV straddle, same pattern |
| `{prefix}_iv_rr_scaled.csv` | Risk reversal, same pattern |
| `{prefix}_vxx_bear_scaled.csv` | VXX bear spread leg (90% of VXX budget by default) |
| `{prefix}_vxx_long_scaled.csv` | VXX long call leg (10%) |
| `{prefix}_ALL_SLEEVES_trade_log.csv` | **All** rows concatenated, sorted by `exit_date`, with `sleeve` column |
| `{prefix}_equity_daily.csv` | Daily equity columns from `execute_portfolio_merge` |
| `{prefix}_manifest.txt` | Scale factors, paths, trade counts, headline metrics, reproduce command |

Scaling matches `portfolio_vrp_plus_vxx.merged_full_equity`: each overlay trade’s PnL is multiplied by the **sleeve-level** factor `capital_sleeve / sleeve_risk_ref`, where `sleeve_risk_ref` is the **sum** of `broker_risk_usd` over that JSONL when every row documents it.

## Adding strategies later

- **Change VRP rules:** Re-run this export (or `export_theta_full_trade_log.py --low-dd-overlap`) so `vrp_*` files update; then re-merge or re-optimize fractions.
- **Change IV/VXX engines:** Re-run the respective backtests to new JSONLs, point `--put-trades` / … flags here, and re-run export (VRP can stay or re-run).
- **Change allocations:** Pass new `--capital-*-pct` from a fresh `--optimize-sharpe` block; overlay JSONLs unchanged unless engines change.

## See also

- `VRP_PLUS_VXX_OVERLAY_MERGE.md` — merge math and “1% VXX” semantics.
- `portfolio_opt_10dd_sharpe_snapshot.txt` — saved optimizer metrics for the default fractions.
