The birth of a strategy pt. 2 – extending VXX history and other data concerns

This is the third part in a series describing how to approach the creation of a new trading strategy, including everything from idea generation, universe selection, data generation, proper in/out of sample testing, necessary considerations before live trading and the eventual big decision: do I want to trade that?

The first posts can be found here:

For this series it has been decided that the focus will lie on the construction of a strategy based on volatility ETPs. In the last post we took a closer look on volatility in general and on tradeable products. We have identified the VXX, XIV, VXZ and ZIV to be our products of choice. In this post we will be concerned with collecting the necessary data that we are going to use to build our strategy.

The logical first step is to obtain the historical time series for our ETPs. Since the change to the Yahoo Finance API (great idea Yahoo!) it became a bit trickier to freely obtain that data (in my opinion, Google Finance is not really reliable, on Quandl the volatility ETPs are only available for premium users). Hopefully, you have stored the data in a database or have access to it through your browser, if not you can get in contact with me and I can provide you with a csv.

Now in terms of the amount of data that we have, we are a bit limited as the inception date of the VXX and VXZ is the 29th of January 2009, and the inception of XIV and ZIV is the 29th of November 2010. This provides us with around 8.5 and 6.5 years of data. It’s not that long of a backtesting window and we also have no data for the financial crisis (which, as you might’ve guessed, had a very profound effect on volatiliy). The good thing is, when we take a closer look at the prospectuses of the ETPs (VXX/VXZ, XIV/ZIV), we see that the short-term products are linked to the S&P 500 VIX Short-Term Futures Index and the medium-term products are linked to the S&P 500 VIX Mid-Term Futures Index. We can use the methodology of those indices to not only create the time series of the indices themselves (I couldn’t find the index data freely available, if it is possible to get it somewhere please let me know), but also use the index returns to create a proxy for our ETPs and extend our historical data back to the inception of the VIX Futures.

As an example, the (lengthy) calculation for the short-term index works as follows:

Index_{t} = Index_{t-1} * (1 + CDR_{t} + TBR_{t})

where CDR is the so-called contract daily return and TBR is the treasury-bill return.

CDR is defined as CDR_{t} = \frac{TWDO_{t}}{TWDI_{t}} - 1 where

  • TWDO_{t} = \sum_{i=m}^{n} CRW_{i,t-1} * DCRP_{i,t} and
  • TWDI_{t} = \sum_{i=m}^{n} CRW_{i,t-1} * DCRP_{i,t-1}

DCRP is the daily contract reference price of the i^{th} VIX Future, m=1, n=2 and CRW is the contract roll weight of that future, meaning the percentage of the index that is allocated to this future. The contract roll weight for the front month future is obtained by dividing the number of business days since the last settlement date by the total number of business days in the roll period (last settlement date until, but no including, next settlement date).

Finally, the TBR is calculated by

TBR_{t} = \lbrack \frac{1}{1 - \frac{91}{360} * TBAR_{t-1}} \rbrack^{\frac{Delta_{t}}{91}} - 1

with $TBAR_{t} being the most recent weekly high discount rate for 91-day US Treasury bills and $Delta_{t}$ the number of calendar days between the current and previous business days.

We now have to obtain the historical timeseries for the VIX Futures. Luckily for us, in a recent post Ilya Kipnis of QuantStratTradeR has shared how to obtain VIX Futures data from the official CBOE website. We will leverage the code that he provided for our index calculation. We also need the to get the weekly T-Bill discount rates from treasurydirect. Following the link we query for the 13-week T-Bill and select the Auction Date and Average/Median Discount Rate columns. We can download a csv containing this data (after downloading the csv, I have ordered it by the Date and renamed the columns to Date and Rate). As mentioned in the QuantStratTradeR post, the settlement dates can be obtained from here.

With this we have all the building blocks that we need to calculate the index values. Let’s take a quick look if the calculation works. According to the official website, the short-term index value on the 30th of December 2016 was 170.06. Using this as the starting value, we calculate the daily index values until the 13th of July and compare it with the actual values.

Post7_1

 

Yes, the two lines overlap perfectly. Let’s take a look know what happens if we take the index returns and apply it to the VXX.

Post7_2

It is clear that we cant expect the two to agree completely (market forces) but this is a pretty good approximation and exactly what we need to create our proxy timeseries!

We will now go back from the first EOD VXX price (26,772.48 on the 30th of January 2009), using our calculated index returns to get the proxy timeseries for VXX starting from the inception of the index (20th of December 2005 with a value of 100,000.00). We have to be careful, however, to take into account the rescaling of VIX Futures that occurred on the 26th of March 2007 (basically a 10:1 split, more info here).

Post7_3

And finally, let’s look at the complete VXX timeseries, combining our proxy and the actual data after inception.

Post7_4

The same methodology can be applied to obtain the values for all other ETPs (minor modifications are needed for the mid-term versions, see the prospectus; and the signs of the index returns need to be reversed for XIV/ZIV). The code for the VXX calculation can be found here.

Now that we have collected all the necessary data, we can take a look at potential strategies in the next post. As always, feel free to leave your thoughts in the comments below.

Until next time,

QUANTBEAR

 

 

5 thoughts on “The birth of a strategy pt. 2 – extending VXX history and other data concerns

  1. Pingback: Quantocracy's Daily Wrap for 07/16/2017 | Quantocracy

  2. Hi there!

    Following along on your code as an extension to Ilya Kipnis.

    I have a question regarding a variable in the first function, getCRW. today = as.Date(today).

    However, today is not assigned a value anywhere, how can I proceed?

    Thanks
    Andrew

    Like

  3. Pingback: VIX Term Structure – Quantitative Analysis And Back Testing

Leave a comment