Tuesday, July 10, 2012

Extracting roll returns from futures

Futures returns consist of two components: the returns of the spot price and the "roll returns". This is kind of obvious if you think about it: suppose the spot price remains constant in time (and therefore has zero return). Futures with different maturities will still have different prices at any point in time, and yet they must all converge to the same spot price at expirations, which means they must have non-zero returns during their lifetimes. This roll return is in action every day, not just during the rollover to the next nearest contract. For some futures, the magnitude of this roll return can be very large: it averages about -50% annualized for VX, the volatility futures. Wouldn't it be nice if we can somehow extract this return?

In theory, extracting this return should be easy: if a future is in backwardation (positive roll return), just buy the future and short the underlying asset, and vice versa if it is in contango. Unfortunately, shorting, or even buying, an underlying asset is not easy. Except for precious metals, most commodity ETFs that hold "commodities" actually hold only their futures (e.g. USO, UNG, ...), so they are of no help at all in this arbitrage strategy. Meanwhile, it is also a bit inconvenient for us to go out and buy a few oil tankers ourselves.

But in arbitrage trading, we often do not need an exact arbitrage relationship: a statistical likely relationship is good enough. So instead of using a commodity ETF as a hedge against the future, we can use a commodity-producer ETF. For example, instead of using USO as a hedge, we can use XLE, the energy sector ETF that holds energy producing companies. These ETFs should have a higher degree of correlation with the spot price than do the futures, and therefore very suitable as hedges. In cases where the futures do not track commodities (as in the case of VX), however, we have to look harder to find the proper hedge.

Which brings me to this fresh-off-the-press paper by David Simon and Jim Campasano. (Hat tip: Simon T.) This paper suggests a trading strategy that tries to extract the very juicy roll returns of VX. The hedge they suggest is -- you guessed it! -- the ES future. In a nutshell: if VX is in contango (which is most of the time), just short both VX and ES, and vice versa if VX is in backwardation. 


Why does ES work as a good hedge? Of course, its very negative correlation with VX is the major factor. But one should not overlook the fact that ES also has a very small roll return (about +1.5% annualized). In other words, if you want to find a future to act as a hedge, look for ones that have an insignificant roll return. (Of course, if we can find a future that has high correlation with your original future but which has a high roll return of the opposite sign, that would be ideal. But we are seldom that lucky.)


P.S. The reader Simon who referred me to this paper also drew my attention to an apparent contradiction between its conclusion and my earlier blog post: Shorting the VIX Calendar Spread. This paper says that it is profitable to short VX when it is in contango and hedge with short ES, while I said it may not be profitable to short the front contract of VX when it is in contango and hedge with long back contract of VX. Both statements are true: hedging with the back contract of VX brings very little benefit because both the front and back contracts are suffering from very similar roll returns, so there is little return left when you take opposite positions in them!

