pairs trading
DESCRIPTION
The presentation I gave in my investment class about paris trading. I implemented a experiment using R language to identify good pairs from S&P 100 universe. The algorithm is to perform ADF test on the spread of two random stocks and find out the pairs with stationary spread (co-integrated pairs). Pairs identification period is from 2010/11 to 2012/10, test period is from 2012/11 to 2013/12. Finally I got 33 pairs out of 4950 candidates, and I conduct a summary on the experiment result.TRANSCRIPT
![Page 2: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/2.jpg)
Agenda
Intro: What is pairs trading?
Analysis: Performance & risks
Theory: Why pairs trading works?
Experiment: Real world experiment by R language
Summary: Conclusion & remarks
![Page 3: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/3.jpg)
History
Pioneered by Gerry Bamberger and Nunzio Tartaglia
Quantitative group at Morgan Stanley in the 1980s
A notable pairs trader: Long-Term Capital Management
![Page 4: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/4.jpg)
Pairs trading is…
Market neutral trading strategy
![Page 5: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/5.jpg)
Pairs trading belongs to…
Statistical Arbitrage
![Page 6: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/6.jpg)
Basic idea
![Page 7: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/7.jpg)
Basic idea: Step 1
Select 2 stocks which “move together”
![Page 8: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/8.jpg)
Basic idea: Step 2
Sell high priced stock
Buy low priced stock* Same size of each position (price * shares)
![Page 9: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/9.jpg)
How to get profit…
2 Stock price “Move Together”: Diverge & Converge
* PFE: Pfizer Inc. (Pfizer) is a research-based, global biopharmaceutical company.* VZ: Verizon Communications Inc.
![Page 10: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/10.jpg)
PFE: ShortVZ: Long
PFE: LongVZ: Short
* PFE: Pfizer Inc. (Pfizer) is a research-based, global biopharmaceutical company.* VZ: Verizon Communications Inc.
: Hedge ratio
![Page 11: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/11.jpg)
How to identify good pairs…
Factor
Behavior
Price ratio:
Spread:
Relative return:
“Stable” = “Good”
![Page 12: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/12.jpg)
Measuring “Stable”
Stationary
Co-integrated&
![Page 13: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/13.jpg)
Co-integrated vs. Correlated
Co-integrated Long term Co-movement of price Random walk each Mean-reversion
Correlated Short term Co-movement of return Both move in the same direction Trend only, not sensitivity
![Page 14: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/14.jpg)
Co-integrated ≠ Correlated
![Page 15: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/15.jpg)
Statistical test
Correlation of daily return
Run test: reject the null hypothesis of random walk
KPSS test: value change
IKPSS test: direction change
Sum of squares:
Adjusted Dickey-Fuller (ADF) test: unit root
* Price Ratio
![Page 16: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/16.jpg)
Measure performance
Compare with indiscriminate pairs
Using same trading method
![Page 17: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/17.jpg)
Performance (Jan-92 ~ Jan-10)
![Page 18: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/18.jpg)
After selecting the good pairs
Market neutral ≠ Risk-free
![Page 19: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/19.jpg)
Timing is critical
6%25%+
![Page 20: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/20.jpg)
Timing is critical
3.3% decrease 0.73% decrease
![Page 21: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/21.jpg)
Volatility matters
![Page 22: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/22.jpg)
Model fails
Precision & Recall
![Page 23: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/23.jpg)
Trigger is important
One strategy doesn’t fit all!
![Page 24: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/24.jpg)
Other Impacts
Transaction cost
Trade execution
Time horizon
Risk free rate
Opportunity neutralized with too many arbitrageurs
etc…Market neutral depends on moving in same
direction
What if spread diverge and never converge again?
![Page 25: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/25.jpg)
Theory
Linear model
Log of price
Log of price ratio
Dynamic
Neutralized with same exposure to risk factors
Idiosyncratic risk
![Page 26: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/26.jpg)
Experiments with R language
Stocks S&P 100 4950 potential pairs Identifying (Learning) period: 2010-11-30 / 2012-11-30 Trading (Test) period: 2012-11-30 / 2013-11-30
Algorithm ADF
Factor Price ratio Spread
Source Code: https://github.com/artyyouth/r-quant
![Page 27: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/27.jpg)
However…
Price ratio doesn’t work at all…
![Page 28: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/28.jpg)
So…
Spread!
* Only accept potential pairs with p-value < 0.011 in ADF test
* Filter out with constrains:• 1st quartile > -1• 3rd quartile < 1
![Page 29: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/29.jpg)
Bingo!
364 out of 4950 candidate pairs!
33 out of 364 good pairs!
![Page 30: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/30.jpg)
33 Good pairs
MDT & MMM
MO & WMT
CL & COST
C & GS
MDLZ & MON
BK & MET
MDLZ & UNH
ALL & DIS
ABT & WMT
ABT & COST
ABT & PM
PFE & RTN
ABT & PFE
MDLZ & UNP
PFE & WMT
ABT & CVS
MO & PM
F & FCX
MO & SPG
ABT & VZ
ABT & T
F & MET
F & GS
BMY & SO
ABT & CL
GE & WFC
ABT & MO
GE & MDT
PFE & VZ
GE & RTN
MDLZ & SO
PFE & UNP
F & GM
Not all are as good as expected...
![Page 31: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/31.jpg)
Good spreads
![Page 32: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/32.jpg)
Bad spreads
![Page 33: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/33.jpg)
Does model really fails?
Beta, Mean, Standard deviation are keep changing along the time!
![Page 34: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/34.jpg)
After adjust Beta, Mean, SD
Much better!
![Page 35: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/35.jpg)
Summary
Stock pairs are viewed in the literature as pairs of securities which share common risk factors
Profit comes from spread swings
Volatility decides the speed of mean reversion
Market is very dynamic, strategy should adapt it to survive
![Page 36: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/36.jpg)
Next…
Improve pairs selection with better factors and method
Integrate with fundamental model?
Dynamic & sophisticated trading rules by analyzing spread curve
…
![Page 37: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/37.jpg)
Reference
• Pairs trade: http://en.wikipedia.org/wiki/Pairs_trade • Null hypothesis: http://en.wikipedia.org/wiki/Null_hypothesis • Algorithmic trading: http://en.wikipedia.org/wiki/Algorithmic_trading • Execution management system: http://en.wikipedia.org/wiki/
Execution_Management_System • Time series: http://en.wikipedia.org/wiki/Time_series_analysis • Market timing: http://en.wikipedia.org/wiki/Market_timing • Ornstein-Uhlenbeck process: http://en.wikipedia.org/wiki/Ornstein%E2%80%
93Uhlenbeck_process • Autoregressive-moving-average model: http://en.wikipedia.org/wiki/
Autoregressive_moving_average • Error correction model: http://en.wikipedia.org/wiki/Error_correction_models • Co-integration: http://en.wikipedia.org/wiki/Cointegration • Downside risk: http://en.wikipedia.org/wiki/Downside_risk• Statistical arbitrage: http://en.wikipedia.org/wiki/Statistical_arbitrage • Convergence trade: http://en.wikipedia.org/wiki/Convergence_trading • Fears more than death:
http://www.psychologytoday.com/blog/the-real-story-risk/201211/the-thing-we-fear-more-death
![Page 38: Pairs Trading](https://reader033.vdocuments.site/reader033/viewer/2022061300/54c9576a4a7959dd078b45c8/html5/thumbnails/38.jpg)
Q & A
Thank You!