Brent and West Texas Intermediate (WTI) are the two most commonly cited crude oil benchmarks. Brent is the light, sweet crude found in the North Sea, while WTI is the light, sweet crude refined in the US Midwest and gulf coast.
This strategy uses that spread to trade USO and BNO, two exchange-traded funds linked to futures for the WTI and Brent respectively (United States Oil Fund and United States Brent Oil Fund). For years, Brent and WTI traded at very similar prices in a highly correlated fashion. In mid-2010 Brent started trading at a premium to WTI. Speculation abounds about not only what is driving the divergence, but also about when, if, and how this imbalance will unwind and of course, how to best profit from possible scenarios. In the meantime I wanted to see how a very simplistic strategy of buying BNO and selling USO based on the spread would have fared over the last few years.
I put this algorithm together by using Quantopian's Fetcher (https://www.quantopian.com/posts/new-feature-fetcher) to query the price data from Quandl. The handle_data evaluates the crude oil prices each day. If Brent is trading at premium to WTI, the algorithm buys 1,000 shares of BNO and sells 1,000 share of USO. If the premium is reversed, reverse the trades.
As just one of the many disclaimers I can already think of to mention here, BNO only started trading in June of 2010, so lots of the interesting prior history of this relationship is not open to backtesting with that instrument.
This example needs to be extended. I'd love to see other people press the clone button on this algorithm and improve it. From the comments below, I was thinking about:
1) a rolling condition like, buy BNO/sell USO when the spread is above trailing 30 day avg (lots of possible variations on that) and vice versa
2) market neutral implementation (this isn't constrained to be market neutral, it does the easiest first thing which is to buy / sell equal share amounts)
3) other ideas for tradeable instruments in Quantopian's data set that capture more history than BNO (which started trading in June 2010)