I recently implemented some pairs trading strategies for a paper, and decided to share an implementation of the Gatev, Goetzmann & Rouwenhorst (2006) strategy on a short article on RPubs.
#rstats #RPubs #DataScience #finance #pairstrading #reproducibility
In the RPubs post above, I provide the #R code to backtest the strategy, as well as some results replicating Gatev, Goetzmann & Rouwenhorst (2006) and Do and Faff (2010), and extending the sample to the end of 2020. In this thread, I show some of these results.
Pairs trading is a type of systematic trading strategy based on finding pairs of stocks or assets that have historically "moved together", and betting that divergences will eventually get corrected. It is a simple form of statistical arbitrage.
A pairs trading strategy usually has two components:
• Criteria to select pairs
• Trading rules to trade the selected pairs
There are many ways to select pairs. A few popular ways:
• selecting pairs with minimum distance between prices
• selecting pairs that show a cointegration relationship
• selecting highly correlated pairs
• using copulas to model the relationship between the stocks
I used to trade pairs in the Brazilian market. In my experience, the models that worked more consistently relied on cointegration, ie there is some statistical assurance that, if the prices diverged, they are likely to converge (until the cointegration relationship breaks!).
Gatev, Goetzmann and Rouwenhorst (2006) (GGR) is probably the most influential paper on pairs trading. They test a distance-based pairs trading strategy that selects the top 20 pairs with minimum distance in the space of normalized prices with dividends reinvested.
The setup of GGR is quite simple.
• Pair selection: select the top 20 pairs with min distance using a formation period of 12 months
• Trading period: trade the 20 pairs over the next 6 months
• Trading rules: open a trade if |spread| > 2 historical std deviations. Close a trade on convergence or at the end of the trading period.
GGR analyze two ways to form a portfolio of pairs.
• Committed capital: allocate capital equally to selected pairs at all times (even if trades are not open)
• Fully invested: allocate capital equally to all currently open pairs
The graph below shows an example of a pair selected using the GGR approach. The stocks seem to move very closely together during the formation period:
In the formation period, the spread (difference between the two prices) behaves quite nicely and mean-reverts frequently:
In the trading period, however, the historical pattern seems to have broken down. If we had bought the pair upon divergence, we would have lost money, as it never converged. This is one of the main risks in pairs trading.
The graph below shows another example of a pair that would have produced profitable trades:
Even though the model is quite simple, it showed high returns during the GGR sample period (1963-2002). Later, Do and Faff (2010) extended the sample to 2009, and showed that the profitability decreased a lot, although the strat still delivered decent returns during 2008 period.
So how does the strategy fare more recently? The graph below shows monthly excess returns and 12-month moving average. Clearly, the good days when this simple strategy worked are gone.
Cumulative returns since 1963:
And since 2003. After 2009, the equity curve is mostly flat. This is before transaction costs, even though there's a one-day delay in opening trades.
Some performance stats for different periods:
Post-2009 (need to fix the title!). Average returns are no longer statistically significant.
Overall, it seems the strategy's profitability is completely gone. Even during the recent market turbulence due to the pandemic, the strategy did not deliver significant returns.
Of course, it is possible that more sophisticated models, or models operating at higher frequency, may still be profitable. A good review of different approaches is provided by Krauss (2017). doi.org/10.1111/joes.1…

• • •

Missing some Tweet in this thread? You can try to force a refresh

Keep Current with Alexandre Rubesam

Alexandre Rubesam Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!


Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!

This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!