Introduction to Algorithmic Trading Strategies Lecture 5 Pairs

  • Slides: 43
Download presentation
Introduction to Algorithmic Trading Strategies Lecture 5 Pairs Trading by Stochastic Spread Methods Haksun

Introduction to Algorithmic Trading Strategies Lecture 5 Pairs Trading by Stochastic Spread Methods Haksun Li haksun. li@numericalmethod. com www. numericalmethod. com

Outline � First passage time � Kalman filter � Maximum likelihood estimate � EM

Outline � First passage time � Kalman filter � Maximum likelihood estimate � EM algorithm 2

References As the emphasis of the basic co-integration methods of most papers are on

References As the emphasis of the basic co-integration methods of most papers are on the construction of a synthetic mean-reverting asset, the stochastic spread methods focuses on the dynamic of the price of the synthetic asset. � Most referenced academic paper: Elliot, van der Hoek, and Malcolm, 2005, Pairs Trading � � Model the spread process as a state-space version of Ornstein-Uhlenbeck process Jonathan Chiu, Daniel Wijaya Lukman, Kourosh Modarresi, Avinayan Senthi Velayutham. High-frequency Trading. Stanford University. 2011 � The idea has been conceived by a lot of popular pairs trading books � � � 3 Technical analysis and charting for the spread, Ehrman, 2005, The Handbook of Pairs Trading ARMA model, HMM ARMA model, some non-parametric approach, and a Kalman filter model, Vidyamurthy, 2004, Pairs Trading: Quantitative Methods and Analysis

Spread as a Mean-Reverting Process � 4

Spread as a Mean-Reverting Process � 4

Sum of Power Series � 5

Sum of Power Series � 5

Unconditional Mean � 6

Unconditional Mean � 6

Long Term Mean � 7

Long Term Mean � 7

Unconditional Variance � 8

Unconditional Variance � 8

Long Term Variance � 9

Long Term Variance � 9

Observations and Hidden State Process � 10

Observations and Hidden State Process � 10

First Passage Time � 11

First Passage Time � 11

A Sample Trading Strategy � 12

A Sample Trading Strategy � 12

Kalman Filter � The Kalman filter is an efficient recursive filter that estimates the

Kalman Filter � The Kalman filter is an efficient recursive filter that estimates the state of a dynamic system from a series of incomplete and noisy measurements. 13

Conceptual Diagram as new measurements come in prediction at time t Update at time

Conceptual Diagram as new measurements come in prediction at time t Update at time t+1 correct for better estimation 14

A Linear Discrete System � 15

A Linear Discrete System � 15

Observations and Noises � 16

Observations and Noises � 16

Discrete System Diagram 17

Discrete System Diagram 17

Prediction � 18

Prediction � 18

Update � 19

Update � 19

Computing the ‘Best’ State Estimate � 20

Computing the ‘Best’ State Estimate � 20

Predicted (a Priori) State Estimation � 21

Predicted (a Priori) State Estimation � 21

Predicted (a Priori) Variance � 22

Predicted (a Priori) Variance � 22

Minimize Posteriori Variance � 23

Minimize Posteriori Variance � 23

Solve for K � 24

Solve for K � 24

First Order Condition for k � 25

First Order Condition for k � 25

Optimal Kalman Filter � 26

Optimal Kalman Filter � 26

Updated (a Posteriori) State Estimation � 27

Updated (a Posteriori) State Estimation � 27

Updated (a Posteriori) Variance � 28

Updated (a Posteriori) Variance � 28

Parameter Estimation � 29

Parameter Estimation � 29

Likelihood Function � 30

Likelihood Function � 30

Maximum Likelihood Estimate � 31

Maximum Likelihood Estimate � 31

Example Using the Normal Distribution � 32

Example Using the Normal Distribution � 32

Log-Likelihood � 33

Log-Likelihood � 33

Nelder-Mead � 34

Nelder-Mead � 34

Marginal Likelihood � 35

Marginal Likelihood � 35

The Q-Function � 36

The Q-Function � 36

EM Intuition � 37

EM Intuition � 37

Expectation-Maximization Algorithm � 38

Expectation-Maximization Algorithm � 38

EM Algorithms for Kalman Filter � Offline: Shumway and Stoffer smoother approach, 1982 �

EM Algorithms for Kalman Filter � Offline: Shumway and Stoffer smoother approach, 1982 � Online: Elliott and Krishnamurthy filter approach, 1999 39

A Trading Algorithm � 40

A Trading Algorithm � 40

Results (1) 41

Results (1) 41

Results (2) 42

Results (2) 42

Results (3) 43

Results (3) 43