In [ 7 ]: vstoxx_futures.info()
Out[7]: <class ‘pandas.core.frame.DataFrame’>
Int64Index: 504 entries, 0 to 503
Data columns (total 8 columns):
A_DATE 504 non-null datetime64[ns]
A_EXP_YEAR 504 non-null int64
A_EXP_MONTH 504 non-null int64
A_CALL_PUT_FLAG 504 non-null object
A_EXERCISE_PRICE 504 non-null int64
A_SETTLEMENT_PRICE_SCALED 504 non-null int64
A_PRODUCT_ID 504 non-null object
SETTLE 504 non-null float64
dtypes: datetime64[ns](1), float64(1), int64(4), object(2)
Several columns are not populated or not needed, such that we can delete them without
loss of any relevant information:
In [ 8 ]: del vstoxx_futures[‘A_SETTLEMENT_PRICE_SCALED’]
del vstoxx_futures[‘A_CALL_PUT_FLAG’]
del vstoxx_futures[‘A_EXERCISE_PRICE’]
del vstoxx_futures[‘A_PRODUCT_ID’]
For brevity, we rename the remaining columns:
In [ 9 ]: columns = [‘DATE’, ‘EXP_YEAR’, ‘EXP_MONTH’, ‘PRICE’]
vstoxx_futures.columns = columns
As is common market practice, exchange-traded options expire on the third Friday of the
expiry month. To this end, it is helpful to have a helper function third_friday available
that gives, for a given year and month, the date of the third Friday:
In [ 10 ]: import datetime as dt
import calendar
def third_friday(date):
day = 21 - (calendar.weekday(date.year, date.month, 1 ) + 2 ) % 7
return dt.datetime(date.year, date.month, day)
For both VSTOXX futures and options, there are at any time eight relevant maturities with
monthly differences starting either on the third Friday of the current month (before this
third Friday) or on the third Friday of the next month (one day before, on, or after this
third Friday).
[ 83 ]
In our data set, there are 11 relevant maturities, ranging from January
2014 to November 2014:
In [ 11 ]: set(vstoxx_futures[‘EXP_MONTH’])
Out[11]: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
We calculate the specific dates of all third Fridays once to reuse them later. Note that April
18, 2014 was a public holiday in Germany, although that is irrelevant for the following
analysis:
In [ 12 ]: third_fridays = {}
for month in set(vstoxx_futures[‘EXP_MONTH’]):
third_fridays[month] = third_friday(dt.datetime( 2014 , month, 1 ))
In [ 13 ]: third_fridays
Out[13]: {1: datetime.datetime(2014, 1, 17, 0, 0),
2: datetime.datetime(2014, 2, 21, 0, 0),
3: datetime.datetime(2014, 3, 21, 0, 0),
4: datetime.datetime(2014, 4, 18, 0, 0),
5: datetime.datetime(2014, 5, 16, 0, 0),
6: datetime.datetime(2014, 6, 20, 0, 0),
7: datetime.datetime(2014, 7, 18, 0, 0),
8: datetime.datetime(2014, 8, 15, 0, 0),
9: datetime.datetime(2014, 9, 19, 0, 0),
10: datetime.datetime(2014, 10, 17, 0, 0),
11: datetime.datetime(2014, 11, 21, 0, 0)}
Wrapping the maturity date dict object in a lambda function allows for easy application to