SlideShare a Scribd company logo
1 of 47
Download to read offline
Introduction to pair trading
  -Based on cointegration-

       ・Shinichi Takayanagi
         ・Kohta Ishikawa

                               1
Topics
1.   What is pair trading?
2.   What is cointegration?
3.   Idea of pair trading based on cointegration
4.   Simulation by R language
5.   Summary & concluding remarks




                                               2
1. What is pair trading?


                       3
Pair trading was pioneered by …



•   Gerry Bamberger and Nunzio Tartaglia
•   Quantitative group at Morgan Stanley
•   Around 1980s
•   D.E. Shaw & Co. is famous for this strategy




                                                  4
Pair trading is …




Market neutral trading strategy




                              5
Pair trading belongs to …




Statistical Arbitrage


                               6
Basic idea of pair trading …



 Select two stocks
which move similarly

                                 7
Basic idea of pair trading …




Sell high priced stock
Buy low priced stock

                                 8
Basic idea of pair trading …
Stock A : --------
Stock B : --------
                                          Sell
                       Sell             Stock B
                     Stock A



                                       Buy
                                     Stock A
                         Buy
                       Stock B
                                               9
Basic idea of pair trading …



    Usually, monitor
     the difference
between two stock prices

                                  10
Basic idea of pair trading …
   the difference between two stock prices
  Sell
Stock A                          Sell
                               Stock B


       Buy
     Stock B
                                    Buy
                                  Stock A    11
2. What is cointegration?


                       12
Cointegration is …



• Pioneered by Engle and Granger
• Statistical property of time series
• Around 1990s


                                   13
Cointegration is …




Not correlation

                        14
Cointegration and correlation

•Correlation
 –Specify co-movement of return
 –Short term relationship

•Cointegration
 –Specify co-movement of price
 –Long term relationship
                                   15
(weak) Stationary time series

     Not depend on time
・E  X t   
・ X t   
 var                   2


・  X t , X t  s    s 
 cov
                                    16
Example of stationary time series

          White noise
・E  t   0
・  t   
 var                  2


・  t ,  s   0, t  s
 cov
                                      17
Non stationary time series

        Depend on time
・E  X t   t
・ X t    t
                      2
 var
・  X t , X t  s    t , s 
 cov
                                   18
Example of non stationary time series

       Brownian motion

・E Wt   0
・ Wt   t
 var
・ Wt ,Wt  s   t  s
 cov
                                    19
Lag operator   L

・LX t  X t 1
・1  L X t  X t  X t 1  X t
 

                               20
Integrated of order P

X t : non stationary
1  L    p
               X t : stationary


      X t~I  p 
                                  21
Example of “integrate”

  Z t  Z t 1   t : Random walk
   t : White noise
       Calculate difference

Z t  Z t  Z t 1   t : Stationary
 Z t~I 1
                                     22
X t and Yt are cointegrated if …


ut  Yt    X t 
ut : ~I 0, stationary process
X t , Yt : ~I 1

*This is a special version of general cointegration for I(1)
                                                               23
Example of cointegrated time series




                Yt  50  0.5 X t  ut
Xt : --------   X t : 100  2  Normal brownian motion
Yt : --------   ut : 3  Gaussian noise
                                                     24
Example of cointegrated time series




       Plot : ut = Yt – 0.5 Xt
                                      25
ut seems to be…


 Stationary
      &
Mean reversion
                     26
Question




Can we apply this idea
  to trading strategy?

                     27
3. Idea of pair trading
based on cointegration


                      28
Geometric brownian motion

The most widely used model of stock price


dSt
     dt  dWt
 St                          St : Stock price
                              : Average return
                              : Volatility
                             Wt : Brownian motion
                                                29
From Ito’s lemma



                    2
                          
d log St     
                         dt  dWt
                          
                    2    

Log price follow Brownian motion
                                  30
Brownian motion(log price) is …




                    I(1)
* Random walk can be considered as discretization of Brownian motion
                                                                31
Then, we can apply




Cointegration idea
 to log stock price

                          32
Log price spread(*) is…


 Stationary
      &
Mean reversion
※Spreadt : logYt      log X t ,   X t , Yt : stock price
                                                                      33
Simple trading idea

if Spread t  very hish : Buy X t ,Sell Yt
if Spread t  very low : Buy Yt ,Sell X t


 Spread t  log Yt      log  X t 
 X t , Yt : stock price

                                          34
4. Simulation by R language



                         35
Process
1.   Find two likely cointegrated stocks
2.   Estimate spreads
3.   Check stationarity
4.   Create trading signal
5.   Run back-test




                                           36
1.Find two likely cointegrated stocks
> library(PairTrading)
> #load sample stock price data
> data(stock.price)
> #select 2 stocks
> price.pair <- stock.price[,1:2]["2008-12-31::"]
> head(price.pair)
       7201 7203
