期权收益分析_options-payoff

📅 2026/7/21 9:13:44
期权收益分析_options-payoff
以下为本文档的中文说明options-payoff 是一个专注于金融衍生品领域期权Options收益分析的专业计算与可视化技能。期权是金融市场中功能最丰富也最复杂的衍生工具之一其非线性的收益结构Payoff Profile分析对于交易策略的设计构建、投资组合的风险管理和金融工程的教学研究都至关重要。使用场景包括精确计算单个期权或由多个期权组合构建的策略如牛市/熊市垂直价差、跨式/宽跨式组合、蝶式/鹰式价差、铁秃鹰策略等在到期日的理论收益曲线将抽象的期权收益函数以直观的二维坐标图形式呈现清晰标注盈亏平衡点、最大收益/最大损失区域和损益结构特征在金融工程教学和投资者教育培训中生动演示买入看涨、买入看跌、卖出备兑开仓等基本策略和组合策略的收益风险特征对比。核心特点包括支持欧式看涨期权Call和看跌期权Put的基础收益数学计算收益 max(标的资产价格 - 行权价, 0) - 权利金看涨收益 max(行权价 - 标的资产价格, 0) - 权利金看跌提供单腿和多腿期权组合策略的收益公式精确计算包含期权的买卖方向和持仓数量权重能够根据用户输入的行权价Strike Price、权利金Premium、标的资产当前价格和预期价格范围等核心参数自动生成完整的收益矩阵数据表支持覆盖垂直价差Vertical Spread、日历价差Calendar Spread、跨式组合Straddle、宽跨式组合Strangle、蝶式价差Butterfly、铁鹰策略Iron Condor等几乎所有常见期权策略的分析输出格式化的数值表格和可视化图表为量化交易策略评估和风险管理决策提供清晰的数据支撑。Options Payoff Curve SkillGenerates a fully interactive HTML widget (viavisualize:show_widget) showing:Expiry payoff curve(dashed gray line) — intrinsic value at expirationTheoretical value curve(solid colored line) — Black-Scholes price at current DTE/IVDynamic sliders for all key parametersReal-time stats: max profit, max loss, breakevens, current PL at spotStep 1: Extract Strategy From User InputWhen the user provides a screenshot or text, extract:FieldWhere to find itDefault if missingStrategy typeTitle bar / leg description“custom”UnderlyingTicker symbolSPXStrike(s)K1, K2, K3… in title or leg tablenearest round numberPremium paid/receivedFilled price or avg price5.00QuantityPosition size1Multiplier100 for equity options, 100 for SPX100ExpiryDate in title30 DTESpot priceCurrent underlying price (NOT strike)middle strikeIVShown in greeks panel, or estimate from vega20%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 import yfinance as yf; print(fSPX ≈ {yf.Ticker(\\^GSPC\\).fast_info[\\lastPrice\\]:.0f}) 2/dev/null || echo SPX price unavailable — check market dataStep 2: Identify Strategy TypeMatch to one of the supported strategies below, then read the corresponding section inreferences/strategies.md.StrategyLegsKey IdentifiersbutterflyBuy K1, Sell 2×K2, Buy K33 strikes, “Butterfly” in titlevertical_spreadBuy K1, Sell K2 (same expiry)2 strikes, debit or creditcalendar_spreadBuy far-expiry K, Sell near-expiry KSame strike, 2 expiriesiron_condorSell K2/K3, Buy K1/K4 wings4 strikes, 2 spreadsstraddleBuy Call K Buy Put KSame strike, both typesstrangleBuy OTM Call Buy OTM Put2 strikes, both OTMcovered_callLong 100 shares Sell Call KStock short callnaked_putSell Put KSingle legratio_spreadBuy 1×K1, Sell N×K2Unequal quantitiesFor strategies not listed, usecustommode: decompose into individual legs and sum their PLs.Step 3: Compute PayoffsBlack-Scholes Put Priced1 (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: 0Net PL per share payoff − premium_paidVertical Spread (call debit) Payoff (expiry)long_call max(S - K1, 0) short_call max(S - K2, 0) payoff long_call - short_call - net_debitCalendar Spread Theoretical ValueCalendar 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_spreadStep 4: Render the WidgetUsevisualize:read_mewith modules[chart, interactive]before building.Required Controls (sliders)Structure section:All strike prices (K1, K2, K3… as needed by strategy)Premium paid/receivedQuantityMultiplier (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 spotRequired Stats Cards (live-updating)Max profit (expiry)Max loss (expiry)Breakeven(s) — show both for two-sided strategiesCurrent theoretical PL at spotChart SpecsX-axis: SPX/underlying priceY-axis: Total USD PL (not per-share)Blue solid line theoretical value at current DTE/IVGray dashed line expiry payoffGreen dashed vertical strike prices (K2 center strike brighter)Amber dashed vertical current spot priceFill above zero green 10% opacity; below zero red 10% opacityTooltip: show both curves on hoverCode templateUse this JS structure inside the widget, adaptingpnlExpiry()andbfTheory()per strategy:// Black-Scholes helpers (always include)functionnormCDF(x){/* Horner approximation */}functionbsCall(S,K,T,r,sig){/* standard BS call */}functionbsPut(S,K,T,r,sig){/* standard BS put */}// Strategy-specific expiry payoff (returns per-share value BEFORE premium)functionexpiryValue(S,...strikes){...}// Strategy-specific theoretical value using BSfunctiontheoreticalValue(S,...strikes,T,r,iv){...}// Main update() reads all sliders, computes arrays, destroysrecreates Chart.js instancefunctionupdate(){...}// Attach listeners[k1,k2,...,iv,dte,rate,spot].forEach(id{document.getElementById(id).addEventListener(input,update);});update();Step 5: Respond to UserAfter rendering the widget, briefly explain:What strategy was detected and how legs were mappedMax profit / max loss at current settingsOne key insight (e.g., “spot is currently 950 pts below the profit zone, expiring tomorrow”)Keep it concise — the chart speaks for itself.Reference Filesreferences/strategies.md— Detailed payoff formulas and edge cases for each strategy typereferences/bs_code.md— Copy-paste ready Black-Scholes JS implementation with normCDFRead the relevant reference file if you’re unsure about payoff formula edge cases for a given strategy.