# QuantConnect Lean 2026 - backtest an iron condor on SPY
class IronCondorAlgorithm(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 1, 1)
self.SetEndDate(2026, 9, 1)
self.SetCash(100000)
self.equity = self.AddEquity("SPY", Resolution.Minute)
option = self.AddOption("SPY", Resolution.Minute)
option.SetFilter(-10, 10, 30, 60) # strike range, expiry range
def OnData(self, slice):
chain = slice.OptionChains.GetValue(self.equity.Symbol)
if not chain: return
# Filter for 30-45 DTE
contracts = [c for c in chain if 30 <= (c.Expiry.date() - self.Time.date()).days <= 45]
# Sell 30-delta call + buy 10-delta call
# Sell 30-delta put + buy 10-delta put
# Real Greeks via slice.OptionChains contract Greeks
The Lean snippet above initializes a 6-year backtest on SPY with daily resolution, adds an option chain filter (strikes within +/-10 of the underlying, expiries 30-60 DTE), and prepares the iron condor construction. Greeks are accessed via `contract.Greeks.Delta`, `Gamma`, `Vega`, `Theta`. Live trading requires a connected brokerage (IBKR Pro, Tradier, or Alpaca) and `SetBrokerageModel(BrokerageName.INTERACTIVE_BROKERS_BROKERAGE)` (Lean Documentation, September 2026).
OptionOmega: Options-Specific UI and Strategy Library
OptionOmega is a Python + Flask platform with 50+ pre-built options strategies and IV-aware P&L modeling, priced at $30-$120 per month in 2026.
OptionOmega's strategy library covers covered calls, cash-secured puts, naked puts, vertical spreads, iron condors, iron butterflies, calendars, diagonals, straddles, strangles, ratio spreads, and custom multi-leg combinations. The P&L modeling includes premium decay (theta), vega exposure, gamma scalping risk, and pin risk at expiration. The OptionOmega Python SDK (`opy`) is free for local development and exposes the same backtest engine that runs on the hosted platform. Most users run OptionOmega hosted + `opy` for custom parameter sweeps (OptionOmega Pricing, September 2026).
vectorbt and py_vollib for Custom Backtests
vectorbt 0.26+ ships the `vbt.options` extension with NumPy-vectorized options pricing and a portfolio simulator; py_vollib is the canonical Black-Scholes and Black-76 implementation in 2026.
vectorbt's options extension handles multi-leg strategies (verticals, iron condors, calendars) with vectorized premium decay, vega exposure, and pin risk. The extension is 50-200x faster than event-driven options backtesters on factor strategies. py_vollib exposes `py_vollib.black_scholes.greeks.analytical` for delta, gamma, theta, vega, rho and `py_vollib.black_scholes.implied_volatility` for fitting IV from market prices. Both libraries are pure Python, installable via pip, and run on Python 3.10+ (vectorbt GitHub, py_vollib GitHub, September 2026).
# py_vollib 2026 - compute Black-Scholes Greeks
from py_vollib.black_scholes.greeks.analytical import delta, gamma, theta, vega, rho
S, K, t, r, sigma = 100, 100, 0.25, 0.05, 0.20
flag = 'c' # 'c' for call, 'p' for put
print(f"delta={delta(flag, S, K, t, r, sigma):.4f}")
print(f"gamma={gamma(flag, S, K, t, r, sigma):.4f}")
print(f"theta={theta(flag, S, K, t, r, sigma):.4f}")
print(f"vega={vega(flag, S, K, t, r, sigma):.4f}")
print(f"rho={rho(flag, S, K, t, r, sigma):.4f}")
# delta=0.5596, gamma=0.0467, theta=-0.1347, vega=0.2335, rho=0.1142
The py_vollib snippet computes Black-Scholes Greeks for an at-the-money call with 25% IV and 3 months to expiry. The library is unit-tested against QuantLib reference values within 4 decimal places. For American options on dividend-paying stocks, py_vollib provides the Bjerksund-Stensland approximation (py_vollib GitHub, September 2026).
FAQs
What is the cheapest options data vendor in 2026?
yfinance is free for current daily options chains with delayed quotes. Tradier at $10 per month is the cheapest paid option with real-time + 5-year EOD history and Greeks computation.
Does OptionOmega support live options trading?
Yes - OptionOmega Pro at $60 per month includes live broker integration with Tradier, Interactive Brokers, and TD Ameritrade. The Elite plan at $120 per month adds live trading dashboards and alert routing.
Can I use vectorbt options with Polygon.io data?
Yes - Polygon's options data feeds into vectorbt via a custom data adapter. Most users load Polygon historical options chains into a pandas DataFrame, then call `vbt.options.Pricing.vectorized_pnl(...)` for backtest simulation.
What is the best options backtest framework for a beginner in 2026?
QuantConnect Lean is the best beginner experience because it ships with managed data, a browser IDE, and one-click deploy to live. OptionOmega is the right second framework if you want a pre-built options UI without writing Python.
Resources and Next Steps
For teams evaluating Python options backtesting in 2026, start with QuantConnect Lean for managed data + live trading, OptionOmega for the pre-built options UI, vectorbt for vectorized factor research, and py_vollib for Black-Scholes Greeks. The data layer (Tradier, Polygon, ORATS) is the largest cost component; lean toward QuantConnect if you want managed data, toward Polygon if you want raw historical feeds, toward ORATS if you want IV Rank and IV Percentile history. Most production options quant teams run QuantConnect + ORATS together for the best depth.