💻 Code & 📦 Data
This page contains some (hopefully) useful Python code and data used in our research. An acknowledgement and citation of doi.org/10.17605/OSF.IO/Z2486 in your paper would be much appreciated.
💻 Code
Option-Implied Moments (Python)
qmoms 0.1.3 is live on GitHub and PyPI (105 tests passed).
- Install:
pip install qmoms - Source: github.com/vilkovgr/qmoms (commit
6d8d88d)
Feed it an implied-volatility surface (moneyness × maturity) and get a full set of research-grade option-implied moments in one call — model-free variance, skewness/kurtosis, downside risk, tail steepness, jump risk, corridor VIX, and (with returns) generalized lower bounds on expected returns. Same measures that appear in RFS / JF / QJE / MS papers, without re-implementing the integrations.
✨ Why it is useful — what you get
| Output | What it captures |
|---|---|
mfiv_bkm, mfiv_bjn, smfiv |
Model-free implied variance (log & simple contracts) |
mfis, mfik |
Risk-neutral skewness and kurtosis |
smfivd, mfivd_* |
Downside semivariance (crash risk priced in options) |
slopedn, slopeup |
Left/right smile steepness — how expensive tails are vs ATM |
rix, tlm_* |
Tail jump and tail-loss measures |
cvix_* |
Corridor VIX (variance inside a strike band) |
GLB_* |
Option-implied lower bounds on expected excess returns |
pip install.
🚀 Quick start
from qmoms import load_data, default_params, filter_options
from qmoms import get_rate_for_maturity, qmoms_compute
df_surf, df_rate, _ = load_data() # rates already annual decimals
df_surf = filter_options(df_surf, default_params['filter'])
ids, g = next(iter(df_surf.groupby(['id', 'date', 'days'])))
rate = get_rate_for_maturity(df_rate, date=ids[1], days=ids[2])
qout = qmoms_compute(
mnes=g.mnes, vol=g.impl_volatility,
days=ids[2], rate=rate, params=default_params,
)
print(qout)Sample output for one surface slice (id=12490, 2023-01-03, 30 days):
nopt 17.000 # options used
smfiv 0.094 # simple MFIV ≈ 9.4% variance
mfiv_bkm 0.097 # BKM log MFIV
mfis -0.531 # risk-neutral skew (left-skewed)
mfik 3.566 # risk-neutral kurtosis
rix 0.003 # left-tail jump measure
slopedn 0.172 # put-wing steepness
slopeup -0.053 # call-wing steepness
Over the bundled panel (3,750 id/date/maturity groups): mean mfis ≈ −0.64 (typical equity left skew), mean slopedn ≈ 0.26 — left tails systematically more expensive than right. Full scripts: qmoms_test.py, qmoms_glb_test.py.
📁 Computed Moments & Characteristics
qmoms uses out-the-money (OTM) implied volatilities interpolated as a function of moneyness (Strike/Underlying or Strike/Forward) within the available range. Outside the available range, boundary values are extended. OTM Definition: moneyness ≥ 1 for calls and < 1 for puts.
- Model-Free Implied Variance (log contract)
MFIV_BKM: Based on Bakshi, Kapadia, and Madan (RFS, 2003)
MFIV_BJN: Based on Britten-Jones and Neuberger (JF, 2002)
- Simple Model-Free Implied Variance
SMFIV: Based on Martin (QJE, 2017)
- Corridor VIX
CVIX: Based on Andersen, Bondarenko, and Gonzalez-Perez (RFS, 2015)
- Tail Loss Measure
TLM: Based on Vilkov and Xiao (2012) and Hamidieh (Journal of Risk, 2017)
- Down-Side Semivariances
- Based on Feunou, Jahan-Parvar, and Okou (J. Fin. Econometrics, 2017)
> Up semivariances can be computed as total variance minus down semivariance.
- Based on Feunou, Jahan-Parvar, and Okou (J. Fin. Econometrics, 2017)
- Tail Jump Measure
RIX: Based on Gao, Gao and Song (RFS, 2018)
- Tail Steepness Measures
Slopeup(right tail) andSlopedn(left tail) measure tail steepness
> Larger values = more expensive tail relative to ATM vol.
- Carbon Tail Risk (Ilhan, Sautner, Vilkov, RFS 2021)
- Pricing Climate Change Exposure (v.Lent, Sautner, Zhang, Vilkov, MS 2023)
- Kelly, Pastor, Veronesi (JF, 2016)
> Note: we define-SlopeforSlopeupto improve interpretability.
- Generalized Lower Bounds on Expected Returns
GLB: Based on Chabi-Yo, Dim, and Vilkov (MS, 2023)
> Requires historical returns in addition to the IV surface.
📦 Data
Data hosted in OSF Data Repository
Download Data on Climate Value and Values Discovery in Earnings Calls
From Climate Value and Values Discovery in Earning Calls (2024)Download Firm-level Climate Change Exposure
From Firm-level Climate Change Exposure (2023)Download Implied and Realized Correlations
From Option-Implied Correlations and the Price of Correlation Risk (2005/2012)Download Generalized Lower Bounds
From Generalized Bounds on the Conditional Expected Excess Return (2024)Download Option-Implied Market Betas
From Measuring Equity Risk with Option-implied CorrelationsDownload Model-Free Implied Skewness (MFIS)
From Risk-Neutral Skewness: Return Predictability and Its Sources (2012)Download SPX 0DTE Data
From ODTE Trading Rules (2024)
Direct Downloads
From Measuring Equity Risk with Option-implied Correlations (2012 RFS)
📁 Zipped mat Data (1996–2009)Contents
Contains 5 MATLAB
.matfiles:market_betas_1996_2009.mat:
Structurebetaswith 6 different beta methodologies, aligned to a common timeline in time vectordt. Also includespermnoID vector. In the paper we used:- implied:
impl_daily_251d_mfiv,impl_monthly_60m_mfiv
- historical:
hist_daily_251d,hist_monthly_60m
- implied:
id_dt.mat:
Time vectordt, and vector of IDs (PERMNOfrom CRSP). The firstPERMNO = 999999is the market itself (S&P 500).weights.mat:
Synthetic weightswof stocks in the S&P 500. The first column isNaNbecause it refers to the market itself.dailyret.mat:
Daily returns (retandretxfor ex-div returns) for the S&P 500 and its components.mnthly_ret.mat:
Monthly returnsretmfor the S&P 500 and its components. Includes time vectordtm.