Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Historical volatility term structure and VIX futures

Hello everyone,

I am trying to implement a strategy from the following working paper: Does historical volatility term structure contain valuable information for predicting volatility index futures?

As a first step I am trying to put together the historical data of VIX and divide them into quartiles. It may be simple, but I personally am not able to write the code in the backtest.

Can someone please help me ?

Thank you!!

3 responses

So far I was able to extract the VIX level with the attached code. Among all others, it is the one that worked best. (link to the original post) and the data is divided in quartiles each day.
I also get the VIX futures' data of contracts with up to seven months to expiration.

Next step is to have the following regression for every VIX quartile in order to get the average shape of volatility term structure.

close = b0+ b1*ttm +b1*ttm^2

Attached is the first backtest with the code, however I need some help with a specific matter.

In line 214 I create the VRP calculations, and it updates daily giving me 7 values, however I need to collect all its previous results in one place so I can do the quantiles correctly. Because now the quantiles Q are only considering the 7 daily values.

Can someone please help?

Thank you

Here is an updated version of the code .