Back to Community
Statistical arbitrage - minimize variance ratio

Since a variance ratio (defined as weighted sum of auto-correlations) can tell if a series is mean reverting, random walk or trending, attempted a minimization of the variance ratio using scipy.optimize for 50 stocks from energy sector to find the weights of the portfolio.

The result shows a nice stationary mean reversion series.

Loading notebook preview...
Notebook previews are currently unavailable.
7 responses

Similarly maximizing the shape of variance ratio, gives a trending series. so the weights of the portfolio obtained from maximization should be trending.

Loading notebook preview...
Notebook previews are currently unavailable.

Does it persist out of sample?

Sadly doesn't persist out of sample. I am beginning to think that if co-integration and all these spread trading strategies (pair or basket) don't work out of sample there must be some other statistical relationship other than spread that could be persistent. Just need to find what it is?

i just wondering how it can not persist out of sample.
In terms of trading the mean reversion would you just search for the correct variance to trade.

Many thanks for your help,
Andrew

Well, as Aaron alluded to, there almost certainly ARE true co-integrating relationships out there, but if you don't look for them with the thesis first, they are drowned by all the false positives caused by spurious relationships. In the same way that http://rnm.simon.rochester.edu/research/FMFM.pdf points out that momentum might be basically about earnings momentum, perhaps the solution is to choose a narrow basket of stocks with known co-integration to some external/fundamental driver(s), then trade the residuals of those predictions. Instead of trading four refining stocks against each other, trade four refining stocks against their predictions based on their relationships to oil price, oil contango, crack spreads, natural gas, who knows...

I don't know much about the underlying rationale of this model http://www.tradingvolatility.net/p/spy-arbitrage-model.html but the idea is interesting, somewhat unrelated.

I increased length of in sample window and also maximized regression r-squared. It now does well for 55 days out of sample! I would really appreciate if you can play around with different dates and sectors to see if this persistence of out of sample is valid for all of them.

Loading notebook preview...
Notebook previews are currently unavailable.

I removed the sector constraint, upped it to 100 stocks, upped it to 10 lags for the variance ratio and 250 days out of sample, but with a longer training period.

I am not sure what this proves, some of the iterations looked good, some looked bad.

Loading notebook preview...
Notebook previews are currently unavailable.