Options Payoff Curve Skill

Generate an interactive options payoff curve chart with dynamic parameter controls.

How to use it

Claude Code
  1. Run the line below. It pulls the whole folder into ~/.claude/skills/options-payoff, including the files SKILL.md points to.
  2. Describe your job in plain words. Claude Code follows the skill from there.
Claude Code — installs the whole folder, not just SKILL.md
npx degit himself65/finance-skills/plugins/market-analysis/skills/options-payoff#main ~/.claude/skills/options-payoff

For one project only, change the path to .claude/skills/options-payoff. This skill also uses Chart.js — copying SKILL.md alone won't be enough. See the folder on GitHub.

Claude (web or desktop app)
  1. On this page open ⋯ → Download .md.
  2. Save it as SKILL.md in a folder, zip the folder, then Customize → Skills → + → Create skill → Upload a skill.
  3. Pick the file and Save. Claude shows the name and description and runs a security scan.
  4. Check the skill is switched on.
  5. Start a new chat and describe your job in plain words. The AI follows the skill from there.
ChatGPT or another app
  1. ChatGPT: make a Project and paste it into Instructions.
  2. Neither? Paste it at the top of a new chat — it works for that chat.
Not working?
  • Check which app you pasted it into — the steps above name the right one.
  • Some skills need the paid tier of Claude or ChatGPT.
Step-by-step guide with screenshots · Ask in the forum

Paste into Claude, ChatGPT or Cursor.

Source of Options Payoff Curve Skill

Show the full text197 lines
namedescription
options-payoff> Generate an interactive options payoff curve chart with dynamic parameter controls. Use this skill whenever the user shares an options position screenshot, describes an options strategy, or asks to visualize how an options trade makes or loses money. Triggers include: any mention of butterfly, spread (vertical/calendar/diagonal/ratio), straddle, strangle, condor, covered call, protective put, iron condor, or any multi-leg options structure. Also triggers when a user pastes strike prices, premiums, expiry dates, or says things like "show me the payoff", "draw the P&L curve", what does this trade look like", or uploads a screenshot from a broker (IBKR, TastyTrade, Robinhood, etc). Always use this skill even if the user only provides partial info — extract what you can and use defaults for the rest.

Options Payoff Curve Skill

Generates a fully interactive HTML widget (via visualize:show_widget) showing:

  • Expiry payoff curve (dashed gray line) — intrinsic value at expiration
  • Theoretical value curve (solid colored line) — Black-Scholes price at current DTE/IV
  • Dynamic sliders for all key parameters
  • Real-time stats: max profit, max loss, breakevens, current P&L at spot

Step 1: Extract Strategy From User Input

When the user provides a screenshot or text, extract:

Field Where to find it Default if missing
Strategy type Title bar / leg description "custom"
Underlying Ticker symbol SPX
Strike(s) K1, K2, K3... in title or leg table nearest round number
Premium paid/received Filled price or avg price 5.00
Quantity Position size 1
Multiplier 100 for equity options, 100 for SPX 100
Expiry Date in title 30 DTE
Spot price Current underlying price (NOT strike) middle strike
IV Shown in greeks panel, or estimate from vega 20%
Risk-free rate — 4.3%

Critical for screenshots: The spot price is the CURRENT price of the underlying index/stock, NOT the strikes. Never default spot to a strike price value.

Current SPX reference price:

!`python3 -c "exec('try:\n import yfinance as yf\n p=yf.Ticker(\'^GSPC\').fast_info[\'lastPrice\']\n print(f\'SPX ≈ {p:.0f}\')\nexcept Exception:\n print(\'SPX price unavailable — check market data\')')"`

Step 2: Identify Strategy Type

Match to one of the supported strategies below, then read the corresponding section in references/strategies.md.

Strategy Legs Key Identifiers
butterfly Buy K1, Sell 2×K2, Buy K3 3 strikes, "Butterfly" in title
vertical_spread Buy K1, Sell K2 (same expiry) 2 strikes, debit or credit
calendar_spread Buy far-expiry K, Sell near-expiry K Same strike, 2 expiries
iron_condor Sell K2/K3, Buy K1/K4 wings 4 strikes, 2 spreads
straddle Buy Call K + Buy Put K Same strike, both types
strangle Buy OTM Call + Buy OTM Put 2 strikes, both OTM
covered_call Long 100 shares + Sell Call K Stock + short call
naked_put Sell Put K Single leg
ratio_spread Buy 1×K1, Sell N×K2 Unequal quantities

