Close

Finding Pairs

This tutorial written and reproduced with permission from Peter Ponzo

(Pairs Trading – Part II)

As an example, let’s consider a couple of car manufacturers: General Motors and Ford. Over the past five years their weekly stock prices have changed like Figure 1.

They tend to move together, eh?

 

Pairs Trading
Figure 1

If you say so.

Well, perhaps it’s better to look at the percentage changes over the past five years. In addition to that, we’ll also look at the Pearson correlation between raw prices. Then we’ll calculate the Rank for each series of Prices and calculate the Spearman correlation for these ranks.

Here’s what we’d get:

 

Pairs Trading
Figure 2

 

What about that normalized stuff?

Ah, yes. We consider not the Price, but (Price – Mean)/Standard Deviation. Using those normalized prices gives:

 

Pairs Trading
Figure 3

 

They look the same to me.

The correlation, both Pearson and Spearman, are the same. The normalization doesn’t change them.

The why normalize at all?

It makes the mathematicians happy.

Is that it?

Not at all. We could look at the Ratio of prices over the past five years and get Figure 4.

 

Pairs Trading
Figure 4

 

That’s (GM Price) / (Ford Price)?

Yes, and we see that, although the average ratio was about 3.0, GM was way too high in March of 2003.

Or Ford was way too low!

Uh … yes. So we’d buy Ford and sell short GM.

And make a bundle, eh?

Well, their prices at the beginning of March/03 were: GM = $26.53 and Ford = $6.50. In one year (March/04), their prices were: GM = $43.34 and Ford = $13.12

So they both went up!

Yes, but although GM went up 63%, Ford went up over 100%.

And you’d make money on that?

We’d lose on GM but make a bundle on Ford.

And now you’ll look at correlations between Returns, eh?

Instead of Prices? I don’t think so. If we consider returns, both Pearson and Spearman Rank correlations were down at 66-68%.

So we’d probably conclude they weren’t related, right?

I’d guess so. That is, with a 67% correlation they wouldn’t be regarded as sisters. In fact, even considering price differences doesn’t seem particularly revealing. (See Figure 5.)

And the difference between those “normalized” Prices?

Even considering differences between normalized prices, identifying “sister stocks” doesn’t seem obvious.

Pairs Trading
Figure 6

 

And you don’t even want to see the Ratio of normalized prices!

Okay, what would you use to identify “pairs”?

I’d like something where the historical relationship jumps out at you… and you know which to buy and which to sell short. Further, I don’t like ratios of anything since the numerator and denominator have different effects on the ratio. The criterion for pairs should be symmetrical in both stock variables, whether prices or retturns.

And that makes your choice … what?

I don’t know. I’ll have to investigate and …

With a spreadsheet, right?

Yeah. I now have one that tries to identify pairs. It looks like this:

 

Pairs Trading

 

Click on picture to download spreadsheet

You type in ten stock Yahoo symbols and an End Date then click a button and get a year’s worth of daily prices. Then the spreadsheet calculates the Spearman Rank Correlation between pairs of stock, colouring them either reddish (if the correlation is greater than 90%) or bluish (if less than 80%) or greenish if in between … like Figure 7.

Pairs Trading
Figure 7

Reddish? Greenish? You kidding?

You can choose your own colours … and the limits:

 

Pairs Trading

You do the Spearman, eh? So what happened to poor ol’ Pearson.

He’s there too … the Pearson correlation between Prices is displayed, like Fig. 7.

So how do you know the sister stocks will remain sisters in the future?
I mean …

Yes, I know what you mean … but you have to play with the time period (which explains why the End Date is there). For example, when we end in March 2006 we get a 91% correlation between a couple of gold stocks: Barrick Gold (ABX) and Goldcorp (GG):

 

Pairs Trading

 

If we go back a year we’d get this:

 

Pairs Trading

 

And if you go back two years?

Just download the spreadsheet and play with it yourself !