This page contains some (hopefully) useful Matlab/ Python code and data in various formats that we (my coauthors and I) used in our research. Feel free to use our data and the code; an acknowledgement and citation of https://doi.org/10.17605/OSF.IO/Z2486 in your paper will be much appreciated.
Code Section
Option-Implied Moments/ Python
- [updated 2021-06-27] Model-Free Implied Measures from Options Data (Data and Code) via link to my OSF Project
NEW: added slope and rix computations, corrected some bugs in TLM, split input files into options and spot/forwards, both zipped
The ZIP contains test options data (1996/ 30 days, zip), spot and forwards (1996/ 30 days, zip), zero cd rates (csv), and the Python procedures to compute several useful variables, and the output from running the program on my machine:
:MFIV/ MFIS/ MFIK using the results of Bakshi, Kapadia and Madan (2003 RFS) and our interpolation routine
:MFIV following Britten-Jones and Neuberger (2000 JF)
:SMFIV using Ian Martin (2013 NBER,2017 QJE) with our interpolation
:CVIX (Corridor MFIV) using Andersen and Bondarenko (2007 NBER), Andersen, Bondarenko, and Gonzalez-Perez (2015 RFS) and our interpolation routine
:MFIVU/D and SVARU/D: semivariances using log and simple contracts, respectively
:RIX/RIXNORM: tail measures following Gao, Gao, and Song (2018 RFS)
:TLM (tail loss measure) using the results of Vilkov, Xiao (2012) and Hamidieh (2011) and our interpolation routine/ corrected bugs since 2020 version
:SLOPEDN/SLOPEUP: implied volatility slopes as used in Ilhan, Sautner, and Vilkov (2021 RFS) - NOTE: if you run parallel version of the code on Windows, you should run the whole program at once (click in your Python GUI "Run the whole program" or alike) as opposed to executing it by cells! Such behavior is due to a bug in the Windows version of the parallel library used.
- I did not structure the program as a package for simplicity -- you can easily move all the functions to a separate module and import it in your program
Data Section
OSF Collection of Option-implied Data: all data updated to include 1996 to 2022
access to all through https://doi.org/10.17605/OSF.IO/Z2486 or separately for each project:
1. Implied and Realized Correlations (IC and RC) from Option-Implied Correlations and the Price of Correlation Risk, 2005/2012, with Joost Driessen, Pascal Maenhout
- [Updated until 12/2022] Download at https://doi.org/10.17605/OSF.IO/CKGYF
- Implied and Realized Correlations among S&P500 components for different maturities
- [Updated until 6/2022] Download at https://doi.org/10.17605/OSF.IO/7XCQW
- Generalized Lower Bounds (GLB) for different maturities for all stocks in S&P500 universe and all optionable stocks available in OptionMetrics
- Martin and Wagner (MW) bounds for different maturities for stocks in S&P500 index at each point in time
- GLB-based quintile portfolios (daily returns) with weekly and monthly rebalancing
- [Updated until 12/2022] Download at https://doi.org/10.17605/OSF.IO/CTU98
- Option-implied market betas for stocks in S&P500 index at each point in time for different maturities
- Implied beta-based quintile portfolios (daily returns) with weekly and monthly rebalancing
- [Updated until 12/2022] Download at https://doi.org/10.17605/OSF.IO/BTVDH
- Model-free implied skewness of log returns (MFIS) for all stocks in S&P500 universe
- Model-free implied variance of log returns (MFIV) for all stocks in S&P500 universe
- Model-free implied variance of simple returns (SMFIV) for all stocks in S&P500 universe
- Model-free implied variance of log and simple returns for S&P500 index
- [Updated until December 8, 2023] Download at https://osf.io/7q86u/
Selected data from the Carbon Tail Risk paper with Emirhan Ilhan and Zacharias Sautner, RFS, 2021
- [updated 2020-05-20] Download Excel file here!
- [updated 2018-12-13] Implied correlations (IC), model-free implied variance (MFIV), variance risk premium (VRP), down semivariance (MFIVD), down semivariance risk premium (VRPD), realized correlation (RC) from 1996 until 12/2017, based on S&P500 and its components. IC is computed from OptionMetrics Surface File using Simple Variance Swaps (by Ian Martin), MFIV is computed as Simple Variance Swaps, VRP is computed as MFIV minus realized variance from high-frequency and overnight S&P returns, MFIVD is computed as corridor variance from OTM puts, VRPD is the difference between MFIVD and realized semivariance for the matching maturity computed from high-frequency and overnight S&P returns, RC is computed as equicorrelation from daily stock returns (same formula as for IC); all measures are computed for standard maturities of 30, 91, 182, 273, and 365 days. CRPs are not given, but can be easily computed as IC minus the RC for the historical window equal to the maturity of the options used for a given IC. The data is saved in an Excel table (xlsx).
IC and CRP (click it and Save As..)
- [updated 2013-07-09] Data used in the paper 'Measuring Equity Risk with Option-implied Correlations.'
The ZIP for Download (just click it and Save As..) contains 5 files:
:market_betas_1996_2009.mat contains the betas themselves (6 different beta methodologies, time vector dt, and IDs vector permno) in a structure betas.
All betas are aligned to the same timeline in time vector dt.
In the paper we used the betas in fields impl_daily_251d_mfiv, impl_monthly_60m_mfiv for implied and hist_daily_251d, and hist_monthly_60m for historical.
:id_dt.mat contains the time vector dt, and the vectors of IDs (PERMNO from CRSP), the first PERMNO = 999999 is market itself (SP500).
:weights.mat contains the synthetic weights w of stocks in the SP500 index (first column is NaN, because it is SP500 itself).
:dailyret.mat contains daily returns (ret and retx for ex div returns) for SP500 and its components.
:mnthly_ret.mat contains monthly returns retm for SP500 and its components, and the time vector for these returns in dtm. - [updated 2017-01-05] The same data as above saves in CSV. Lots of files for betas; the tables are arranged in time x cross section, where dates (time points) are located in files with '_dt...', and identifiers are in files with '_permno'. The ZIP for Download (just click it and Save As..) - let me know if there are any questions!
Outdated Stuff
Option-Implied Moments/ Matlab
- [updated 2014-07-01: very outdated!] Model-Free Implied Measures from Options Data (OptionMetrics)
The ZIP contains test options data, zero cd rates, and the Matlab procedures to compute
:MFIV/ MFIS/ MFIK using the results of Bakshi, Kapadia and Madan (2003) and our interpolation routine
:SMFIV using Martin (2012)
:CX (Corridor MFIV) using the results of Andersen and Bondarenko (2007) and our interpolation routine
:VIX/SKEW using the CBOE procedures without interpolation
:SVIX using Martin (2012) without interpolation
:TLM (tail loss measure) using the results of Hamidieh (2011) and our interpolation routine