stress_whatif
Run what-if stress scenarios with added option legs, revealing how the portfolio's worst P&L point moves. Compares baseline, protected, and difference curves.
Instructions
The same stress run, with hypothetical legs added — three curves and three troughs: the portfolio as it stands, the portfolio plus the legs, and the difference.
This is what replaces reading Risk Navigator's What-If by hand: "if I add N puts at strike K expiring E, where does the trough move to?"
Read all three troughs. The trough of the difference is not the difference of the troughs — adding protection moves where the worst point sits as well as how deep it is, and comparing only the depths hides the move. A structure that lifts the bottom by very little may still have pushed it from −8% out to −15%, which is the part that matters.
Hypothetical options are priced off IB's current model greeks for those
exact contracts, so both curves start from the same volatilities and the
difference is the structure alone. A leg that cannot be resolved or priced
is reported in legProblems and left out of the second curve; the
comparison then covers only the legs that did resolve, and says so.
Nothing is sent to IB's order path here — this is pure local repricing. For what the structure costs in margin, use whatif_order.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| legs | Yes | Hypothetical legs to add. Each is either a conid, or symbol+secType+expiry+strike+right, with action BUY/SELL and a quantity. | |
| betas | No | ||
| shocks | Yes | Underlying moves as fractions, as above. | |
| vol_bump | No | ||
| vol_mode | No | sticky_strike | |
| fetch_skew | No | ||
| default_beta | No | ||
| date_offset_days | No | ||
| bond_rate_shift_bp | No | ||
| bond_duration_years | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||