Module 10 Trading Systems

Chapter 2

Pair Trading Basics

24

2.1 – The idea

If you have ever been on an interstate highway, then you would have noticed that the highway usually includes the main highway, on which the vehicles zoom by at full speed. On either side of the highway, it is common to find a single road, which is often called the service road. The service road is used to give access to private driveways, shops, houses, industries or farms. These service roads are also known as the local-express lanes. The service road and the highway usually run parallel to each other for the entire length.

Now imagine this – assume a new highway and service road is being commissioned. The road contractor has stated the work of laying down the highway and service road. At one point, on this new service road, the contractor encounters a small little tree.  Now, for whatever reason, the road contractor decides not chop off the tree but instead circumvent it by taking a small deviation from the tree and get back on track to run parallel to the highway.

The road gets built this way, and people start using it. What do you make of it?

If you think about it – the two roads run parallel to each other, for the entire stretch. At any part, if the highway is inclined, so would the service road. If the highway goes down, so would the service road. If the highway crosses a river, so would the service road. So on and so forth. So for all practical purposes, the two roads ‘behave’ somewhat identically, except at that point where the tree briefly obstructed the path on the service road.

Let’s take this a step further and break it down into variables –

  1. Entities  – Highway and the service road
  2. Relationship – The two entities are defined by their parallelity. What happens to one entity (highway) is likely to happen to the other (service road)
  3. Relationship anomaly – In an otherwise perfect world, the tree on the service road causes a brief break in the parallelity of the two roads
  4. Effect of the anomaly – The anomaly is short-lived, the roads are quick to regain their relationship

I know this is a weird analogy, but if you can somehow imagine this highway, service road, and that tree, and the parallel relationship between them, then you will (hopefully) understand the underlying philosophy of pair trading.

So let me attempt to do that.

Now, just like the two roads (or entities as we defined them) i.e the highway and service road – think about two companies which are similar, let’s say – HDFC Bank and ICICI Bank.

By the way, if you pick up any classic book on Pair Trading, you will come across the example of Coca-Cola and Pepsi. Since they are not listed in India, let’s go ahead with ICICI and HDFC.

  1. Both these banks are very similar in every respect
  2. Both are private sector banks
  3. Both have similar banking products
  4. Both cater to similar client base
  5. Both have similar presence in the country
  6. Both banks have similar regulatory constraints
  7. Both banks have  similar challenges in terms of running the business

So on and so forth.

Given the striking similarities between the two banks, whatever change in the business environment affects one bank, the 2nd bank should be affected in the same way. For example, if RBI increases the interest rates, then both the banks would be affected the same way and likewise when the rates are lowered.

Up to this point, we can define –

  1. The entities – HDFC and ICICI
  2. The relationship – similar business landscape

Given the above inference, we can make the following conclusion –

  1. Because both the business are so alike, their stock price movement should be similar
  2. On any given day, if HDFC Bank’s stock price goes up, then ICICI Bank’s stock price is also expected go up as well
  3. If HDFC stock price comes down, then ICICI’s stock price is also expected to come down

We can generalize this –

Given there is a well-established relationship between the two companies, considering all else equal, if the stock price of entity 1 moves in a certain direction, then the stock price of entity 2 is also expected to make a similar move. If not, then there could be a trading opportunity.

For example, all else equal, on a given day, ICICI stock price moves up by X% then given the relationship, HDFC is also expected to move up at least y%, but for whatever reason, assume HDFC stayed flat. Then we can go ahead and claim that ICICI stock price has moved higher than expected when compared to HDFC’s stock price.

In the arbitrage world – this translates to buying the cheaper stock i.e HDFC and selling expensive one i.e ICICI.

In a nutshell, this is the essence of ‘Pair Trading’.

Hang on a second – what about the tree on the service road and its relevance to the whole narration? Well, remember the tree caused the anomaly in an otherwise perfect ‘parallel’ relationship between the two roads?

Likewise, in an otherwise perfect relationship between the stock prices of two companies – an event can trigger a price anomaly – where the price of stock 1 can deviate from the price of stock 2.

An anomaly in stock prices gives us an opportunity to trade. The anomaly can happen because of anything –

  1. HDFC Bank announcing quarterly results – on an immediate basis this impacts HDFC more than ICICI, hence the price relationship between the two changes, only to be realigned later
  2. Likewise with ICICI announcing its results
  3. A top executive at one of these banks resigns, causing a minor dent in its stock price, while the other continues  to trade regularly
  4. Excessive speculation in stock 1 compared to stocks 2

Generally speaking, a price anomaly is a local event, which causes the stock price of one company reacts (or overreacts) compared to the other. I prefer to call it a local event because it affects only 1 company in our universe of two stocks J

So the relationship essentially sets the rules on how the two stock prices are related. Therefore, the bulk of the work in pair trading revolves around –

  1. Identifying the relationship between two stocks
  2. Quantifying their relationship
  3. Tracking the behavior of this relationship on a daily basis
  4. Looking for anomalies in the price behavior.

There are multiple ways to define these relationships between two stocks. However, the two popular techniques are based on–

  1. Price spreads and ratios
  2. Linear Regression

Both these techniques are different and sort of elaborate. I intend to discuss both these techniques in Varsity.

Before we close this chapter – a quick note on the history of Pair trading.

The first pair trade was executed by Morgan Stanley in the early 80’s by a trader named Gerry Bamberger. Apparently, Gerry discovered the technique and kept it ‘proprietary’ for the longest time, until another trader called Nunzio Tartaglia, again from Morgan Stanley, popularized it.

