Site icon R-bloggers

A Failed Attempt at Backtesting Structural Arbitrage

[This article was first published on QuantStrat TradeR » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

One of the things that I wondered about regarding the previous post was how would this strategy have performed in the past, before the inception of XIV?

My first go-around involved me backtesting on the actual VIX index. Unfortunately, there is no instrument that actually perfectly tracks the VIX (EG ala SPY vs. the S&P 500 index). So, one common pitfall with trying to backtest VIX-type strategies is to actually assume that there’s a straightforward proxy to the VIX index. There isn’t. Why? Because of this:


#VIX weekend always up
getSymbols("^VIX", from="1990-01-01")
VIX <- to.weekly(VIX, OHLC=TRUE)
VIXwknd <- Op(VIX)/lag(Cl(VIX)) - 1
charts.PerformanceSummary(VIXwknd)

Obviously this equity curve is completely unrealistic, meaning it’s impossible to trade an exact replica of the instrument that would have created it.

However, for those seeking some data on VIX futures (that is, the instrument you could trade), on the front month contract, I recently updated my quandClean function in my IKTrading package, as the CBOE_VX contract actually has closing price data (in addition to settle price), so I was able to pull VIX futures data from Quandl. So, if you wish to replicate this analysis, update your installation of IKTrading. Here’s the code:


require(IKTrading)
VIX <- quandClean("CHRIS/CBOE_VX", verbose=TRUE)
vix2 <- VIX["2007-03-26::"]
vix1 <- VIX["::2007-03-23"]
vix1[,1:4] <- vix1[,1:4]/10
VIX <- rbind(vix1, vix2)
chart_Series(VIX) #2008-05-20 low is wrong
getSymbols("TLT", from="1990-01-01")
vixRets <- Return.calculate(prices=Cl(VIX))
tltRets <- Return.calculate(prices=Cl(TLT))
both <- merge(vixRets, tltRets, join='inner')
colnames(both) <- c("vix", "tlt")
longRets <- Return.rebalancing(both, weights=c(-.4, 1.8),
rebalance_on="weeks", geometric=FALSE)
colnames(longRets) <- c("VIXTLT")
charts.PerformanceSummary(longRets)

A quick explanation: Quandl’s VIX data prior to March 26, 2007 is on an order of magnitude larger than the data following it. Why this is the case, I do not know, but whatever the case may be, in order to proceed with the analysis, I divided that section of the data by 10. Still, Quandl’s data quality isn’t the greatest for other instruments, however, and I hope that they take a look at my updated algorithm for their futures data so as to improve its quality, and thereby make it more amenable to backtesting.

In any case, in this instance, rather than long XIV 40% and long TMF 60%, it was long TLT 180% and short VIX 40%.

Here’s the result:

In short, an unambiguous loser. Can we see why? Well, not completely, as XIV doesn’t go back to 2003 (or I’d be able to conduct the back-cast in a fairly straightforward fashion), but here’s an attempt to replicate XIV with transforms on the VIX (both short and inverting)

vixxiv <- merge(vixRets, xivRets, join='inner')
vixxiv$shortVix <- -1*vixxiv[,1]
vixxiv$inverseVix <- 1/(1+vixxiv[,1])-1
charts.PerformanceSummary(vixxiv[,2:4])

Here are the results:

Basically, even with the VX futures from the CBOE, it’s far from straightforward to get a replica of XIV in order to properly backtest the strategy, and without a stream of returns that matches that of XIV, it is very difficult to say how this particular strategy would have played out during the financial crisis when VIX spiked.  In any case, while this is hardly evidence of a failed thesis on the part of the original article’s author, it’s difficult to actually verify the validity of a strategy that has less than four years of data.

Thanks for reading.


To leave a comment for the author, please follow the link and comment on their blog: QuantStrat TradeR » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.