For strategies not listed, use custom mode: decompose into individual legs and sum their P&Ls.


Step 3: Compute Payoffs

Black-Scholes Put Price
d1 = (ln(S/K) + (r + σ²/2)·T) / (σ·√T)
d2 = d1 - σ·√T
put = K·e^(-rT)·N(-d2) - S·N(-d1)
Black-Scholes Call Price (via put-call parity)
call = put + S - K·e^(-rT)
Butterfly Put Payoff (expiry)
if S >= K3: 0
if S >= K2: K3 - S
if S >= K1: S - K1
else: 0

Net P&L per share = payoff − premium_paid

Vertical Spread (call debit) Payoff (expiry)
long_call = max(S - K1, 0)
short_call = max(S - K2, 0)
payoff = long_call - short_call - net_debit
Calendar Spread Theoretical Value

Calendar cannot be expressed as a simple expiry function — always use BS pricing for both legs:

value = BS(S, K, T_far, r, IV_far) - BS(S, K, T_near, r, IV_near)

For expiry curve of calendar: near leg expires worthless, far leg = BS with remaining T.

Iron Condor Payoff (expiry)
put_spread = max(K2-S, 0) - max(K1-S, 0)   // short put spread
call_spread = max(S-K3, 0) - max(S-K4, 0)  // short call spread
payoff = credit_received - put_spread - call_spread

Step 4: Render the Widget

Use visualize:read_me with modules ["chart", "interactive"] before building.

Required Controls (sliders)

Structure section:

  • All strike prices (K1, K2, K3... as needed by strategy)
  • Premium paid/received
  • Quantity
  • Multiplier (100 default, show for clarity)

Pricing variables section:

  • IV % (5–80%, step 0.5)
  • DTE — days to expiry (0–90)
  • Risk-free rate % (0–8%)

Spot price:

  • Full-width slider, range = [min_strike - 20%, max_strike + 20%], defaulting to ACTUAL current spot
Required Stats Cards (live-updating)
  • Max profit (expiry)
  • Max loss (expiry)
  • Breakeven(s) — show both for two-sided strategies
  • Current theoretical P&L at spot
Chart Specs
  • X-axis: SPX/underlying price
  • Y-axis: Total USD P&L (not per-share)
  • Blue solid line = theoretical value at current DTE/IV
  • Gray dashed line = expiry payoff
  • Green dashed vertical = strike prices (K2 center strike brighter)
  • Amber dashed vertical = current spot price
  • Fill above zero = green 10% opacity; below zero = red 10% opacity
  • Tooltip: show both curves on hover
Code template

Use this JS structure inside the widget, adapting pnlExpiry() and bfTheory() per strategy:

// Black-Scholes helpers (always include)
function normCDF(x) { /* Horner approximation */ }
function bsCall(S,K,T,r,sig) { /* standard BS call */ }
function bsPut(S,K,T,r,sig) { /* standard BS put */ }

// Strategy-specific expiry payoff (returns per-share value BEFORE premium)
function expiryValue(S, ...strikes) { ... }

// Strategy-specific theoretical value using BS
function theoreticalValue(S, ...strikes, T, r, iv) { ... }

// Main update() reads all sliders, computes arrays, destroys+recreates Chart.js instance
function update() { ... }

// Attach listeners
['k1','k2',...,'iv','dte','rate','spot'].forEach(id => {
  document.getElementById(id).addEventListener('input', update);
});
update();

Step 5: Respond to User

After rendering the widget, briefly explain:

  1. What strategy was detected and how legs were mapped
  2. Max profit / max loss at current settings
  3. One key insight (e.g., "spot is currently 950 pts below the profit zone, expiring tomorrow")

Keep it concise — the chart speaks for itself.


Reference Files

  • references/strategies.md — Detailed payoff formulas and edge cases for each strategy type
  • references/bs_code.md — Copy-paste ready Black-Scholes JS implementation with normCDF

