Pairs Trading Strategies

Awhile ago I published an article about constructing a pairs trade using futures. Initially it wasn’t particularly popular, to put it mildly, suggesting the real answer to my question of whether its cool to trade futures again is an emphatic NO.

Then one day I wrote a post about using the Kalman Filter in pairs trading, which garnered significantly more attention. That article was a loosely-coupled sequel of sorts, and as often happens on the internet, suddenly there was demand for the long-promised 3rd part in the series: strategies for pairs trading.

This is perhaps the most pragmatic installment in the trilogy. It assumes you have already accomplished the two theoretical steps in constructing a pairs trade, i.e. you have:

  1. Identified a pair of assets which are suitable for pairs trading, perhaps using a Financial Network Graph
  2. Estimated the current parameters of your pairs trading model, for example with some kind of Bayesian Filter

The third step is to define a strategy for executing the pairs trade in reality.

This is more than just defining an algorithm which says “I want to buy the spread at this price and sell it at that price,” although that is part of it. I highlight the connection to reality at this step because you must also determine algorithms for several other critical components of the trade.

By far the easiest part is constructing the spread trading algorithm itself. One of the most popular models is the Ornstein-Uhelnbeck process, which models the spread as a mean reverting process subjected to shocks from random volatility. The trading rules that result from this model can be summarized thusly:

  1. draw a line in the sand (pick your estimate of the mean)
  2. fade the shit out of any divergence from that line; put on bigger and bigger positions as the divergence grows
  3. wait for the spread to return to equilibrium (the mean)
  4. profit!

This strategy works great as long as your spread really is a stable mean-reverting process. In reality correlations move around all the time, exposing your hedge ratios to parameter risk. This makes a pure O-U strategy susceptible to “blow-up” tail risk when correlations change and your spread wanders away from the mean. Correlations don’t really even need to change in the long run, a big enough shock could take you out. Just think LTCM. Nuff said.

My previous article on O-U processes presents a paper which uses a transformation of the model to “tap out” so to speak: choosing a band around the mean where it cease fading the trade. Its all very mathematically beautiful but adds a lot of complexity to implement in practice. Picking a max/min band around the spread accomplishes pretty much the same thing with much less moving pieces.

For an example of this type of logic take a look at Hello, Market Maker. When you really think about it, HMM is very similar to the O-U strategy but with no complexity whatsoever. They both define an equilibrium point and trade around it. If anything the HMM strategy is much more nimble that the O-U in that it adjusts as the spread diverges from its expected range.

The final method we will visit today involves a slight modification to the strategies above. Instead of using a fixed arbitrary starting point, we set the current mean to be the current moving average of the spread. Thus we use the MA as an anchor point to fade from. As the spread moves further away from the MA we fade more size until we reach a maximum pain point. The trade can be unwound due to profit, i.e. the spread returns the to MA or the MA can catch up to the spread, in which case the trade is unwound at a loss.

Many junior traders think that our job is done after this point, just gotta code it up and switch it on! If it was that easy EVERYONE would do it…

Before going any further, you should decide how you want to initiate the trade. A pairs trade constructs a synthetic asset from two or more other assets. If constructed correctly, this synthetic asset will have useful properties like mean reversion and volatility stability. However, even if you craft the perfect spread, in order to capture any profit at all you must properly execute trades in each asset. The are many pitfalls in the translation from theory to reality; after parameter risk comes execution risk.

We can minimize the risk of bad execution by deciding which asset will be the initiator and which will be the hedge. By initiator I mean the asset we trade first when a pairs trade signal has been received. Take a second to digest what a wise strategy programmer once told me: in your backtest model you might be able to do two things at once — especially if you are using minute or daily or any panel data — but in reality everything is sequential, something always happens before something else.

This sounds ludicrously simple but its a fucking deadly serious consideration a lot of Quant-Trader types throw out the window as soon as they pick a statistical arbitrage model. You have to buy one side of the spread before selling the other. Mind. Blown.

So how should we implement our strategies to jump over this hurdle imposed by market microstructure?

Market orders? Launching two marketable limit orders into the book is no guarantee of getting a fill, especially in fast markets where exchange latency increases. Using pure market orders would be INSANE (although people do it), what if you need a hedge and the bid is a stub quote? Have fun shutting down your trading strategy and calling the exchange to break a bad hedge when liquidity is evaporating all around you and aren’t really sure what your position is.

In practice you will want to choose one side of the pair to initiate the trade and one as a hedge. This distinction could change over time due to market conditions but at any given moment you always have an initiating leg and a hedge leg in a pairs trade.

I cannot overstate the importance of this enough, the difference between a successful pairs trade and a blow-out can be the choice of an initiator. That being said, what would make you choose one side over the other to be the initiator?

Liquidity plays a major role in this decision. More specifically, the relative liquidity is what you really need to look at. What do I mean by this?

  • What are the average bid/ask spread sizes in each asset?
  • Whats the average size of the inside market (i.e. the average of the inside [bid size + ask size])

There are some basic heuristics to use in looking for good spreads (along the lines of the duck test: if it looks like a duck, quacks like a duck…)

  • The correlation is good but not too good; a 99% coefficient leaves no room for profit
  • The spread in one side is 2x to 3x the other side (big fat spread in initiator, thin cheap spread in hedge)
  • Volume / liquidity in both assets is non-trivial
    • By this I refer to the many illiquid delta-one assets that track an index perfectly but nobody trades
    • You want the hedge to hold up to lots of size thrown into it, i.e. big liquidity on bid/ask

There are certain circumstances in which you might want to alternate which side you initiate/hedge with, for example if you are trading markets with different open/close times (like with cross currency spread trades). In that situation however its really like running two strategies with discrete switching times. In my experience its rare to find two assets in the same market which consistently swap liquidity profiles outside of events, news, or other exogenous factors which can temporarily effect liquidity.

Now that we’ve determined the order of things, the next step is to determine the hedging logic. As I mentioned earlier, the simplest strategy is just to launch a marketable limit order into the book. This is inefficient in all but the tightest of markets, and exposes you to unnecessary expense in the long run. Moreover, the reality of the situation is you will miss hedges and you need logic to clean up when that happens.

Implementing slightly more complex logic could enable you to profit from situations in which you get to buy the bid in one asset and sell the offer in another, resulting in an increased potential for a great fill price. Imagine this situation: your logic has identified a buy signal for a spread. You place a bid in asset A and get a passive fill. Then you hang a sell order on the offer of asset B and wait. A few seconds later you are filled and bingo, a great spread fill is yours!

We all know there are no free lunches in trading, so what is the risk that allows us to capture this better fill? The risk is that asset B will tick down, never filling our hedge and leaving us naked long asset A. How do we minimize this risk and manage hedge misses after the fact?

One way is to assign a simple filter to modify your passive hedge order into a marketable limit at risky times. For example, suppose you placed a passive hedge order on the ask of asset B if and only if the bid size is greater than 100? There are lots of potential ways to make this more sophisticated, sky is really the limit as anything that has predictive ability can improve your chances of going active and hedging at the right time.

If you’re still with me then congratulations, you’re making it deep down the rabbit hole indeed. This information might not make you rich, but it will certainly help you avoid fucking up and looking foolish or worse, having to find a new method of employment.

Interested in resources for Pairs Trading?

Check out the release of SliceMatrix: a unique tool for visualizing the stock market, including views of filtered correlation networks and minimum spanning trees


Enter your email address to follow this blog and receive notifications of new posts by email.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s