2009-01-05 333 3010
2009-01-06 341 3050
2009-01-07 374 3200
2009-01-08 361 3140

* Just load sample data in this case….
                                                    37
2. Estimate spreads
> reg <- EstimateParameters(price.pair, method = lm)
> str(reg)
List of 3
 $ spread :An ‘xts’ object from 2008-12-30 to 2011-08-05 containing:
  Data: num [1:635, 1] -0.08544 -0.0539 -0.04306 -0.00426 -0.01966 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr "B"
  Indexed by objects of class: [Date] TZ:
  xts Attributes:
 NULL
 $ hedge.ratio: num 0.0997
 $ premium : num 7.48
                                                                  38
2. Estimate spreads
> plot(reg$spread, main = "Spread“)




    Spreadt  logYt      log X t , X t , Yt : stock price
                                                                      39
3. Check stationarity
> PP.test(as.numeric(reg$spread))
   Phillips-Perron Unit Root Test
data: as.numeric(reg$spread)
Dickey-Fuller = -3.2299, Truncation lag parameter = 6, p-value
   = 0.08278
> adf.test(as.numeric(reg$spread))
   Augmented Dickey-Fuller Test
data: as.numeric(reg$spread)
Dickey-Fuller = -3.6462, Lag order = 8, p-value = 0.02825
alternative hypothesis: stationary

                                                          40
4. Create trading signal
> params <-
  EstimateParametersHistorically(price.pair,
  period = 180)
> signal <- Simple(params$spread, 0.05)
> barplot(signal,col="blue",space = 0, border =
  "blue",xaxt="n",yaxt="n",xlab="",ylab="")
> par(new=TRUE)
> plot(params$spread, type="l", col = "red",
  lwd = 3, main = "Spread & Signal")
                                             41
4. Create trading signal




                           42
5. Run back-test

> return.pairtrading <-
 Return(price.pair, lag(signal),
 lag(params$hedge.ratio))
> plot(100 * cumprod(1 +
 return.pairtrading), main =
 "Performance of pair trading")

                                   43
5. Run back-test




                   44
5. Summary &
concluding remarks


                     45
Summary & concluding remarks
• Pair trading is simple quantitative trading strategy
• Cointegration is long term relation ship of time
  series
• Idea of cointegration may give a chance to make a
  profit from financial market by pair trading

• Next step ….
  – Sophisticate parameter estimation & trading rule
  – Make a simulation close to real

                                                       46
Reference
• Pairs trade(http://en.wikipedia.org/wiki/Pairs_trade)
• Cointegration(http://en.wikipedia.org/wiki/Cointegration)
• Andrew Neil Burgess, “A Computational Methodology for
  Modeling the Dynamics of Statistical Arbitrage”
• Russell Wojcik, “Pairs Trading: A Professional Approach”
• Daniel Herlemont, “Pairs trading, convergence trading,
  cointegration”
• Paul Teetor, “Using R to Test Pairs of Securities for
  Cointegration”(http://quanttrader.info/public/testForCoint.html)
• Ganapathy Vidyamurthy, “Pairs Trading: Quantitative Methods
  and Analysis “



                                                                47

More Related Content

What's hot

The Impact of Algorithmic Trading
The Impact of Algorithmic TradingThe Impact of Algorithmic Trading
The Impact of Algorithmic TradingLov Loothra
 
Momentum indicators in tech. analysis
Momentum indicators in tech. analysisMomentum indicators in tech. analysis
Momentum indicators in tech. analysisPuneet Arora
 
Statistical Arbitrage Strategies
Statistical Arbitrage StrategiesStatistical Arbitrage Strategies
Statistical Arbitrage Strategiesguest8fde7a
 
Algorithmic trading
Algorithmic tradingAlgorithmic trading
Algorithmic tradingTushar Rathi
 
Option Pricing - Greeks
Option Pricing - GreeksOption Pricing - Greeks
Option Pricing - GreeksJawwad Farid
 
Trading Psychology
Trading Psychology Trading Psychology
Trading Psychology bt100
 
Covered call presentation
Covered call presentationCovered call presentation
Covered call presentationstockdoctor57
 
Top 8 Forex Trading Strategies That Pro Traders Use
Top 8 Forex Trading Strategies That Pro Traders UseTop 8 Forex Trading Strategies That Pro Traders Use
Top 8 Forex Trading Strategies That Pro Traders UseSyrous Pejman
 
Algorithmic Trading: an Overview
Algorithmic Trading: an Overview Algorithmic Trading: an Overview
Algorithmic Trading: an Overview EXANTE
 
Techincal analysis chart patterns part 2
Techincal analysis chart patterns part 2Techincal analysis chart patterns part 2
Techincal analysis chart patterns part 2Indranil Bhattacharjee
 
How to build a trading system
How to build a trading systemHow to build a trading system
How to build a trading systemFXstreet.com
 
Dictionary To Stock Market
Dictionary To Stock MarketDictionary To Stock Market
Dictionary To Stock MarketRobin Kapoor
 
Breakout tsla playbook (1)
Breakout tsla playbook (1)Breakout tsla playbook (1)
Breakout tsla playbook (1)smbcapital
 
Magic Breakout Forex Trading Strategy PDF eBook
Magic Breakout Forex Trading Strategy PDF eBookMagic Breakout Forex Trading Strategy PDF eBook
Magic Breakout Forex Trading Strategy PDF eBookeforexcourse web
 
Best Swing Trading Indicators and Oscillators
Best Swing Trading Indicators and OscillatorsBest Swing Trading Indicators and Oscillators
Best Swing Trading Indicators and OscillatorsSwingTradingBootCamp
 
Price Action Trading.pdf
Price Action Trading.pdfPrice Action Trading.pdf
Price Action Trading.pdfShreya292338
 
Option Gamma - Dynamic Delta Hedging
Option Gamma - Dynamic Delta HedgingOption Gamma - Dynamic Delta Hedging
Option Gamma - Dynamic Delta HedgingErdem Tokmakoglu
 

What's hot (20)

The Impact of Algorithmic Trading
The Impact of Algorithmic TradingThe Impact of Algorithmic Trading
The Impact of Algorithmic Trading
 
Momentum indicators in tech. analysis
Momentum indicators in tech. analysisMomentum indicators in tech. analysis
Momentum indicators in tech. analysis
 
Statistical Arbitrage Strategies
Statistical Arbitrage StrategiesStatistical Arbitrage Strategies
Statistical Arbitrage Strategies
 
Forex trading strategy
Forex trading strategyForex trading strategy
Forex trading strategy
 
Algorithmic trading
Algorithmic tradingAlgorithmic trading
Algorithmic trading
 
Option Pricing - Greeks
Option Pricing - GreeksOption Pricing - Greeks
Option Pricing - Greeks
 
Trading Psychology
Trading Psychology Trading Psychology
Trading Psychology
 
Covered call presentation
Covered call presentationCovered call presentation
Covered call presentation
 
Top 8 Forex Trading Strategies That Pro Traders Use
Top 8 Forex Trading Strategies That Pro Traders UseTop 8 Forex Trading Strategies That Pro Traders Use
Top 8 Forex Trading Strategies That Pro Traders Use
 
Algorithmic Trading: an Overview
Algorithmic Trading: an Overview Algorithmic Trading: an Overview
Algorithmic Trading: an Overview
 
Techincal analysis chart patterns part 2
Techincal analysis chart patterns part 2Techincal analysis chart patterns part 2
Techincal analysis chart patterns part 2
 
How to build a trading system
How to build a trading systemHow to build a trading system
How to build a trading system
 
Dictionary To Stock Market
Dictionary To Stock MarketDictionary To Stock Market
Dictionary To Stock Market
 
Breakout tsla playbook (1)
Breakout tsla playbook (1)Breakout tsla playbook (1)
Breakout tsla playbook (1)
 
Japanese Candlestick
Japanese CandlestickJapanese Candlestick
Japanese Candlestick
 
Magic Breakout Forex Trading Strategy PDF eBook
Magic Breakout Forex Trading Strategy PDF eBookMagic Breakout Forex Trading Strategy PDF eBook
Magic Breakout Forex Trading Strategy PDF eBook
 
Best Swing Trading Indicators and Oscillators
Best Swing Trading Indicators and OscillatorsBest Swing Trading Indicators and Oscillators
Best Swing Trading Indicators and Oscillators
 
Price Action Trading.pdf
Price Action Trading.pdfPrice Action Trading.pdf
Price Action Trading.pdf
 
Naked short selling
Naked short sellingNaked short selling
Naked short selling
 
Option Gamma - Dynamic Delta Hedging
Option Gamma - Dynamic Delta HedgingOption Gamma - Dynamic Delta Hedging
Option Gamma - Dynamic Delta Hedging
 

Similar to Introduction to pairtrading

Dynamic Trading Volume
Dynamic Trading VolumeDynamic Trading Volume
Dynamic Trading Volumeguasoni
 
Transactional Data Mining
Transactional Data MiningTransactional Data Mining
Transactional Data MiningTed Dunning
 
Incomplete-Market Equilibrium with Unhedgeable Fundamentals and Heterogeneous...
Incomplete-Market Equilibrium with Unhedgeable Fundamentals and Heterogeneous...Incomplete-Market Equilibrium with Unhedgeable Fundamentals and Heterogeneous...
Incomplete-Market Equilibrium with Unhedgeable Fundamentals and Heterogeneous...guasoni
 
Hedging, Arbitrage, and Optimality with Superlinear Frictions
Hedging, Arbitrage, and Optimality with Superlinear FrictionsHedging, Arbitrage, and Optimality with Superlinear Frictions
Hedging, Arbitrage, and Optimality with Superlinear Frictionsguasoni
 
Black-Scholes overview
Black-Scholes overviewBlack-Scholes overview
Black-Scholes overviewInon Sharony
 
Estimation of Static Discrete Choice Models Using Market Level Data
Estimation of Static Discrete Choice Models Using Market Level DataEstimation of Static Discrete Choice Models Using Market Level Data
Estimation of Static Discrete Choice Models Using Market Level DataNBER
 
Transaction Costs Made Tractable
Transaction Costs Made TractableTransaction Costs Made Tractable
Transaction Costs Made Tractableguasoni
 
Introduction to time series.pptx
Introduction to time series.pptxIntroduction to time series.pptx
Introduction to time series.pptxHamidUllah50
 
UT Austin - Portugal Lectures on Portfolio Choice
UT Austin - Portugal Lectures on Portfolio ChoiceUT Austin - Portugal Lectures on Portfolio Choice
UT Austin - Portugal Lectures on Portfolio Choiceguasoni
 
The Orbit Rulebook.pdf
The Orbit Rulebook.pdfThe Orbit Rulebook.pdf
The Orbit Rulebook.pdfSamm Ikwue
 
Stochastic Dividend Modeling
Stochastic Dividend ModelingStochastic Dividend Modeling
Stochastic Dividend ModelingClebson Derivan
 
Introduction to Interest Rate Models by Antoine Savine
Introduction to Interest Rate Models by Antoine SavineIntroduction to Interest Rate Models by Antoine Savine
Introduction to Interest Rate Models by Antoine SavineAntoine Savine
 
Stochastic Control of Optimal Trade Order Execution
Stochastic Control of Optimal Trade Order ExecutionStochastic Control of Optimal Trade Order Execution
Stochastic Control of Optimal Trade Order ExecutionAshwin Rao
 
An Approximate Distribution of Delta-Hedging Errors in a Jump-Diffusion Model...
An Approximate Distribution of Delta-Hedging Errors in a Jump-Diffusion Model...An Approximate Distribution of Delta-Hedging Errors in a Jump-Diffusion Model...
An Approximate Distribution of Delta-Hedging Errors in a Jump-Diffusion Model...Volatility
 
A Quantitative Case Study on the Impact of Transaction Cost in High-Frequency...
A Quantitative Case Study on the Impact of Transaction Cost in High-Frequency...A Quantitative Case Study on the Impact of Transaction Cost in High-Frequency...
A Quantitative Case Study on the Impact of Transaction Cost in High-Frequency...Cognizant
 

Similar to Introduction to pairtrading (20)

Dynamic Trading Volume
Dynamic Trading VolumeDynamic Trading Volume
Dynamic Trading Volume
 
Transactional Data Mining
Transactional Data MiningTransactional Data Mining
Transactional Data Mining
 
Incomplete-Market Equilibrium with Unhedgeable Fundamentals and Heterogeneous...
Incomplete-Market Equilibrium with Unhedgeable Fundamentals and Heterogeneous...Incomplete-Market Equilibrium with Unhedgeable Fundamentals and Heterogeneous...
Incomplete-Market Equilibrium with Unhedgeable Fundamentals and Heterogeneous...
 
Hedging, Arbitrage, and Optimality with Superlinear Frictions
Hedging, Arbitrage, and Optimality with Superlinear FrictionsHedging, Arbitrage, and Optimality with Superlinear Frictions
Hedging, Arbitrage, and Optimality with Superlinear Frictions
 
Black-Scholes overview
Black-Scholes overviewBlack-Scholes overview
Black-Scholes overview
 
Estimation of Static Discrete Choice Models Using Market Level Data
Estimation of Static Discrete Choice Models Using Market Level DataEstimation of Static Discrete Choice Models Using Market Level Data
Estimation of Static Discrete Choice Models Using Market Level Data
 
Pres fibe2015-pbs-org
Pres fibe2015-pbs-orgPres fibe2015-pbs-org
Pres fibe2015-pbs-org
 
Pres-Fibe2015-pbs-Org
Pres-Fibe2015-pbs-OrgPres-Fibe2015-pbs-Org
Pres-Fibe2015-pbs-Org
 
Transaction Costs Made Tractable
Transaction Costs Made TractableTransaction Costs Made Tractable
Transaction Costs Made Tractable
 
Margrabe option
Margrabe optionMargrabe option
Margrabe option
 
Black-Schole Model.pptx
Black-Schole Model.pptxBlack-Schole Model.pptx
Black-Schole Model.pptx
 
Introduction to time series.pptx
Introduction to time series.pptxIntroduction to time series.pptx
Introduction to time series.pptx
 
DP_M4_L2.pdf
DP_M4_L2.pdfDP_M4_L2.pdf
DP_M4_L2.pdf
 
UT Austin - Portugal Lectures on Portfolio Choice
UT Austin - Portugal Lectures on Portfolio ChoiceUT Austin - Portugal Lectures on Portfolio Choice
UT Austin - Portugal Lectures on Portfolio Choice
 
The Orbit Rulebook.pdf
The Orbit Rulebook.pdfThe Orbit Rulebook.pdf
The Orbit Rulebook.pdf
 
Stochastic Dividend Modeling
Stochastic Dividend ModelingStochastic Dividend Modeling
Stochastic Dividend Modeling
 
Introduction to Interest Rate Models by Antoine Savine
Introduction to Interest Rate Models by Antoine SavineIntroduction to Interest Rate Models by Antoine Savine
Introduction to Interest Rate Models by Antoine Savine
 
Stochastic Control of Optimal Trade Order Execution
Stochastic Control of Optimal Trade Order ExecutionStochastic Control of Optimal Trade Order Execution
Stochastic Control of Optimal Trade Order Execution
 
An Approximate Distribution of Delta-Hedging Errors in a Jump-Diffusion Model...
An Approximate Distribution of Delta-Hedging Errors in a Jump-Diffusion Model...An Approximate Distribution of Delta-Hedging Errors in a Jump-Diffusion Model...
An Approximate Distribution of Delta-Hedging Errors in a Jump-Diffusion Model...
 
A Quantitative Case Study on the Impact of Transaction Cost in High-Frequency...
A Quantitative Case Study on the Impact of Transaction Cost in High-Frequency...A Quantitative Case Study on the Impact of Transaction Cost in High-Frequency...
A Quantitative Case Study on the Impact of Transaction Cost in High-Frequency...
 

More from Kohta Ishikawa

[Paper reading] Hamiltonian Neural Networks
 [Paper reading] Hamiltonian Neural Networks [Paper reading] Hamiltonian Neural Networks
[Paper reading] Hamiltonian Neural NetworksKohta Ishikawa
 
Spherical CNNs paper reading
Spherical CNNs paper readingSpherical CNNs paper reading
Spherical CNNs paper readingKohta Ishikawa
 
Model Transport: Towards Scalable Transfer Learning on Manifolds 論文紹介
Model Transport: Towards Scalable Transfer Learning on Manifolds 論文紹介Model Transport: Towards Scalable Transfer Learning on Manifolds 論文紹介
Model Transport: Towards Scalable Transfer Learning on Manifolds 論文紹介Kohta Ishikawa
 
A brief explanation of Causal Entropic Forces
A brief explanation of Causal Entropic ForcesA brief explanation of Causal Entropic Forces
A brief explanation of Causal Entropic ForcesKohta Ishikawa
 
量子アニーリング解説 1
量子アニーリング解説 1量子アニーリング解説 1
量子アニーリング解説 1Kohta Ishikawa
 
R Language Definition 2.2 to 2.3
R Language Definition 2.2 to 2.3R Language Definition 2.2 to 2.3
R Language Definition 2.2 to 2.3Kohta Ishikawa
 
Nonlinear Filtering and Path Integral Method (Paper Review)
Nonlinear Filtering and Path Integral Method (Paper Review)Nonlinear Filtering and Path Integral Method (Paper Review)
Nonlinear Filtering and Path Integral Method (Paper Review)Kohta Ishikawa
 
Particle Filter Tracking in Python
Particle Filter Tracking in PythonParticle Filter Tracking in Python
Particle Filter Tracking in PythonKohta Ishikawa
 
Rでisomap(多様体学習のはなし)
Rでisomap(多様体学習のはなし)Rでisomap(多様体学習のはなし)
Rでisomap(多様体学習のはなし)Kohta Ishikawa
 
Introduction to statistics
Introduction to statisticsIntroduction to statistics
Introduction to statisticsKohta Ishikawa
 

More from Kohta Ishikawa (11)

[Paper reading] Hamiltonian Neural Networks
 [Paper reading] Hamiltonian Neural Networks [Paper reading] Hamiltonian Neural Networks
[Paper reading] Hamiltonian Neural Networks
 
Spherical CNNs paper reading
Spherical CNNs paper readingSpherical CNNs paper reading
Spherical CNNs paper reading
 
Model Transport: Towards Scalable Transfer Learning on Manifolds 論文紹介
Model Transport: Towards Scalable Transfer Learning on Manifolds 論文紹介Model Transport: Towards Scalable Transfer Learning on Manifolds 論文紹介
Model Transport: Towards Scalable Transfer Learning on Manifolds 論文紹介
 
A brief explanation of Causal Entropic Forces
A brief explanation of Causal Entropic ForcesA brief explanation of Causal Entropic Forces
A brief explanation of Causal Entropic Forces
 
量子アニーリング解説 1
量子アニーリング解説 1量子アニーリング解説 1
量子アニーリング解説 1
 
R Language Definition 2.2 to 2.3
R Language Definition 2.2 to 2.3R Language Definition 2.2 to 2.3
R Language Definition 2.2 to 2.3
 
Nonlinear Filtering and Path Integral Method (Paper Review)
Nonlinear Filtering and Path Integral Method (Paper Review)Nonlinear Filtering and Path Integral Method (Paper Review)
Nonlinear Filtering and Path Integral Method (Paper Review)
 
Particle Filter Tracking in Python
Particle Filter Tracking in PythonParticle Filter Tracking in Python
Particle Filter Tracking in Python
 
Rでisomap(多様体学習のはなし)
Rでisomap(多様体学習のはなし)Rでisomap(多様体学習のはなし)
Rでisomap(多様体学習のはなし)
 
Introduction to statistics
Introduction to statisticsIntroduction to statistics
Introduction to statistics
 
PRML_2.3.1~2.3.3
PRML_2.3.1~2.3.3PRML_2.3.1~2.3.3
PRML_2.3.1~2.3.3
 

Recently uploaded

Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...lizamodels9
 
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCRashishs7044
 
Vip Female Escorts Noida 9711199171 Greater Noida Escorts Service
Vip Female Escorts Noida 9711199171 Greater Noida Escorts ServiceVip Female Escorts Noida 9711199171 Greater Noida Escorts Service
Vip Female Escorts Noida 9711199171 Greater Noida Escorts Serviceankitnayak356677
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCRashishs7044
 
Call Girls In Connaught Place Delhi ❤️88604**77959_Russian 100% Genuine Escor...
Call Girls In Connaught Place Delhi ❤️88604**77959_Russian 100% Genuine Escor...Call Girls In Connaught Place Delhi ❤️88604**77959_Russian 100% Genuine Escor...
Call Girls In Connaught Place Delhi ❤️88604**77959_Russian 100% Genuine Escor...lizamodels9
 
Future Of Sample Report 2024 | Redacted Version
Future Of Sample Report 2024 | Redacted VersionFuture Of Sample Report 2024 | Redacted Version
Future Of Sample Report 2024 | Redacted VersionMintel Group
 
Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Kirill Klimov
 
Keppel Ltd. 1Q 2024 Business Update Presentation Slides
Keppel Ltd. 1Q 2024 Business Update  Presentation SlidesKeppel Ltd. 1Q 2024 Business Update  Presentation Slides
Keppel Ltd. 1Q 2024 Business Update Presentation SlidesKeppelCorporation
 
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City GurgaonCall Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaoncallgirls2057
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMintel Group
 
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In.../:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...lizamodels9
 
8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCRashishs7044
 
2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis UsageNeil Kimberley
 
8447779800, Low rate Call girls in Tughlakabad Delhi NCR
8447779800, Low rate Call girls in Tughlakabad Delhi NCR8447779800, Low rate Call girls in Tughlakabad Delhi NCR
8447779800, Low rate Call girls in Tughlakabad Delhi NCRashishs7044
 
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607dollysharma2066
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...lizamodels9
 
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...ictsugar
 
India Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportIndia Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportMintel Group
 
Marketing Management Business Plan_My Sweet Creations
Marketing Management Business Plan_My Sweet CreationsMarketing Management Business Plan_My Sweet Creations
Marketing Management Business Plan_My Sweet Creationsnakalysalcedo61
 
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfIntro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfpollardmorgan
 

Recently uploaded (20)

Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
 
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR
8447779800, Low rate Call girls in Kotla Mubarakpur Delhi NCR
 
Vip Female Escorts Noida 9711199171 Greater Noida Escorts Service
Vip Female Escorts Noida 9711199171 Greater Noida Escorts ServiceVip Female Escorts Noida 9711199171 Greater Noida Escorts Service
Vip Female Escorts Noida 9711199171 Greater Noida Escorts Service
 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
 
Call Girls In Connaught Place Delhi ❤️88604**77959_Russian 100% Genuine Escor...
Call Girls In Connaught Place Delhi ❤️88604**77959_Russian 100% Genuine Escor...Call Girls In Connaught Place Delhi ❤️88604**77959_Russian 100% Genuine Escor...
Call Girls In Connaught Place Delhi ❤️88604**77959_Russian 100% Genuine Escor...
 
Future Of Sample Report 2024 | Redacted Version
Future Of Sample Report 2024 | Redacted VersionFuture Of Sample Report 2024 | Redacted Version
Future Of Sample Report 2024 | Redacted Version
 
Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024
 
Keppel Ltd. 1Q 2024 Business Update Presentation Slides
Keppel Ltd. 1Q 2024 Business Update  Presentation SlidesKeppel Ltd. 1Q 2024 Business Update  Presentation Slides
Keppel Ltd. 1Q 2024 Business Update Presentation Slides
 
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City GurgaonCall Us 📲8800102216📞 Call Girls In DLF City Gurgaon
Call Us 📲8800102216📞 Call Girls In DLF City Gurgaon
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 Edition
 
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In.../:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
/:Call Girls In Indirapuram Ghaziabad ➥9990211544 Independent Best Escorts In...
 
8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR
 
2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage
 
8447779800, Low rate Call girls in Tughlakabad Delhi NCR
8447779800, Low rate Call girls in Tughlakabad Delhi NCR8447779800, Low rate Call girls in Tughlakabad Delhi NCR
8447779800, Low rate Call girls in Tughlakabad Delhi NCR
 
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
 
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
Call Girls In Sikandarpur Gurgaon ❤️8860477959_Russian 100% Genuine Escorts I...
 
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...Global Scenario On Sustainable  and Resilient Coconut Industry by Dr. Jelfina...
Global Scenario On Sustainable and Resilient Coconut Industry by Dr. Jelfina...
 
India Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample ReportIndia Consumer 2024 Redacted Sample Report
India Consumer 2024 Redacted Sample Report
 
Marketing Management Business Plan_My Sweet Creations
Marketing Management Business Plan_My Sweet CreationsMarketing Management Business Plan_My Sweet Creations
Marketing Management Business Plan_My Sweet Creations
 
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfIntro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
 

Introduction to pairtrading

  • 1. Introduction to pair trading -Based on cointegration- ・Shinichi Takayanagi ・Kohta Ishikawa 1
  • 2. Topics 1. What is pair trading? 2. What is cointegration? 3. Idea of pair trading based on cointegration 4. Simulation by R language 5. Summary & concluding remarks 2
  • 3. 1. What is pair trading? 3
  • 4. Pair trading was pioneered by … • Gerry Bamberger and Nunzio Tartaglia • Quantitative group at Morgan Stanley • Around 1980s • D.E. Shaw & Co. is famous for this strategy 4
  • 5. Pair trading is … Market neutral trading strategy 5
  • 6. Pair trading belongs to … Statistical Arbitrage 6
  • 7. Basic idea of pair trading … Select two stocks which move similarly 7
  • 8. Basic idea of pair trading … Sell high priced stock Buy low priced stock 8
  • 9. Basic idea of pair trading … Stock A : -------- Stock B : -------- Sell Sell Stock B Stock A Buy Stock A Buy Stock B 9
  • 10. Basic idea of pair trading … Usually, monitor the difference between two stock prices 10
  • 11. Basic idea of pair trading … the difference between two stock prices Sell Stock A Sell Stock B Buy Stock B Buy Stock A 11
  • 12. 2. What is cointegration? 12
  • 13. Cointegration is … • Pioneered by Engle and Granger • Statistical property of time series • Around 1990s 13
  • 14. Cointegration is … Not correlation 14
  • 15. Cointegration and correlation •Correlation –Specify co-movement of return –Short term relationship •Cointegration –Specify co-movement of price –Long term relationship 15
  • 16. (weak) Stationary time series Not depend on time ・E  X t    ・ X t    var 2 ・  X t , X t  s    s  cov 16
  • 17. Example of stationary time series White noise ・E  t   0 ・  t    var 2 ・  t ,  s   0, t  s cov 17
  • 18. Non stationary time series Depend on time ・E  X t   t ・ X t    t 2 var ・  X t , X t  s    t , s  cov 18
  • 19. Example of non stationary time series Brownian motion ・E Wt   0 ・ Wt   t var ・ Wt ,Wt  s   t  s cov 19
  • 20. Lag operator L ・LX t  X t 1 ・1  L X t  X t  X t 1  X t  20
  • 21. Integrated of order P X t : non stationary 1  L  p X t : stationary X t~I  p  21
  • 22. Example of “integrate” Z t  Z t 1   t : Random walk  t : White noise Calculate difference Z t  Z t  Z t 1   t : Stationary  Z t~I 1 22
  • 23. X t and Yt are cointegrated if … ut  Yt    X t  ut : ~I 0, stationary process X t , Yt : ~I 1 *This is a special version of general cointegration for I(1) 23
  • 24. Example of cointegrated time series Yt  50  0.5 X t  ut Xt : -------- X t : 100  2  Normal brownian motion Yt : -------- ut : 3  Gaussian noise 24
  • 25. Example of cointegrated time series Plot : ut = Yt – 0.5 Xt 25
  • 26. ut seems to be… Stationary & Mean reversion 26
  • 27. Question Can we apply this idea to trading strategy? 27
  • 28. 3. Idea of pair trading based on cointegration 28
  • 29. Geometric brownian motion The most widely used model of stock price dSt  dt  dWt St St : Stock price  : Average return  : Volatility Wt : Brownian motion 29
  • 30. From Ito’s lemma   2  d log St       dt  dWt   2  Log price follow Brownian motion 30
  • 31. Brownian motion(log price) is … I(1) * Random walk can be considered as discretization of Brownian motion 31
  • 32. Then, we can apply Cointegration idea to log stock price 32
  • 33. Log price spread(*) is… Stationary & Mean reversion ※Spreadt : logYt      log X t , X t , Yt : stock price 33
  • 34. Simple trading idea if Spread t  very hish : Buy X t ,Sell Yt if Spread t  very low : Buy Yt ,Sell X t Spread t  log Yt      log  X t  X t , Yt : stock price 34
  • 35. 4. Simulation by R language 35
  • 36. Process 1. Find two likely cointegrated stocks 2. Estimate spreads 3. Check stationarity 4. Create trading signal 5. Run back-test 36
  • 37. 1.Find two likely cointegrated stocks > library(PairTrading) > #load sample stock price data > data(stock.price) > #select 2 stocks > price.pair <- stock.price[,1:2]["2008-12-31::"] > head(price.pair) 7201 7203 2009-01-05 333 3010 2009-01-06 341 3050 2009-01-07 374 3200 2009-01-08 361 3140 * Just load sample data in this case…. 37
  • 38. 2. Estimate spreads > reg <- EstimateParameters(price.pair, method = lm) > str(reg) List of 3 $ spread :An ‘xts’ object from 2008-12-30 to 2011-08-05 containing: Data: num [1:635, 1] -0.08544 -0.0539 -0.04306 -0.00426 -0.01966 ... - attr(*, "dimnames")=List of 2 ..$ : NULL ..$ : chr "B" Indexed by objects of class: [Date] TZ: xts Attributes: NULL $ hedge.ratio: num 0.0997 $ premium : num 7.48 38
  • 39. 2. Estimate spreads > plot(reg$spread, main = "Spread“) Spreadt  logYt      log X t , X t , Yt : stock price 39
  • 40. 3. Check stationarity > PP.test(as.numeric(reg$spread)) Phillips-Perron Unit Root Test data: as.numeric(reg$spread) Dickey-Fuller = -3.2299, Truncation lag parameter = 6, p-value = 0.08278 > adf.test(as.numeric(reg$spread)) Augmented Dickey-Fuller Test data: as.numeric(reg$spread) Dickey-Fuller = -3.6462, Lag order = 8, p-value = 0.02825 alternative hypothesis: stationary 40
  • 41. 4. Create trading signal > params <- EstimateParametersHistorically(price.pair, period = 180) > signal <- Simple(params$spread, 0.05) > barplot(signal,col="blue",space = 0, border = "blue",xaxt="n",yaxt="n",xlab="",ylab="") > par(new=TRUE) > plot(params$spread, type="l", col = "red", lwd = 3, main = "Spread & Signal") 41
  • 42. 4. Create trading signal 42
  • 43. 5. Run back-test > return.pairtrading <- Return(price.pair, lag(signal), lag(params$hedge.ratio)) > plot(100 * cumprod(1 + return.pairtrading), main = "Performance of pair trading") 43
  • 46. Summary & concluding remarks • Pair trading is simple quantitative trading strategy • Cointegration is long term relation ship of time series • Idea of cointegration may give a chance to make a profit from financial market by pair trading • Next step …. – Sophisticate parameter estimation & trading rule – Make a simulation close to real 46
  • 47. Reference • Pairs trade(http://en.wikipedia.org/wiki/Pairs_trade) • Cointegration(http://en.wikipedia.org/wiki/Cointegration) • Andrew Neil Burgess, “A Computational Methodology for Modeling the Dynamics of Statistical Arbitrage” • Russell Wojcik, “Pairs Trading: A Professional Approach” • Daniel Herlemont, “Pairs trading, convergence trading, cointegration” • Paul Teetor, “Using R to Test Pairs of Securities for Cointegration”(http://quanttrader.info/public/testForCoint.html) • Ganapathy Vidyamurthy, “Pairs Trading: Quantitative Methods and Analysis “ 47