40 comments:

  1. On the last page of the paper, it appears that the returns flattened out in mid-2010. Maybe the big hedge funds starting running the strategy around then?

    ReplyDelete
  2. Brendon,
    Yes, it does seem on their Figure that the returns were flat 2010-2011. However, a backtest using my own version of the program indicates that returns are still very high.
    Ernie

    ReplyDelete
  3. Hi Ernie,

    This may not be the most relevant post for this question, but I am wondering whether there is any framework to optimize a futures portfolio. Most of the futures money management technique I have seen involve backing out dollar allocation for each contract based on leverage and maximum loss, for example. I was hoping to use the mean-variance type optimization in order to model the correlation, but I am not entirely sure how to model the leverage and margin into the optimization. Are you aware of any technique for this?

    Thanks for keeping a very good blog.

    ReplyDelete
  4. Hi ezbentley,
    Money management techniques for futures is the same as for any other instruments under the Kelly formula framework. All you need to make sure is that when calculating returns, you are using P&L/Market_value, so that no margin or leverage are involved.
    Kelly formula will tell you how much leverage to use.
    Ernie

    ReplyDelete
  5. Dear Ernie,

    I use IB as broker suggested in your book.
    I try to use Mkt Scanner in TWS to do stocks selection for pairs trading.

    Do you use "Mkt Scanner" in TWS yourself?
    Or you have other choices for stocks selection?

    In "Mkt Scanner", there is Sector, Industry and Category.
    Do we need to go to Category level or just Sector level for selection?

    For example, Energy--> Oil&Gas -->Oil Comp-Integrated.

    Thank you for your time.

    Chu

    ReplyDelete
  6. Hi Ernie,

    Thanks for your reply. Just to clarify, are you suggesting to compute return and covariance matrix based on the raw prices, as if they are stocks? Then you take the leverage suggested by Kelly to decide the actual allocation? In other words, the margin imposed by the exchange never comes into play as long as the Kelly leverage is smaller than the margin-implied leverage. Is my understanding correct?

    Thanks,

    ReplyDelete
  7. Hi Chu,
    Actually I don't use Market Scanner. I use my own historical market data and run them through Matlab to select pairs.
    Ernie

    ReplyDelete
  8. Hi ezbentley,
    The input to Kelly formula is returns, not prices. In computing returns for futures, just make sure that they are unlevered (i.e. using the futures market value as the denominator).

    Indeed we don't care about the exchange leverage limit, as long as it is bigger than the Kelly leverage.
    Ernie

    ReplyDelete
  9. Dear Ernie,

    Thank you for quick response.

    "Mkt Scanner" is used to find "liquid" stocks in the same "industry". It just groups stocks in the same "industry".
    Then we use these symbols in the same "industry" to download historical data. Then do numerical tests to find pairs.

    It seems we test stocks pairs in the same "industry", but the "industry" definition is a little different in the different levels and systems.

    Thank you for your time.

    Chu

    ReplyDelete
  10. Hi Ernie,

    a somewhat off topic question. Recently IB started collecting "hard to borrow" fees on shorting many ETFs including GLD.

    I was wondering if this is a growing brokers trend, or whether other brokers do not collect such fees. It would be also interesting to hear what other traders think about this.

    ReplyDelete
  11. Hi Anon,
    Institutional brokers have been charging customers "hard-to-borrow fee" or "negative rebate" for a long time, so it is not surprising that the practice spreads to retail brokerages.

    Ernie

    ReplyDelete
  12. Hi Ernie,

    Do you use IB paper account to do paper trading?

    Is its real time stocks quotes reliable?

    Or is IB's real times stocks quotes consistent with its historical data?

    Thank you

    ReplyDelete
  13. Hi Anon,
    Yes, I do use IB for paper trading. There real time quotes are consistent with their historical data, but both exhibit erroneous ticks that can cause erroneous trades.
    Ernie

    ReplyDelete
  14. Hi Ernie,

    Thank you for reply.

    Do you trade intraday IVV/SPY pairs on IB?

    Thank you

    ReplyDelete
  15. Hi Anon,
    No, I don't. I am not sure that IB's data feed is low-latency enough for that type of arbitrage. I would use Lime Brokerage instead.
    Ernie

    ReplyDelete
  16. Hi Ernie,

    I agree with you.

    I backtest IVV/SPY using 1 minute bars data from IB.

    I find several (8) trades per day.

    But when I do paper trading on IB using real-time data feed, I hardly get any buy/sell signals, although I do compute my z-score every second.

    Is that possible to solve this problem by getting new data feed, such as eSignal?
    It seems they provide better, faster real-time quotes.
    Then still use IB as brokers?

    I guess Lime Brokerage requires bigger capital?


    Thank you.

    ReplyDelete
  17. Hi Anon,
    I hope you used limit orders for this test? IB prices might trigger an erroneous market order filled at poor prices.

    I don't know if eSignal has lower latency or fewer errors.

    Lime Brokerage gives you direct access to the exchange feeds: suitable for high frequency trading with latency below 1ms. They do require a bigger account than the average IB account.

    Ernie

    ReplyDelete
  18. Hi Ernie,

    I do write limit orders for both legs in Java API, but IB real-time quotes almost do not generate z-scores more than 2.

    It is weird because I find at least 8 good trades per day in my historical backtesting based on just 1 minute bars.

    However, in real-times paper testing, I get almost no trade signal. Therefore, I guess IB real-time quotes are not consistent with their historical higher frequency data.

    May I ask usually how big account Lime Brokerage require?

    Thank you

    ReplyDelete
  19. Hi Anon,
    I guess the minimum account size at Lime depends on how much commission you generate.

    As a ballpark estimate, I would say $500K-$1M.

    But note that the colocation fee is about $2K/month in order to access the direct feeds.

    Ernie

    ReplyDelete
  20. Hi Ernie,

    May I ask if you trade "FAZ"?

    Moreover, how do we do Day trading for pairs trading?

    It seems it takes some time for pairs to mean-reverting.

    Thank you.

    ReplyDelete
  21. Hi Anon,
    I don't currently trade FAZ.
    Even though ETFs mean revert slowly,
    there can still be profits trading them intraday, if your execution strategy is sophisticated enough.
    Ernie

    ReplyDelete
  22. The strategy has continued to perform; I believe it did very well when the curve was in backwardation in 2011.

    ReplyDelete
  23. Jim,
    Good to hear that!
    Thanks for the heads-up.
    Ernie

    ReplyDelete
  24. Respected Sir,


    Let me first congrats & thank you for your wonderful posts & very informative & extremely useful book (i am currently reading) .sir my name is amit,from india, i am a nanotech R&D.professional,i also wanna do algo trading,sir whether is it applicable for india as well? please guide .your little guidance will change the life of many layman like me.


    sir i can offer free on/offline assistance to any assignment according to my skills,if you needed any time.



    Warm Regards
    AMIT(bigfm987@yahoo.in)

    ReplyDelete
  25. Hi Amit,
    Glad to hear you like my book.

    Algo trading is already quite popular in India, and both individuals and institutions have been practising it.

    Ernie

    ReplyDelete
  26. Hi Ernie,

    Thanks for your blog, highly appreciated.

    You often write about correlated/cointegrated stocks and mean reversion strategies. I´ve always wondered if this can be turned around. E.g. suppose that stock A and B historically don´t correlate at all - whenever their correlation coefficient is > 0,5 or < -0,5 it will most likely turn around and revert to 0. Could this be a basis of a strategy? Or probably not possible to model such phenomenon with orders in A and B?

    Let me know your view. Thanks!

    ReplyDelete
  27. Hi Ernie,

    Thanks for your blog, highly appreciated.

    You often write about correlated/cointegrated stocks and mean reversion strategies. I´ve always wondered if this can be turned around. E.g. suppose that stock A and B historically don´t correlate at all - whenever their correlation coefficient is > 0,5 or < -0,5 it will most likely turn around and revert to 0. Could this be a basis of a strategy? Or probably not possible to model such phenomenon with orders in A and B?

    Let me know your view. Thanks!

    ReplyDelete
  28. Hi CVC,
    The only way I know how to trade the mean-reversion of correlations is "dispersion trading" See http://www.math.nyu.edu/faculty/avellane/Lecture10Quant.pdf

    Ernie

    ReplyDelete
  29. Hi EC,

    Thanks for your wonderful book! I have a question: for your calendar spread strategy to profit from roll return, we need to calculate the half life using gamma. In my backtest program, I was getting negative halflife at beginning, or very extreme large number, like 2000.

    Only to realize, the amount of gammas that I feed into the halflife calculation is too little (a year or 252 days only). I increased the gammas count to 1000 using a lot more training data, then only the halflife start to make sense.

    Assuming the halflife will not be constant, I modified your matlab code to using an updating halflife for everyday, and the Sharpe ratio and APR increased slightly for the same period.

    I would like to know, do half life calculation always require this much of data? Since my training program is having problem referring to this much of expired contract.

    ReplyDelete
  30. Hi VHanded,
    Thank you for your kind words.

    The length of data that halflife calculation needs depends on the halflife itself (the longer the halflife, the more data needed), as well as on the stability of the mean-reversion. Some spreads undergo a period ("regime") of momentum or random walk that leads to negative or infinite halflife during such periods. So it becomes necessary to use a large amount of data to find its long-term behavior.

    Ernie

    ReplyDelete
    Replies
    1. Thanks for your reply, and sorry for this late reply. What is wise to do if things undergo period of momentum or random walk? And is it wise to calculate half life everyday?

      Thanks

      Delete
  31. Hi VHanded,
    We can't really tell whether the period of momentum or random walk will be temporary or permanent unless you have some fundamental understanding of the pair. In any case, one should gradually decrease leverage in this situation.

    It isn't really necessary to update half life every day. Probably monthly update is enough.

    Ernie

    ReplyDelete
  32. Hi Mr.Chan,
    I was following your strategy on roll returns in the VX-ES spread.
    I'm not sure about the meaning of this line of code:
    "ret=smartsum(lag(positions).*(y-lag(y, 1)), 2)./smartsum(abs(lag(positions.*y)), 2)-...
    onewaytcost*smartsum(abs(positions.*y-lag(positions.*y)), 2)./smartsum(abs(lag(positions.*y)), 2);"

    If I'm not wrong, you compute the difference between VX(T) -VX (T-1) and multiply this for the signals of the "position" matrix previously built. Then, for every day, you calculate the daily P&L (sum VX and ES return for day T).So far so good.
    Then you subtract the commission costs (onewaytcost=1/10000).Ok.
    What I don't understand is the denominator used: I was expecting to divide the daily spread for the previous day price but I read "smartsum(abs(lag(positions.*y)), 2)"....why???

    In fact, unlike previous codes (that I managed to update to new Matlab functions), this time, every day, I have returns=0 (and so cumulative return is =0).
    Last question about this strategy: As VX and ES are negatively correlated, this time we BUY (or SELL) both of them. So buy ES AND buy VX at the same time (or sell both of them). Am I right?
    Thanks

    ReplyDelete
  33. Hi,
    The denominator represents the gross market value of the position. It is not the spread. It is the sum of the absolute value of the market values of each side of the spread.

    Did you get positions==0 everyday? If so, there must be something wrong in your revision of the code. I certainly get non-zero positions.

    Yes, we buy both ES and VX, or sell both.

    Ernie

    ReplyDelete
  34. Ok, I finally made all changes and substituted the normal "sum" function with "nansum" and made returns computations step by step.
    Anyway...is it normal that I have a cumulate return (over period you indicated, 29 July 2010 -8 May 2012) of almost 60%????
    I checked all steps and computations and it seems ok.
    Than I checked your APR and Sharpe ratio results and I found out that they perfectly fit mine. However...it matches your "hedge ratio [1 1] option"(I thought I was following the "no hedge" oprion).
    Anyway, as I can't check your cumulate returns, can u confirm that my 60% is ok with your results?
    Thanks

    ReplyDelete
  35. Hi,
    There is no need to substitute the sum function with nansum. There is an option called 'omitnan' in the sum function.

    Yes, 60% cum return over 2 years is quite possible in a backtest. There is a lot of in-sample fitting when we backtest. If a strategy didn't do well in backtest, we wouldn't even be talking about it. That in itself is in-sample fitting.

    Ernie

    ReplyDelete
  36. Hi Ernie, I am confused about the sentence in your 'Algorithmic Trading' book:
    'If the contracts are in backwardation, meaning the near (close to expiring)
    contracts have higher prices than the far contracts, then the roll returns
    will be positive; otherwise if the contracts are in contango, then the roll
    returns will be negative.'
    I thought the definition of backwardation and contango were different. It seems that you just gave the definition of inverted and normal markets respectively. I thought contango/backwardation meant that the forward price is above/below the spot price... my confusion is of course due to my lack of knowledge.

    ReplyDelete
  37. Hi Mark,
    The two definitions are almost equivalent, and practitioners often use one or the other to determine backwardation.

    For e.g. for WTI crude oil, the spot price is determined by the front contract, not the physical oil price since that is a non-unique, OTC price.

    For many other contracts that have spot price that from the front contract price, it is still more difficult to obtain the real-time spot price for the underlying physical than for the front contract. Hence most traders use the spread between front and back contracts to determine backwardation.

    Ernie

    ReplyDelete
  38. Hi Ernie,
    As your student in the 2022 EPAT course, I back-tested the USO/XLE-based strategy and got impressive results. Sadly, since I am from India, I cannot short USO or XLE. There aren't any Indian equivalent ETFs.
    Are there any alternatives to capture the roll returns for crude oil futures?

    ReplyDelete
  39. Hi Ajit,
    Good to hear from you!
    USO is nothing but a basket of CL futures on the CME, so you can just trade CL.
    However, you do need to be able to short stocks in order to implement XLE. If you can, then you can just create your own basket of oil stocks to short.
    Ernie

    ReplyDelete