Python implementation of the Cboe VIX methodology using OptionMetrics SPX option quotes and the OptionMetrics zero-coupon curve via WRDS. Builds the daily near/next term schedule, computes term variances, and interpolates to a constant 30-day maturity.
Includes the post–February 10, 2025 OTM strike selection rule (exclude bid==0 or ask==0; stop after two consecutive such strikes).
- Python 3.12+
- numpy, pandas, wrds
- WRDS access to:
- OptionMetrics (
optionm_all.opprcdYYYY,optionm_all.zerocd) - Optional: Cboe (
cboe.cboe) for comparison
- OptionMetrics (
Install:
python -m venv .venv
source .venv/bin/activate
pip install numpy pandas wrdsTypical flow:
- Fetch available expirations (per date)
- Build near/next schedule that brackets 30 days (within 23–37 day eligibility)
- Pull quotes for those expirations
- Pull
zerocdand interpolate rates by days-to-expiration - Compute the VIX series
Minimal example:
import wrds
start_date = "2025-02-10"
end_date = "2025-08-29"
db = wrds.Connection()
cal = get_expiry_calendar(db, start_date, end_date, secid=SPX_SECID)
schedule = build_term_schedule(cal, target_minutes=N30)
quotes = quotes_for_schedule(db, schedule, secid=SPX_SECID)
zerocd = fetch_zerocd_range(db, start_date, end_date)
vix_df = compute_vix_series(schedule, quotes, zerocd, republish_on_fail=True)
print(vix_df.head())Test window: 2025-02-10 to 2025-08-29
- Overlap days: 130 (computed) vs 144 (official series points available)
- MAE: 0.175
- RMSE: 0.291
- Correlation: 0.9992
Plot:
Output columns:
date,vixrepublished,errornear_exdate,next_exdate,N1,N2
-
Timestamps are US/Eastern:
- calculation: 16:00 ET
- expiration: 09:30 ET (AM-settled) or 16:00 ET (PM-settled)
-
Fail handling: optional “republish last valid” behavior when a day cannot be computed.