Complete mathematical specification, calculation dictionary, and architectural guide for SOPHIE's Options Viewer across all three sub-tools: Option Chain & Matrix (spread %, liquidity score), Volatility Surface (forward IV, Breeden-Litzenberger RND, skew/butterfly), Positioning (Max Pain payout curves), GEX, SPX Payoff Builder (POP, T+0 curve, net Greeks), and VRP Research.
Overview
This page serves as the complete mathematical specification, calculation dictionary, and architectural guide for SOPHIE's Options Viewer (/option/viewer). It details every methodology, quantitative formula, indicator definition, and data convention used across the three primary sub-tools:
SPX Payoff Builder (Multi-leg payoff modeling, T+0 Black-Scholes mark-to-market, Net Greeks, Risk-Neutral Probability of Profit, and Skew-Adjusted ranges)
Volatility Regime & VRP Research (Variance Risk Premium decomposition, 4-regime taxonomy, timing power analysis, and transition risk matrices)
All index calculations assume standard S&P 500 Index Options (^SPX) conventions: European-style exercise (no early assignment), cash settlement against the special opening/closing quotation, and a **100contractmultiplier∗∗(100 per index point).
1. Top Banner & Institutional HUD Metrics
Located in OptionsMetricsBar and OptionsViewer, these key performance indicators summarize overall market conditions and expiration-specific dynamics.
1.1 At-the-Money Implied Volatility (ATM IV)
The implied volatility of the contract closest to the spot price:
StrikeATM=argKmin∣K−S∣ATM IV=IV(StrikeATM)
If both Call and Put IVs are quoted at the ATM strike, the mid-market average is reported.
1.2 Expected Move
The expected price dispersion of the underlying by expiration. Two computational methods are supported:
Primary Formula (ATM Straddle Implied Range):
Uses the standard market-maker rule-of-thumb pricing:
Expected Move$=(CATM, Mid+PATM, Mid)×0.85Expected Move%=(SExpected Move$)×100
Secondary Fallback Formula (Black-Scholes 1σ Dispersion):
Used if single-leg straddle quotes are missing:
Expected Move$=S×ATM IV×T
where T=365DTE.
1.3 Max Pain Strike
The strike price at which option buyers collectively experience the maximum loss, and option sellers (market makers) pay out the minimum cumulative capital at expiration:
Max Pain=argKmin[i∑max(0,K−Kc,i)⋅OIc,i+j∑max(0,Kp,j−K)⋅OIp,j]
Note: If open interest data is unavailable (such as in EOD snapshots lacking OI fields), Max Pain is suppressed to prevent arbitrary zero-tied strike outputs.
1.4 Put/Call Ratios
Volume Put/Call Ratio:PCRVolume=∑Call Volume∑Put Volume
Measures intraday flow sentiment (PCR>1.0⟹Put heavy / Bearish flow; PCR<1.0⟹Call heavy / Bullish flow).
Open Interest Put/Call Ratio:PCROI=∑Call Open Interest∑Put Open Interest
Measures cumulative structural positioning.
SPX lists ~55 expirations (dailies, weeklies, monthlies, quarterlies, LEAPS). To keep the interface intuitive without sacrificing liquidity, the viewer implements an algorithmic cycle selector:
Key Expirations Filter:
Near-Term Dailies: All cycles with DTE≤2 (0DTE and 1DTE trade heavily).
Friday Weeklies: Next 4 non-monthly Friday expiries.
Standard Monthlies: Next 4 standard monthlies (the 3rd Friday of the month, days 15–21, carrying the deepest open interest on the board).
LEAPS Anchors: The monthly cycle nearest ~365 DTE (1-year horizon).
Cycle Liquidity Tiering:
Ranks a cycle's open interest share relative to the maximum visible cycle on screen (Share=OIexp/OImax):
Located in OptionsMatrixTable and lib/options/liquidity.ts, this double-sided chain provides standard pricing, Black-Scholes Greeks, and composite execution quality metrics.
2.1 Mid Price & Spread Percentage
Mid Price=2Bid+AskSpread %=Mid PriceAsk−Bid
2.2 Proprietary Liquidity Score Model
Unlike generic equity models, SOPHIE's liquidity scorer is calibrated specifically to SPX market microstructure, where ATM spreads trade extremely tight (<0.3%) and widen rapidly OTM.
Critical Design Principle — Spread Gates the Score: A contract with large open interest but an unfillable quote (e.g., 0.00bid/5.00 ask) is not liquid. Therefore, Spread Score acts as a strict multiplier/gate rather than an arithmetic component that can be outvoted by open interest.
Forward Implied Volatility (σfwd):
Calculates the market-implied forward volatility between two expiration horizons T1 and T2 (T2>T1):
σfwd(T1,T2)=T2−T1T2σ22−T1σ12
3.3 Breeden-Litzenberger Risk-Neutral Density (RND)
Extracts the market's implied probability density function f(K) for the underlying price at expiration directly from call option prices, based on the Breeden & Litzenberger (1978) theorem:
f(K)=erT∂K2∂2C(K)
Non-Uniform Strike Grid Numerical Second Derivative:
Real SPX chains alternate between 5-point, 10-point, and 25-point strike gaps. Using a standard uniform formula h2Ci+1−2Ci+Ci−1 introduces severe error. SOPHIE implements the general non-uniform 3-point second derivative formula:
By default, Net GEX, the Gamma Flip, and Walls aggregate across all listed expirations (the complete dealer book), preventing inverted regime readings from isolated front-month expiries.
5.3 Gamma Flip Level (Zero Gamma)
The hypothetical spot price S∗ where total dealer gamma crosses zero. Evaluated by re-pricing every contract's Black-Scholes gamma across candidate spot levels:
Net GEX(S′)=i∑±Γi(S′,Ki,Ti,σi)⋅OIi⋅100⋅(S′)2⋅0.01
Solved via a 1% bracketed sweep followed by 14-step bisection root-finding.
5.4 Call Wall & Put Wall
Directional Constraint:Call Wall≥S, Put Wall≤S.
Smoothing: Evaluated over a [0.25,0.50,0.25] kernel across strikes to eliminate single-contract noise.
5.5 Higher-Order Greeks (Vanna & Charm Exposure)
Vanna Flow: Sensitivity of dealer delta to implied volatility shifts:
Vanna$=±∂σ∂Δ×OI×100
Charm Flow: Sensitivity of dealer delta to time decay:
Charm$=±∂t∂Δ×OI×100
6. SPX Payoff Builder & Probability Range Analysis
Located in SpxPayoffBuilder, PayoffChartView, ProbabilityRangeView, and lib/options/analytics.ts.
Plots current position value across hypothetical spot prices today (T>0):
Implied Volatility Solving: Each leg's entry premium is solved for its exact Black-Scholes implied volatility σi via bisection on mid price.
Current Value:Value Today(S′)=i=1∑NQuantityi×Signi×[CBS(S′,Ki,T,r,q,σi)−Premiumi]×100
6.3 Net Position Greeks
Aggregates Greeks across all legs, signed by position direction and scaled by quantity ×100:
Net Delta=∑±Qi⋅100⋅Δi,Net Gamma=∑±Qi⋅100⋅ΓiNet Theta=∑±Qi⋅100⋅Θi,Net Vega=∑±Qi⋅100⋅Vi
6.4 Risk-Neutral Probability of Profit (POP)
Evaluates the probability that the multi-leg position finishes with PnL>0 at expiration under risk-neutral lognormal drift μ=r−q−2σ2:
Identifies all breakeven zero-crossing strikes B1,B2,…,Bm.
Partitions the price domain into intervals [0,B1],[B1,B2],…,[Bm,∞).
For each profitable interval [Lk,Uk], integrates the lognormal CDF:
P(Lk<ST<Uk)=Φ(σTln(S/Lk)+(r−q−σ2/2)T)−Φ(σTln(S/Uk)+(r−q−σ2/2)T)
POP=∑k∈ProfitableP(Lk<ST<Uk).
6.5 Implied Price Ranges (Confidence Intervals)
Flat ATM Model (Symmetric):Boundarylower/upper=S⋅exp((r−q−2σATM2)T±σATMT⋅z(1+c)/2)
For 68% (1σ), z=1.000; for 80% (1.28σ), z=1.28155.
Skew-Adjusted (Asymmetric) Model:
Reprices each boundary using the actual market implied volatility of the nearest strike to that boundary, iterated to fixed-point convergence:
Upper(n+1)=Boundary(S,T,r,q,σ(Upper(n)),+z)Lower(n+1)=Boundary(S,T,r,q,σ(Lower(n)),−z)
Produces wider downside and tighter upside boundaries consistent with real index skew.
High premium compensation, but elevated gap/tail risk. Size down.
Thin
Thin Premium, Calm Tape
Implied barely exceeds realized; low compensation for gap risk.
Crisis
Thin Premium, Stressed Tape
Realized vol exceeds implied; premium selling is uncompensated.
7.3 Predictive Timing vs. Risk Signals
Entry-Timing Power: Testing vrp_z quintiles against forward 21-day realized premium yields a Spearman rank correlation of IC≈0.008 (effectively zero). VRP level does not reliably time entries.
Risk Management Power: The regime label strongly predicts transition into Crisis:
P(Crisis in 21d∣Harvest)=5.7%
P(Crisis in 21d∣Stressed Premium)=26.7% (approx. 5× higher risk).
Disclaimer: This application is a personal proof of concept created for study and research purposes only. All analysis, suggestions, and content are generated by AI models using publicly available data and tools, and should not be considered as financial advice. Past performance is not indicative of future results. Always conduct your own research and consult with qualified financial professionals before making investment decisions. The app's AI models may have limitations and may not account for all market factors or recent developments. Users are solely responsible for their investment decisions and should understand that all investments involve risk.