Read the relevant reference file if you're unsure about payoff formula edge cases for a given strategy.

1---
2name: options-payoff
3description: >
4 Generate an interactive options payoff curve chart with dynamic parameter controls.
5 Use this skill whenever the user shares an options position screenshot, describes an options strategy,
6 or asks to visualize how an options trade makes or loses money. Triggers include: any mention of
7 butterfly, spread (vertical/calendar/diagonal/ratio), straddle, strangle, condor, covered call,
8 protective put, iron condor, or any multi-leg options structure. Also triggers when a user pastes
9 strike prices, premiums, expiry dates, or says things like "show me the payoff", "draw the P&L curve",
10 "what does this trade look like", or uploads a screenshot from a broker (IBKR, TastyTrade, Robinhood, etc).
11 Always use this skill even if the user only provides partial info — extract what you can and use defaults for the rest.
12---
13 
14# Options Payoff Curve Skill
15 
16Generates a fully interactive HTML widget (via `visualize:show_widget`) showing:
17- **Expiry payoff curve** (dashed gray line) — intrinsic value at expiration
18- **Theoretical value curve** (solid colored line) — Black-Scholes price at current DTE/IV
19- Dynamic sliders for all key parameters
20- Real-time stats: max profit, max loss, breakevens, current P&L at spot
21 
22---
23 
24## Step 1: Extract Strategy From User Input
25 
26When the user provides a screenshot or text, extract:
27 
28| Field | Where to find it | Default if missing |
29|---|---|---|
30| Strategy type | Title bar / leg description | "custom" |
31| Underlying | Ticker symbol | SPX |
32| Strike(s) | K1, K2, K3... in title or leg table | nearest round number |
33| Premium paid/received | Filled price or avg price | 5.00 |
34| Quantity | Position size | 1 |
35| Multiplier | 100 for equity options, 100 for SPX | 100 |
36| Expiry | Date in title | 30 DTE |
37| Spot price | Current underlying price (NOT strike) | middle strike |
38| IV | Shown in greeks panel, or estimate from vega | 20% |
39| Risk-free rate | — | 4.3% |
40 
41**Critical for screenshots**: The spot price is the CURRENT price of the underlying index/stock, NOT the strikes. Never default spot to a strike price value.
42 
43**Current SPX reference price:**
44```
45!`python3 -c "exec('try:\n import yfinance as yf\n p=yf.Ticker(\'^GSPC\').fast_info[\'lastPrice\']\n print(f\'SPX ≈ {p:.0f}\')\nexcept Exception:\n print(\'SPX price unavailable — check market data\')')"`
46```
47 
48---
49 
50## Step 2: Identify Strategy Type
51 
52Match to one of the supported strategies below, then read the corresponding section in `references/strategies.md`.
53 
54| Strategy | Legs | Key Identifiers |
55|---|---|---|
56| **butterfly** | Buy K1, Sell 2×K2, Buy K3 | 3 strikes, "Butterfly" in title |
57| **vertical_spread** | Buy K1, Sell K2 (same expiry) | 2 strikes, debit or credit |
58| **calendar_spread** | Buy far-expiry K, Sell near-expiry K | Same strike, 2 expiries |
59| **iron_condor** | Sell K2/K3, Buy K1/K4 wings | 4 strikes, 2 spreads |
60| **straddle** | Buy Call K + Buy Put K | Same strike, both types |
61| **strangle** | Buy OTM Call + Buy OTM Put | 2 strikes, both OTM |
62| **covered_call** | Long 100 shares + Sell Call K | Stock + short call |
63| **naked_put** | Sell Put K | Single leg |
64| **ratio_spread** | Buy 1×K1, Sell N×K2 | Unequal quantities |
65 
66For strategies not listed, use `custom` mode: decompose into individual legs and sum their P&Ls.
67 
68---
69 
70## Step 3: Compute Payoffs
71 
72### Black-Scholes Put Price
73```
74d1 = (ln(S/K) + (r + σ²/2)·T) / (σ·√T)
75d2 = d1 - σ·√T
76put = K·e^(-rT)·N(-d2) - S·N(-d1)
77```
78 
79### Black-Scholes Call Price (via put-call parity)
80```
81call = put + S - K·e^(-rT)
82```
83 
84### Butterfly Put Payoff (expiry)
85```
86if S >= K3: 0
87if S >= K2: K3 - S
88if S >= K1: S - K1
89else: 0
90```
91Net P&L per share = payoff − premium_paid
92 
93### Vertical Spread (call debit) Payoff (expiry)
94```
95long_call = max(S - K1, 0)
96short_call = max(S - K2, 0)
97payoff = long_call - short_call - net_debit
98```
99 
100### Calendar Spread Theoretical Value
101Calendar cannot be expressed as a simple expiry function — always use BS pricing for both legs:
102```
103value = BS(S, K, T_far, r, IV_far) - BS(S, K, T_near, r, IV_near)
104```
105For expiry curve of calendar: near leg expires worthless, far leg = BS with remaining T.
106 
107### Iron Condor Payoff (expiry)
108```
109put_spread = max(K2-S, 0) - max(K1-S, 0) // short put spread
110call_spread = max(S-K3, 0) - max(S-K4, 0) // short call spread
111payoff = credit_received - put_spread - call_spread
112```
113 
114---
115 
116## Step 4: Render the Widget
117 
118Use `visualize:read_me` with modules `["chart", "interactive"]` before building.
119 
120### Required Controls (sliders)
121 
122**Structure section:**
123- All strike prices (K1, K2, K3... as needed by strategy)
124- Premium paid/received
125- Quantity
126- Multiplier (100 default, show for clarity)
127 
128**Pricing variables section:**
129- IV % (5–80%, step 0.5)
130- DTE — days to expiry (0–90)
131- Risk-free rate % (0–8%)
132 
133**Spot price:**
134- Full-width slider, range = [min_strike - 20%, max_strike + 20%], defaulting to ACTUAL current spot
135 
136### Required Stats Cards (live-updating)
137- Max profit (expiry)
138- Max loss (expiry)
139- Breakeven(s) — show both for two-sided strategies
140- Current theoretical P&L at spot
141 
142### Chart Specs
143- X-axis: SPX/underlying price
144- Y-axis: Total USD P&L (not per-share)
145- Blue solid line = theoretical value at current DTE/IV
146- Gray dashed line = expiry payoff
147- Green dashed vertical = strike prices (K2 center strike brighter)
148- Amber dashed vertical = current spot price
149- Fill above zero = green 10% opacity; below zero = red 10% opacity
150- Tooltip: show both curves on hover
151 
152### Code template
153 
154Use this JS structure inside the widget, adapting `pnlExpiry()` and `bfTheory()` per strategy:
155 
156```js
157// Black-Scholes helpers (always include)
158function normCDF(x) { /* Horner approximation */ }
159function bsCall(S,K,T,r,sig) { /* standard BS call */ }
160function bsPut(S,K,T,r,sig) { /* standard BS put */ }
161 
162// Strategy-specific expiry payoff (returns per-share value BEFORE premium)
163function expiryValue(S, ...strikes) { ... }
164 
165// Strategy-specific theoretical value using BS
166function theoreticalValue(S, ...strikes, T, r, iv) { ... }
167 
168// Main update() reads all sliders, computes arrays, destroys+recreates Chart.js instance
169function update() { ... }
170 
171// Attach listeners
172['k1','k2',...,'iv','dte','rate','spot'].forEach(id => {
173 document.getElementById(id).addEventListener('input', update);
174});
175update();
176```
177 
178---
179 
180## Step 5: Respond to User
181 
182After rendering the widget, briefly explain:
1831. What strategy was detected and how legs were mapped
1842. Max profit / max loss at current settings
1853. One key insight (e.g., "spot is currently 950 pts below the profit zone, expiring tomorrow")
186 
187Keep it concise — the chart speaks for itself.
188 
189---
190 
191## Reference Files
192 
193- `references/strategies.md` — Detailed payoff formulas and edge cases for each strategy type
194- `references/bs_code.md` — Copy-paste ready Black-Scholes JS implementation with normCDF
195 
196Read the relevant reference file if you're unsure about payoff formula edge cases for a given strategy.
197 

Discussion