RiskOptima Options Analysis Suite
Analyze IV, Simulate Greeks, and Backtest Strategies — All in One File
Built for speed. Tuned for precision. Engineered to empower.
This post lays out a fully functional options trading toolkit that combines:
-
🔍 Volatility screening
-
🧠 Greek simulation
-
📊 Straddle backtesting
We use live market data (via yfinance
), visualize critical metrics, and ensure all functions are contained in a single script — just the way traders like us operate.
🔍 Option Moneyness: Know Where You Stand
Before trading any option, you must understand where its strike sits relative to the current market price — this is called moneyness.
✔️ Calls
-
In the Money (ITM): Strike < Spot — already profitable if exercised
-
At the Money (ATM): Strike ≈ Spot — highest gamma, most responsive
-
Out of the Money (OTM): Strike > Spot — cheap, speculative
✔️ Puts
-
In the Money: Strike > Spot — pays off below market
-
At the Money: Strike ≈ Spot — greatest extrinsic value
-
Out of the Money: Strike < Spot — directional downside exposure
Use this mental map before entering any directional or volatility trade.
📈 1. Implied Volatility Screener
❓ What It Does:
This function retrieves ATM IV across expirations and compares it to historical volatility over a 30-day period. It helps answer:
“Are options overpriced or underpriced right now?”
✅ Use It For:
-
Deciding whether to buy or sell premium
-
Structuring spreads vs naked options
-
Understanding term structure and skew
📊 Example Output:
🔍 Observations:
-
Near-term IV (May 2025) is significantly elevated — likely due to earnings or macro event.
-
IV sharply declines across the curve, bottoming around 42% in late 2025/early 2026.
-
The red dashed line = 30-day realized volatility (HV), sitting around 56.7% → options are currently rich.
This chart helps identify when to sell vol (e.g. short strangles or spreads) or buy vol (e.g. long straddles).
🧪 2. Straddle Earnings Backtester
❓ What It Does:
Backtests a simple earnings strategy:
-
Enter straddle 5 days before earnings
-
Exit 1 day after earnings
-
Estimate payoff using an assumed 5% straddle cost
✅ Use It For:
-
Gauging whether vol crush post-earnings destroys value
-
Validating if the move justifies option premium
-
Spotting overpriced earnings setups
📊 Example Output:
Summary Stats (AMZN):
🔍 Observations:
-
All 8 backtested trades were net losses — the moves were too small to justify the premium.
-
Volatility is overpriced before earnings, and the subsequent move doesn’t compensate.
-
Actionable Insight: Favor selling premium (like iron condors or ratio spreads) before AMZN earnings.
🧠 3. Greeks Simulator
❓ What It Does:
Calculates and visualizes option sensitivities across strikes for a specific expiry and volatility.
✅ Use It For:
-
Understanding where gamma is peaking
-
Managing theta decay
-
Spotting vega exposure for volatility plays
📊 Example Output:
🔍 Observations:
-
Gamma and Vega peak at-the-money (Strike ≈ 193) — confirming the standard shape
-
Theta is most negative at ATM — time decay is fastest here
-
Delta slope confirms call curve — higher strikes have lower delta
This simulator lets you align trades with your expectations on price, volatility, and time decay.
🎯 When to Use Calls vs Puts (Quick Guide)
Market View | Strategy | Example |
---|---|---|
Bullish breakout | Buy Call | Long 195C if AMZN ≈ 192 |
Bearish catalyst | Buy Put | Long 190P for downside |
Big move (unknown dir) | Buy Straddle | 195C + 195P |
Mild bullish move | Bull Call Spread | 195C / short 200C |
Mild bearish move | Bear Put Spread | 195P / short 190P |
🧰 Toolkit Functions (Copy-Paste Ready)
-
RiskOptima.implied_volatility_screener(symbol='AMZN')
-
RiskOptima.straddle_backtester(symbol='AMZN', window_before=5, window_after=1)
-
RiskOptima.greeks_simulator(S=192.82, T_days=20, sigma=0.35, option_type='call')
All wrapped in a single file. Minimal dependencies. Maximum insight.
🚀 What’s Next
-
Add
run_all()
orchestrator for batch testing -
Plug into
riskoptima
portfolio overlays -
Build a Streamlit dashboard (optional)
-
Add edge detection: where historical P&L exceeds breakeven
Comments
Post a Comment