Nunzio, at that time, had a huge following, considering he was one of the pioneers in ‘Quant trading’ on Wall Street. In fact, he led Morgan Stanley’s prop trading desk in the 80’s.

DE Shaw, the famed Hedge Fund, adopted this strategy in its initial days.

2.2 – Few closing thoughts

As you may have guessed, pair trading requires you to buy and sell two stock/assets/indices simultaneously. Many familiar with this believe that pair trading is a market neutral strategy. Market neutral, because you are both long and short at the same time. This is grossly wrong, simply because you are essentially long and short on two different stocks.

To be market neutral, you need to be – long and short, on the same underlying, at the same time. A good example here is the calendar spread. In a calendar spread, you are long and short on the same underlying expiring on two different dates.

Hence, please do not be under the impression that pair trading in market neutral. This is a trading strategy that seeks to take advantage of price differentials between two, related assets.

By simultaneously buying and selling the two assets, we are trying to profit from the “relative value” of the two securities. For this reason, I’d like to refer to Pair trading as ‘Relative Value trading’.

If you think about this, in its pure sense, this is an arbitrage opportunity – we buy the undervalued security and sell the overvalued security. For this reason, some even call this the Statistical Arbitrage.

The measurement of ‘undervalued’ and ‘overvalued’ is always with respect to the one another – and the measurement technique is what we will start learning next chapter onwards.


Key takeaways from this chapter

  1. The stock prices of two companies with similar business landscape tends to make similar price moves
  2. The prices moves can be quantified by
  3. A local event (particular to 1 company) can create an anomaly in the price movement
  4. When an anomaly occurs an opportunity to trade arises
  5. In pair trading, you buy the undervalued security and sell the overvalued one
  6. Pair trading is also called – Relative value trading or statistical arbitrage

 

 

 

24 comments

  1. Sujeet Raj says:

    I am looking into making an algorithmic trading system based on Pairs Trading and this really helps. Thank You

    I needed historical and real-time intraday data and was looking at Global Data Feeds with Zerodha’s Partnership. Saw a sample and noticed that it doesn’t contain Implied Volatility figures min by minute.

    Is Implied Volatility for each stike of stocks required if you want to calculate the Greeks? I don’t think using India VIX’s ticks would be accurate because it is mostly for NIFTY. And even then would be accurate for NIFTY strikes as Volatility Smile can have different rates of increment/decrement?

    Is there any source where IV can be found? Otherwise can we calculate it? Maybe we will need the whohle orderbook for this and thus a Level 2 quote.

    • Sujeet Raj says:

      Altough I want to use options. And on constant monitoring, I think some anomalies exits. They don’t exactly behave as theoretical. I think maybe due to real-time variations in the greeks, sometimes more than usual. Wanted to back test some ideas. But can’t find IV values anywhere 🙁

      • Karthik Rangappa says:

        Yeah, IVs is a problem. Btw, I should have mentioned this earlier…NSE puts up the IV on the option chain page, maybe you can start with that for time being. However, its not very consistent.

        • Kumar N KristeR says:

          Well done Mr.Karthik, I thank you from bottom of my heart for your sincere and effective efforts.

          And I requesting you to plaese make available one more Module on ”Mutual Funds.”
          Hopefully you would consider my request and i will be waiting for it.

          Once again Thank you very much…

    • Karthik Rangappa says:

      Ah, no clean source for IVs, Sujeet. You can calculate it yourself, quite a task considering the math involved. L2 is what you get from the broker – top 5 bid and ask is L2.

  2. Keval says:

    Brilliant !
    But the contents are too less about Pair Trading. Advantages and disadvantages should have been included !

  3. Ravi Kumar BA says:

    Wonderful..Looking ahead for next module.

    Karthik, What is your personal experience on this strategy? I know, what works for you , may not work for someone else…But just out of curiosity asking!

  4. Waqaar says:

    Good content but very less content not like option modules :(.

  5. Gouse Mohammad says:

    Brilliant!!
    Great work guys cant wait for the next chapter, and seriously waiting for the pdf version of module 9 please make it happen soon
    Thank you

  6. Umer Azam says:

    is it true for two stocks who have very high correlation between them?

    what if they happen to be inn different sectors? how to find such two stocks?

  7. kpratiraj says:

    I trade October futures of PNB stock . If I sell PNB futures on 19 October at 130 rate .
    Means , Now I have sell position.
    3500 x 130 =455000 rs.
    Span =34580
    Exposure =22750
    Total=57250

    So If stock mover 1 point , I lost my 3500 rs.
    If stock moves 16 to 17 points , I lost my all money .

    On 25 October stock opens near 160 , means I lose 30 points , = 3500 x 30 = 105000 rs. There is no chance for broker to close positions at loss of 70 to 80 %.

    Loss is more than my capital.

    1. What shows my screen to me on 25 October ?
    2. Can I come into lone ?
    3. If I dont left any money , what is happen ?
    4. There is chance of court case ?

    • Karthik Rangappa says:

      Yes, if it drops 16 points your position will be closed, assuming you don’t have any more funds in your account. Please note, brokers will alert when the position starts making a loss below the exposure margin, inching towards SPAN. Hence they will cut the position if it goes below SPAN.

      If you’ve made a loss, and you don’t have sufficient funds, then you will have to make your broker good, otherwise, you are liable for a legal action.

  8. kpratiraj says:

    It is just doubt .

  9. kpratiraj says:

    Thanks . Cheers. Can Zerodha take legal action If this type of situation is happen ?

  10. Papri Halder says:

    Waiting for this module “Trading System” from ZERODHA!!!! Wil it be different from the other system available in different books?

Post a comment