Polymarket Profile
runesleo/polymarket-toolkit
Polymarket address profiler — input any 0x address, get a complete trading profile with PnL, win rate, positions, category breakdown, and top trades.
Option P&L analysis methodology: payoff diagrams, breakeven calculation, multi-leg strategy visualization, and Greeks-based scenario analysis.
$ npx skills add HKUDS/Vibe-Trading --skill options-payoff -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install HKUDS/Vibe-Trading options-payoff --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agent/src/skills/options-payoff .claude/skills/options-payoff && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "options-payoff" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/options-payoff into .claude/skills/options-payoff/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "options-payoff", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/options-payoffType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add HKUDS/Vibe-Trading --skill options-payoff -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install HKUDS/Vibe-Trading options-payoff --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .agents/skills && cp -r skills-src/agent/src/skills/options-payoff .agents/skills/options-payoff && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "options-payoff" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/options-payoff into .agents/skills/options-payoff/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "options-payoff", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add HKUDS/Vibe-Trading --skill options-payoff -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install HKUDS/Vibe-Trading options-payoff --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/agent/src/skills/options-payoff .cursor/skills/options-payoff && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "options-payoff" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/options-payoff into .cursor/skills/options-payoff/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "options-payoff", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/HKUDS/Vibe-Trading.git --path agent/src/skills/options-payoff--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add HKUDS/Vibe-Trading --skill options-payoff -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install HKUDS/Vibe-Trading options-payoff --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/agent/src/skills/options-payoff .gemini/skills/options-payoff && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "options-payoff" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/options-payoff into .gemini/skills/options-payoff/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "options-payoff", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install HKUDS/Vibe-Trading options-payoffInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add HKUDS/Vibe-Trading --skill options-payoff -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .github/skills && cp -r skills-src/agent/src/skills/options-payoff .github/skills/options-payoff && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "options-payoff" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/options-payoff into .github/skills/options-payoff/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "options-payoff", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add HKUDS/Vibe-Trading --skill options-payoff -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install HKUDS/Vibe-Trading options-payoff --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/agent/src/skills/options-payoff .opencode/skills/options-payoff && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "options-payoff" agent skill from https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/options-payoff into .opencode/skills/options-payoff/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "options-payoff", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
options-payoffOption P&L analysis methodology: payoff diagrams, breakeven calculation, multi-leg strategy visualization, and Greeks-based scenario analysis.
Options Payoff is an agent skill from HKUDS/Vibe-Trading. Option P&L analysis methodology: payoff diagrams, breakeven calculation, multi-leg strategy visualization, and Greeks-based scenario analysis.
Its SKILL.md is about 6.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Business, Finance & HR, covering Diagrams and Trading and backtesting. The repository describes itself as: "Vibe-Trading: Your Personal Trading Agent". The licence is MIT.
5 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit e532650. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are python).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Options Payoff loads about 6.8k tokens when it runs. Until then it costs about 39 tokens; SKILL.md has 1,633 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from HKUDS/Vibe-Trading at commit e532650, republished under its MIT licence (© HKUDS). 1,633 words, ~6,850 tokens.
.claude/skills/options-payoff/SKILL.md (or your agent's skills folder).This skill is designed for option strategy analysis scenarios within the Vibe-Trading quantitative framework, covering:
Constraint: For research and backtesting only. Do not output live trading instructions, in line with the project's guardrails.
Load this skill for methodology, then call options_payoff for production
calculations. Pass signed legs (qty > 0 long, qty < 0 short),
entry_spot, and expiry_days; optionally pass actual per-share premiums,
multiplier, commission, chart bounds, and IV scenarios. The tool returns an
expiry curve, a spot × IV scenario matrix, and analytic breakeven/max-risk
results that do not depend on the display grid containing every strike.
| Strategy | Bias | Premium | Max Profit | Max Loss |
|---|---|---|---|---|
| Long Call | Bullish | Paid | Unlimited | Premium |
| Long Put | Bearish | Paid | Strike - premium | Premium |
| Short Call | Neutral / mildly bearish | Received | Premium | Unlimited |
| Short Put | Neutral / mildly bullish | Received | Premium | Strike - premium |
| Strategy | Structure | Market View | Net Premium |
|---|---|---|---|
| Bull Call Spread | Long Call (lower K) + Short Call (higher K) | Moderately bullish | Net debit |
| Bear Put Spread | Long Put (higher K) + Short Put (lower K) | Moderately bearish | Net debit |
| Bull Put Spread | Short Put (higher K) + Long Put (lower K) | Moderately bullish | Net credit |
| Bear Call Spread | Short Call (lower K) + Long Call (higher K) | Moderately bearish | Net credit |
| Strategy | Structure | Market View |
|---|---|---|
| Long Straddle | Long Call (ATM) + Long Put (ATM) | Large move up or down, low volatility |
| Short Straddle | Short Call (ATM) + Short Put (ATM) | Range-bound market, high volatility |
| Long Strangle | Long Call (OTM) + Long Put (OTM) | Large move, lower cost than a straddle |
| Short Strangle | Short Call (OTM) + Short Put (OTM) | Tight range, collect two-sided premium |
| Strategy | Structure | Feature |
|---|---|---|
| Long Butterfly (Call) | Long Call (K1) + 2× Short Call (K2) + Long Call (K3) | Low-cost bet that the underlying expires near K2 |
| Long Butterfly (Put) | Long Put (K3) + 2× Short Put (K2) + Long Put (K1) | Same logic, built with puts |
| Iron Butterfly | Short Call (K2) + Short Put (K2) + Long Call (K3) + Long Put (K1) | Net credit, max profit at K2 |
| Strategy | Structure | Feature |
|---|---|---|
| Long Condor (Call) | Long Call (K1) + Short Call (K2) + Short Call (K3) + Long Call (K4) | Bet that the underlying stays between K2 and K3 |
| Iron Condor | Short Put (K2) + Long Put (K1) + Short Call (K3) + Long Call (K4) | Most common neutral strategy with capped risk on both sides |
Here K1 < K2 < K3 < K4, and K2 / K3 are usually OTM.
| Strategy | Structure | Market View |
|---|---|---|
| Calendar Spread | Short near-month Call/Put (K) + Long far-month Call/Put (K) | Short-term range-bound market + rising forward volatility |
| Diagonal Spread | Short near-month Call/Put (K1) + Long far-month Call/Put (K2) | Calendar spread with mild directional bias |
Calendar spreads profit because near-month Theta decay is faster than far-month Theta decay.
| Strategy | Structure | Feature |
|---|---|---|
| Ratio Call Spread | Long 1× Call (K1) + Short N× Call (K2), N>1 | Limited upside profit, losses if the upside move becomes extreme |
| Ratio Put Spread | Long 1× Put (K2) + Short N× Put (K1) | Limited downside profit, losses if the downside move becomes extreme |
| Call Back Spread | Short 1× Call (K1) + Long N× Call (K2), N>1 | Profits from extreme upside, loses on a modest rally |
| Put Back Spread | Short 1× Put (K2) + Long N× Put (K1), N>1 | Profits from extreme downside, loses on a mild decline |
| Strategy | Structure | Use Case |
|---|---|---|
| Covered Call | Long underlying + Short Call (K) | Generate income on an existing position, give up gains above K |
| Protective Put | Long underlying + Long Put (K) | Downside protection on an existing position, pay an insurance premium |
| Collar | Long underlying + Long Put (K1) + Short Call (K2) | Lock the position into a zero-cost / low-cost range |
r is constantσ is constant (historical or implied)qS = current underlying price
K = strike price
T = time to expiration (years)
r = risk-free rate (annualized continuous compounding)
q = continuous dividend yield (commonly used for China A-share / index options)
σ = annualized volatility
N = standard normal CDF
d1 = [ln(S/K) + (r - q + σ²/2) × T] / (σ × √T)
d2 = d1 - σ × √T
Call = S × e^(-qT) × N(d1) - K × e^(-rT) × N(d2)
Put = K × e^(-rT) × N(-d2) - S × e^(-qT) × N(-d1)Call - Put = S × e^(-qT) - K × e^(-rT)Use this to verify pricing consistency and detect arbitrage. When dividends exist, replace S with S × e^(-qT).
Delta(Call) = e^(-qT) × N(d1)
Delta(Put) = e^(-qT) × (N(d1) - 1)Gamma = e^(-qT) × N'(d1) / (S × σ × √T)
N'(x) = (1/√(2π)) × e^(-x²/2) [standard normal PDF]Theta(Call) = [-S × e^(-qT) × N'(d1) × σ / (2√T)
- r × K × e^(-rT) × N(d2)
+ q × S × e^(-qT) × N(d1)] / 365
Theta(Put) = [-S × e^(-qT) × N'(d1) × σ / (2√T)
+ r × K × e^(-rT) × N(-d2)
- q × S × e^(-qT) × N(-d1)] / 365Vega = S × e^(-qT) × N'(d1) × √T / 100Rho(Call) = K × T × e^(-rT) × N(d2) / 100
Rho(Put) = -K × T × e^(-rT) × N(-d2) / 100Given a market price P_market, solve for σ such that BS(σ) = P_market:
Iteration:
σ_{n+1} = σ_n - [BS(σ_n) - P_market] / Vega(σ_n)
Stopping condition: |BS(σ_n) - P_market| < 1e-6
Initial guess:
σ_0 = √(2π/T) × P_market/S (Brenner-Subrahmanyam approximation)
Notes:
- If Vega is close to 0 (deep OTM / ITM), switch to bisection
- If the iteration does not converge (>100 rounds), return NaN and raise a warning
- IV > 500% is usually an outlier and should be filteredThis is already implemented, guards included, as
src.quantlib.options.implied_volatility — see section 4.1. The formulas above
document what it computes; they are not an instruction to rewrite it.
Calculation logic:
For each leg i (Call/Put, Long/Short, strike K_i, quantity n_i):
Payoff_i(S_T) = n_i × direction_i × max(0, S_T - K_i) # Call
Payoff_i(S_T) = n_i × direction_i × max(0, K_i - S_T) # Put
Where direction = +1 (Long) / -1 (Short)
Portfolio payoff = Σ Payoff_i - net premium cost
(paid premium is positive, received premium is negative)X-axis range: [min(K) × 0.7, max(K) × 1.3], step size 0.5 or 1
For each underlying price S, hold T, r, and σ constant and compute current theoretical PnL using the Black-Scholes formula:
TheoValue(S) = Σ n_i × direction_i × BS_price(S, K_i, T, r, σ, type_i) - net premium costThe gap between the theoretical value curve and the expiry curve equals the remaining time value.
Expiry payoff is piecewise linear. Solve Payoff(S_T) = 0 on intervals formed
by S=0, every unique strike, and the right tail. Do not search only the chart
grid: a narrow grid can miss a valid root beyond its bounds.
Evaluate payoff at S=0 and every unique strike. Those are all finite points
where slope can change, so finite extrema occur in that set. Then inspect the
right-tail slope: positive means unlimited profit, negative means unlimited
loss, and zero means the payoff remains flat. Never derive max profit/loss only
from sampled chart points.
Generate a σ scenario matrix using current IV × [0.5, 0.75, 1.0, 1.25, 1.5].
Plot one theoretical value curve for each σ and distinguish them by color to observe Vega sensitivity.
bs_price, bs_greeks and implied_volatility are implemented once in
src/quantlib/options.py and pinned by tests/quantlib/test_options.py
(published Hull reference values, put-call parity, Greeks against
finite-difference bumps, implied-vol round-trips). Import them.
Do not retype the formulas from section 2 into your own helper. A retyped copy is a different, untested function on every run, and the copies that used to live here had two live defects: they crashed on a non-positive spot or strike, and they reported a zero Delta for an expiring in-the-money option.
from src.quantlib.options import bs_greeks, bs_price, implied_volatility
price = bs_price(S=100, K=100, T=0.25, r=0.03, sigma=0.20, option_type="call", q=0.0)
greeks = bs_greeks(100, 100, 0.25, 0.03, 0.20, "call") # delta gamma theta vega rho
iv = implied_volatility(market_price=5.0, S=100, K=100, T=0.25, r=0.03, option_type="call")Argument order is (S, K, T, r, sigma, option_type="call", q=0.0) for both
pricing functions; implied_volatility takes market_price first, then
(S, K, T, r, option_type="call", q=0.0, tol=1e-6, max_iter=200).
Contract worth knowing before you use the numbers:
| Point | Behaviour |
|---|---|
| Units | Theta per calendar day; Vega and Rho per 1 percentage point; Delta and Gamma per 1.0 of spot. Nothing is rounded |
option_type | Case-insensitive; anything other than call/put raises ValueError |
| Degenerate input | T <= 0, sigma <= 0, S <= 0 or K <= 0 returns intrinsic value, and Greeks with the correct ±1/0 point-mass Delta — it does not raise |
| IV lower guard | Raises ValueError below the discounted forward intrinsic. Using undiscounted K - S instead would wrongly reject deep ITM European puts, which really do trade below it |
| IV upper guard | Raises ValueError at or above the no-arbitrage ceiling (S·e^(-qT) for a call, K·e^(-rT) for a put) — no volatility reaches it |
| IV failure | Newton seeded by Brenner-Subrahmanyam, falling back to bisection when Vega collapses; returns nan only if neither converges |
from dataclasses import dataclass
from typing import Literal
import numpy as np
from scipy.optimize import brentq
from src.quantlib.options import bs_price
@dataclass
class OptionLeg:
"""Single option leg definition.
Attributes:
option_type: "call" or "put"
K: Strike price
direction: +1 for Long / -1 for Short
quantity: Number of contracts, defaults to 1
premium: Actual traded premium, positive when paid and negative when received
T: Time to expiration in years, used for theoretical Black-Scholes pricing
sigma: Volatility used in pricing
"""
option_type: Literal["call", "put"]
K: float
direction: int # +1 or -1
quantity: float = 1.0
premium: float = 0.0
T: float = 0.25
sigma: float = 0.20
def compute_expiry_payoff(
legs: list[OptionLeg],
S_range: np.ndarray,
) -> np.ndarray:
"""Calculate the expiry payoff curve.
Args:
legs: Option legs
S_range: Array of underlying prices
Returns:
Payoff array aligned with S_range, including premium cost
"""
total_payoff = np.zeros(len(S_range))
net_premium = sum(leg.direction * leg.quantity * leg.premium for leg in legs)
for leg in legs:
if leg.option_type == "call":
intrinsic = np.maximum(S_range - leg.K, 0)
else:
intrinsic = np.maximum(leg.K - S_range, 0)
total_payoff += leg.direction * leg.quantity * intrinsic
return total_payoff - net_premium
def compute_theo_value(
legs: list[OptionLeg],
S_range: np.ndarray,
r: float = 0.03,
q: float = 0.0,
) -> np.ndarray:
"""Calculate the theoretical value curve under current Black-Scholes pricing.
Args:
legs: Option legs, each carrying T and sigma
S_range: Array of underlying prices
r: Risk-free rate
q: Continuous dividend yield
Returns:
Theoretical PnL array
"""
total_value = np.zeros(len(S_range))
net_premium = sum(leg.direction * leg.quantity * leg.premium for leg in legs)
for leg in legs:
prices = np.array([
bs_price(S, leg.K, leg.T, r, leg.sigma, leg.option_type, q)
for S in S_range
])
total_value += leg.direction * leg.quantity * prices
return total_value - net_premium
def find_breakeven_points(
S_range: np.ndarray,
payoff: np.ndarray,
) -> list[float]:
"""Solve for break-even points numerically.
Returns:
A list of break-even points, from 0 to many depending on the structure
"""
beps = []
for i in range(len(S_range) - 1):
if payoff[i] * payoff[i + 1] < 0:
bep = brentq(
lambda s: np.interp(s, S_range, payoff),
S_range[i], S_range[i + 1],
xtol=0.01
)
beps.append(round(bep, 2))
return bepsimport matplotlib.pyplot as plt
import matplotlib.ticker as mticker
def plot_payoff_diagram(
legs: list[OptionLeg],
S_current: float,
r: float = 0.03,
q: float = 0.0,
title: str = "Option Payoff Diagram",
figsize: tuple = (10, 6),
) -> plt.Figure:
"""Plot the payoff diagram for an option portfolio.
Args:
legs: Option legs
S_current: Current underlying price
r: Risk-free rate
q: Continuous dividend yield
title: Chart title
figsize: Figure size
Returns:
A matplotlib Figure object
"""
K_values = [leg.K for leg in legs]
S_lo = min(K_values) * 0.70
S_hi = max(K_values) * 1.30
S_range = np.linspace(S_lo, S_hi, 500)
expiry_pnl = compute_expiry_payoff(legs, S_range)
theo_pnl = compute_theo_value(legs, S_range, r, q)
beps = find_breakeven_points(S_range, expiry_pnl)
fig, ax = plt.subplots(figsize=figsize)
# Shade profit and loss regions.
ax.fill_between(S_range, expiry_pnl, 0,
where=(expiry_pnl >= 0), alpha=0.15, color="green", label="_nolegend_")
ax.fill_between(S_range, expiry_pnl, 0,
where=(expiry_pnl < 0), alpha=0.15, color="red", label="_nolegend_")
# Expiry payoff curve.
ax.plot(S_range, expiry_pnl, color="steelblue", linewidth=2.0, label="Expiry P&L")
# Theoretical value curve.
ax.plot(S_range, theo_pnl, color="darkorange", linewidth=1.5,
linestyle="--", label="Current theoretical value")
# Zero axis.
ax.axhline(0, color="black", linewidth=0.8, linestyle="-")
# Current price line.
ax.axvline(S_current, color="gray", linewidth=1.0, linestyle=":",
label=f"Spot {S_current:.2f}")
# Strike annotations.
for K in K_values:
ax.axvline(K, color="purple", linewidth=0.6, linestyle="--", alpha=0.5)
ax.text(K, ax.get_ylim()[0], f"K={K}", fontsize=8,
rotation=90, va="bottom", color="purple")
# Break-even points.
for bep in beps:
ax.scatter([bep], [0], color="red", zorder=5, s=50)
ax.annotate(f"BEP\n{bep:.2f}", xy=(bep, 0),
xytext=(bep, max(expiry_pnl) * 0.15),
fontsize=8, ha="center", color="red",
arrowprops=dict(arrowstyle="->", color="red", lw=0.8))
# Max profit / max loss summary.
max_p = max(expiry_pnl)
max_l = min(expiry_pnl)
stats_text = (
f"Max profit: {'Unlimited' if max_p > 1e6 else f'{max_p:.2f}'}\n"
f"Max loss: {'Unlimited' if max_l < -1e6 else f'{max_l:.2f}'}\n"
f"Break-even: {', '.join([str(b) for b in beps]) if beps else 'None'}"
)
ax.text(0.02, 0.97, stats_text, transform=ax.transAxes,
fontsize=9, va="top", bbox=dict(boxstyle="round", fc="white", alpha=0.8))
ax.set_xlabel("Underlying price")
ax.set_ylabel("P&L")
ax.set_title(title)
ax.legend(loc="upper right")
ax.yaxis.set_major_formatter(mticker.FuncFormatter(lambda x, _: f"{x:,.0f}"))
ax.grid(True, alpha=0.3)
plt.tight_layout()
return figimport plotly.graph_objects as go
def plot_payoff_plotly(
legs: list[OptionLeg],
S_current: float,
r: float = 0.03,
q: float = 0.0,
title: str = "Option Payoff Diagram",
sigma_scenarios: list[float] | None = None,
) -> go.Figure:
"""Generate a Plotly interactive payoff diagram with optional multi-sigma scenarios.
Args:
sigma_scenarios: For example [0.10, 0.15, 0.20, 0.25, 0.30].
If None, use each leg's own sigma.
"""
K_values = [leg.K for leg in legs]
S_range = np.linspace(min(K_values) * 0.70, max(K_values) * 1.30, 500)
expiry_pnl = compute_expiry_payoff(legs, S_range)
fig = go.Figure()
# Expiry payoff.
fig.add_trace(go.Scatter(
x=S_range, y=expiry_pnl,
name="Expiry P&L", line=dict(color="steelblue", width=2),
fill="tozeroy",
fillcolor="rgba(70,130,180,0.1)",
))
# Theoretical value under multiple volatility scenarios.
if sigma_scenarios:
colors = ["#FF6B6B", "#FFA500", "#4CAF50", "#2196F3", "#9C27B0"]
for i, sigma in enumerate(sigma_scenarios):
scenario_legs = [
OptionLeg(
option_type=leg.option_type, K=leg.K,
direction=leg.direction, quantity=leg.quantity,
premium=leg.premium, T=leg.T, sigma=sigma
)
for leg in legs
]
theo = compute_theo_value(scenario_legs, S_range, r, q)
fig.add_trace(go.Scatter(
x=S_range, y=theo,
name=f"IV={sigma*100:.0f}%",
line=dict(color=colors[i % len(colors)], width=1.5, dash="dash"),
))
else:
theo_pnl = compute_theo_value(legs, S_range, r, q)
fig.add_trace(go.Scatter(
x=S_range, y=theo_pnl,
name="Current theoretical value",
line=dict(color="darkorange", width=1.5, dash="dash"),
))
# Zero line and current price line.
fig.add_hline(y=0, line_dash="solid", line_color="black", line_width=0.8)
fig.add_vline(x=S_current, line_dash="dot", line_color="gray",
annotation_text=f"Spot {S_current:.2f}", annotation_position="top right")
# Strikes.
for K in set(K_values):
fig.add_vline(x=K, line_dash="dash", line_color="purple",
line_width=0.8, opacity=0.5)
fig.update_layout(
title=title,
xaxis_title="Underlying price",
yaxis_title="P&L",
hovermode="x unified",
template="plotly_white",
legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="right", x=1),
)
return figfrom src.quantlib.options import bs_greeks
def plot_greeks_profile(
legs: list[OptionLeg],
S_current: float,
r: float = 0.03,
q: float = 0.0,
greeks_to_plot: list[str] | None = None,
) -> go.Figure:
"""Plot portfolio Greeks as functions of the underlying price.
Args:
greeks_to_plot: Defaults to ["delta", "gamma", "vega", "theta"]
"""
if greeks_to_plot is None:
greeks_to_plot = ["delta", "gamma", "vega", "theta"]
K_values = [leg.K for leg in legs]
S_range = np.linspace(min(K_values) * 0.70, max(K_values) * 1.30, 300)
# Compute portfolio Greeks.
greek_values = {g: np.zeros(len(S_range)) for g in greeks_to_plot}
for leg in legs:
for j, S in enumerate(S_range):
g = bs_greeks(S, leg.K, leg.T, r, leg.sigma, leg.option_type, q)
for name in greeks_to_plot:
greek_values[name][j] += leg.direction * leg.quantity * g[name]
# Plot subplots.
from plotly.subplots import make_subplots
n = len(greeks_to_plot)
fig = make_subplots(rows=n, cols=1, shared_xaxes=True,
subplot_titles=[g.capitalize() for g in greeks_to_plot])
greek_colors = {"delta": "steelblue", "gamma": "green",
"theta": "red", "vega": "darkorange", "rho": "purple"}
for i, name in enumerate(greeks_to_plot, start=1):
fig.add_trace(
go.Scatter(x=S_range, y=greek_values[name],
name=name.capitalize(),
line=dict(color=greek_colors.get(name, "gray"), width=2)),
row=i, col=1
)
fig.add_hline(y=0, line_dash="dot", line_color="black",
line_width=0.5, row=i, col=1)
fig.add_vline(x=S_current, line_dash="dash", line_color="gray",
line_width=0.8, row=i, col=1)
fig.update_layout(
title="Greeks Profile",
height=200 * n,
showlegend=False,
template="plotly_white",
)
return figMarket view
├── Strongly bullish
│ ├── Willing to pay premium → Long Call
│ └── Want lower cost → Bull Call Spread
├── Moderately bullish
│ ├── Already hold the underlying → Covered Call (income enhancement)
│ └── No existing position → Bull Put Spread (net credit)
├── Moderately bearish
│ ├── Already hold the underlying → Protective Put or Collar
│ └── No existing position → Bear Call Spread (net credit)
├── Strongly bearish
│ ├── Willing to pay premium → Long Put
│ └── Want lower cost → Bear Put Spread
├── Range-bound market (low-IV environment)
│ ├── Wide range → Short Strangle
│ ├── Narrow range → Short Straddle
│ └── Want limited risk → Iron Condor / Iron Butterfly
└── Large move expected (low-IV environment)
├── Direction unclear → Long Straddle / Long Strangle
└── Slight directional bias → Call / Put Back Spread| IV Regime | Rule of Thumb | Suitable Strategies | Strategies to Avoid |
|---|---|---|---|
| Low IV (< 20th percentile) | IV Rank < 20 | Long Straddle, Long Strangle, Back Spread | Short strategies, because premium is too thin |
| Normal IV (20th to 80th percentile) | IV Rank 20 to 80 | Vertical spreads, Calendar Spread, Diagonal | Single-leg positions with asymmetric risk |
| High IV (> 80th percentile) | IV Rank > 80 | Short Straddle, Iron Condor, Covered Call | Long single-leg options due to rich premium |
IV Rank formula:
iv_rank = (current_iv - iv_52w_low) / (iv_52w_high - iv_52w_low) * 100IV Percentile: The historical percentile rank of current IV over the last 252 trading days.
Iron Condor gets breached:
Underlying rallies above the short call:
1. Close the call spread and realize the loss
2. Reassess directional view:
- Still bullish → reopen a higher put spread to preserve neutrality
- Not bullish → close the entire portfolioCovered Call faces assignment risk:
Underlying approaches the call strike:
1. Assess whether you are willing to sell the underlying at that price
- Yes → allow assignment and keep premium + capital gain
- No → Roll Up & Out to a higher strike and/or later expirationfrom src.quantlib.options import implied_volatility
# Example: Iron Condor payoff diagram
legs = [
OptionLeg("put", K=90, direction=-1, premium=1.5, T=0.083, sigma=0.20),
OptionLeg("put", K=85, direction=+1, premium=0.5, T=0.083, sigma=0.20),
OptionLeg("call", K=110, direction=-1, premium=1.5, T=0.083, sigma=0.20),
OptionLeg("call", K=115, direction=+1, premium=0.5, T=0.083, sigma=0.20),
]
fig = plot_payoff_plotly(
legs, S_current=100.0,
title="Iron Condor (85/90/110/115, 1 month)",
sigma_scenarios=[0.15, 0.20, 0.25, 0.30],
)
fig.show()
# Implied volatility example
iv = implied_volatility(
market_price=5.0, S=100, K=100,
T=0.25, r=0.03, option_type="call"
)
print(f"Implied volatility: {iv:.2%}") # 23.25%© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in agent/src/skills/options-payoff of HKUDS/Vibe-Trading.
Open the folder on GitHubat commit e532650
Options Payoff next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Options Payoff this skillHKUDS/Vibe-Trading | 35k | — | ~6.8k | Automated safety check: Pass | MIT | |
| Polymarket Profilerunesleo/polymarket-toolkit | 194 | — | ~3.7k | Automated safety check: Pass | MIT | |
| Longbridge Market Datasickn33/agentic-awesome-skills | 47k | 1 repos | ~1.7k | Automated safety check: Pass | MIT | |
| Doca Flow TuneNVIDIA/skills | 3.5k | — | ~4.8k | Automated safety check: Pass | Apache-2.0 | |
| Tushare Datazillionare/zillionare | 321 | 2 repos | ~2.3k | Automated safety check: Pass | None | |
| Tradingview MCPatilaahmettaner/tradingview-mcp | 5k | — | ~1.3k | Automated safety check: Pass | MIT |
runesleo/polymarket-toolkit
Polymarket address profiler — input any 0x address, get a complete trading profile with PnL, win rate, positions, category breakdown, and top trades.
sickn33/agentic-awesome-skills
Real-time quotes, K-line charts, order book, trade ticks, intraday capital flow, market sentiment temperature, trading session schedule, security lists, exchange rates, and IPO calendar for…
NVIDIA/skills
A skill your agent uses when the user is tuning a live or captured doca-flow pipeline with docaflowtune — snapshotting pipe / counter / KPI state, picking a tuning axis (rule placement, resource…
zillionare/zillionare
面向中文自然语言的 Tushare 数据研究技能。用于把“看看这只股票最近怎么样”“帮我查财报趋势”“最近哪个板块最强”“北向资金在买什么”“给我导出一份行情数据”这类请求,转成可执行的数据获取、清洗、对比、筛选、导出与简要分析流程。适用于 A 股、指数、ETF/基金、财务、估值、资金流、公告新闻、板块概念与宏观数据等研究场景。
atilaahmettaner/tradingview-mcp
AI Trading Intelligence — live prices, 30+ technical indicators, backtesting (6 strategies), walk-forward overfitting detection, trade logs, equity curves, licensed news sentiment (Marketaux), and…
komako-workshop/digital-oracle
Answer prediction questions using market trading data, not opinions.
HKUDS/Vibe-Trading
Index of Eastmoney's free, no-token market data interfaces for China A-shares and Hong Kong stocks: fund flows, dragon-tiger lists, margin trading, reports and news.
HKUDS/Vibe-Trading
Retrieves public OKX cryptocurrency market data such as spot prices, candlesticks, funding rates and open interest through the OKX V5 REST API, with no authentication.
HKUDS/Vibe-Trading
Fetches U.S. SEC EDGAR data: resolves tickers to CIK numbers, lists recent 10-K, 10-Q and 8-K filings with document URLs, and pulls XBRL financial series.
HKUDS/Vibe-Trading
Predicts whether a mainland China A-share company risks an ST or *ST warning after its next annual report, using financial thresholds and Sina penalty records.
HKUDS/Vibe-Trading
Breaks a structural trend such as AI infrastructure into its physical supply chain and ranks lesser-known listed companies sitting on each bottleneck.
HKUDS/Vibe-Trading
Plans and drafts an eight-part, roughly 120k-word investigative series on one company, built around a strict fact-check pass rather than fast drafting.
Categories
Option P&L analysis methodology: payoff diagrams, breakeven calculation, multi-leg strategy visualization, and Greeks-based scenario analysis. Options Payoff is an agent skill from HKUDS/Vibe-Trading. Option P&L analysis methodology: payoff diagrams, breakeven calculation, multi-leg strategy visualization, and Greeks-based scenario analysis.
Options Payoff fits situations like: tasks that involve Diagrams; tasks that involve Trading and backtesting.
Run `npx skills add HKUDS/Vibe-Trading --skill options-payoff -a claude-code`. Or copy the skill folder (agent/src/skills/options-payoff in HKUDS/Vibe-Trading) into .claude/skills/options-payoff in your project. Claude Code loads it when a task matches its description.
Run `npx skills add HKUDS/Vibe-Trading --skill options-payoff -a codex`. Or copy the skill folder (agent/src/skills/options-payoff in HKUDS/Vibe-Trading) into .agents/skills/options-payoff in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/Vibe-Trading --skill options-payoff -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/options-payoff, .gemini/skills/options-payoff, .github/skills/options-payoff and .opencode/skills/options-payoff in your project.
SKILL.md names no scripts, command-line tools or credentials: Options Payoff is instructions for the agent only. Our summary lists: Python 3.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Options Payoff is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 6.8k tokens (SKILL.md is roughly 27k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Options Payoff: Polymarket Profile (runesleo/polymarket-toolkit, 194 stars), Longbridge Market Data (sickn33/agentic-awesome-skills, 47k stars), Doca Flow Tune (NVIDIA/skills, 3.5k stars) and Tushare Data (zillionare/zillionare, 321 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
HKUDS (a GitHub organization) maintains it in HKUDS/Vibe-Trading, which has 35,043 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 8, 2026.
Source: HKUDS/Vibe-Trading on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.