Pair Trading (Continued)

In this post we will discuss some other basic aspects of pair trading. As we have already discussed, correlation is usually utilized in pair trading. However, it is not enough for the two instruments to be just highly correlated. It’s believed that they should be aslo cointegrated. Cointegration is a statistical property of two or more time series such that their linear combination is a stationary (mean reverting) time series. Let’s take an example:


xt represents the price of instrument X at time t,

yt represents the price of instrument Y at time t.

We say that the two time series xt and yt are cointegrated, if a linear combination exists, such that:

yt – β.xt = μ + εt,

where β is some constant that has to be found, μ is the mean of cointegration process and εis a stationary time series called cointegration errors. In simple words: if we know that two instruments are cointegrated and we know β, then the combination of yt – β.xt will be always equal (or close enough) to some mean value (μ). The error εreprisents the deviation from the mean value. Having all this, it becomes trivial to find moments of higher deviation from the mean and take orders on both pairs. If we open 1 lot on symbol Y we should open β lots on symbol X. Cointegration gives us some certainty that our combination will return to the mean because εis stationary.

This may look simple but some advanced math is involved with cointegraion. We usually pick highly correlated instruments and then apply tests for cointegration.

First we need some data preprocessing. Market time series are non-stationary time series, their mean and variance change over time and they follow trends. It is needed to transform the price data so it becomes stationary. Otherwise, if we combine two non-stationary time series, it is not possible to get a stationary time series as a result. And remember our goal is that εt is stationary. Here usually some differencing takes place and instead of raw price data we use the price differences:

y’t = yt – yt-1

x’t = xt – xt-1

Second we need to test our selected symbols for cointegration. There are several approaches among which the Engle–Granger two-step method and Johansen test are most common. The first one is simpler but has some drawbacks, it gives slightly different results depending on which of the two instruments is first. The Johansen test is believed to be better but it involves more advanced math operations and larger sample data. I won’t go into any math details related to these tests now. If there’s anyone interested, please leave a comment and I will consider revealing the math in a separate post.

If cointegration is confirmed and we plot the cointegration error εt, it should look similar to this:

cointegration

As you can see the graph oscilates around the mean value μ and always returns to the mean. We open trades at the extremes of εt, the bigger is the extreme the better. Usually some minimum threshold is selected such that it will cover the spread/comissions invloved with the trades and some profit is achieved. Trades are closed either at the mean or at the following opposite extreme.

Cointegration can be extended further to include several instruments and that’s what the hedge funds usually do – create a portfolio of several cointegrated instruments.

8 Comments

  1. Casey

    I’d have to talk with you here. Which is not a thing I usually do!
    I love reading a post that’ll make people think.
    Furthermore, thanks for allowing me to comment!

  2. Kristeen

    h my goodness! an amazing article dude. Many thanks Nevertheless I’m experiencing concern with ur rss.

    Don’t know why Not Able To subscribe to it.
    Is there anyone receiving equivalent rss issue? Anyone who knows
    please respond.Thanks

  3. Patrick

    Hello I am so thrilled I found your site, I
    really found you by accident, while I was looking on Google for something
    else, Anyhow I am here now and would just like to say cheers for a
    marvelous post and a all round exciting blog (I also love the theme/design), I don’t have
    time to go through it all at the moment but I have bookmarked it and also added your RSS feeds,
    so when I have time I will be back to read much more,
    Please do keep up the excellent work.

Leave Comment