
Online Detection of Mean Reversion in Algorithmic Pairs Trading Seung Jin Han School of Mathematics and Statistics University of Sheffield A thesis submitted for the degree of Doctor of Philosophy November 2013 Acknowledgements It is great pleasure to acknowledge people who have given me guidance, help, and encouragement. First and foremost, I would like to offer my sincere gratitude to Dr. Kostas Triantafyllopoulos. As a supervisor, he has encouraged and helped me in many ways during the last four years of my studies. I extend my gratitude to my family members. My late father (Keung- woo Han), my mother (Eunkyoung Oh), my sister (Jiyeon Han) and brother-in-law (Taekyoung Ko), their daughter and my nephew (Jaehee Ko), my wife (Sun Young Park), parents-in-laws (Byoungil Park and Yunsun Lee), and a sister-in-law(Hyunyoung Park), they are and always has been my supporters. My deepest appreciation goes to my wife, Sun Young Park. She is and always has been a good friend and colleague of mine. Abstract This thesis is concerned with online detection of mean-reversion in algo- rithmic pairs trading where a pair of assets is chosen when their prices are expected to show similar movements. In pairs trading, mean-reversion of the spread, defined as the price difference of a pair of financial in- struments, is assumed, and we propose that the mean-reverted patterns can be detected online. For this, a new algorithm for variable forgetting factor using the conjugacy of distributions and an inference for multicat- egorical time series in dynamic models are developed. Two algorithms for variable forgetting factor are also introduced using the steepest de- scent method and the Gauss-Newton method each from the field of signal processing and control engineering. Performances of the three variable forgetting factor algorithms are evaluated by the mean square errors and the detection rate. However, the mean-reversion is not related to the stationarity in time series, in particular when it is locally detected. Thus, the behaviour of the spread or its mean-reversion needs to be carefully monitored as well. Considering that the detection of mean- reversion relies on a parameter estimate of the state in dynamic linear model, the estimate is located to a category specified by the modeller. This behaviour of the estimate is monitored in dynamic generalised lin- ear model for multicategorical time series where sequential Monte Carlo methods are applied for an inference as a simulation-based approach. As an illustration, algorithmic pairs trading is implemented and shown to be successful even with simple trading rules, given the daily stock prices from the stock exchange. Contents Contents iii List of Figures vii List of Tables xi 1 Introduction 1 1.1 Algorithmic Pairs Trading . 1 1.2 AimsandObjectivesofTheThesis . 3 1.3 LayoutoftheThesis ........................... 4 1.4 Terminology&Notation ......................... 5 2 Pairs Trading, Time Series, and Dynamic Models 6 2.1 Introduction................................ 6 2.2 TimeSeriesandBayesianForecasting. 6 2.3 PairsTrading ............................... 7 2.3.1 TheCorrelationApproach . 8 2.3.2 TheDistanceApproach ..................... 8 2.3.3 TheCo-integrationApproach . 9 2.4 MeanReversionandTheSpreadModel. 9 2.4.1 TheSpreadModel ........................ 11 2.4.2 The Spread Time Series in Dynamic Linear Model . 12 2.4.3 Conditions for Mean Reversion . 14 2.5 RecursionsinDynamicLinearModel . 15 2.5.1 Conditional on V ......................... 15 iii CONTENTS 2.5.2 Unconditional on V ........................ 16 1 2.5.3 Recursion of τ = V ........................ 17 2.6 VariableForgettingFactorandLeastSquares . 18 2.7 DynamicGeneralisedLinearModel . 19 2.7.1 TheLinearBayesianMethod . 21 2.7.2 Particle Filters . 24 2.8 Conclusion................................. 24 3 Dynamic Linear Model with Variable Forgetting 26 3.1 Introduction................................ 26 3.2 Dynamic Linear Model with Variable Forgetting Factor . 29 3.2.1 Relationship Between Kt and Ct∗ ................ 29 3.2.2 RecursionsofParameterEstimates . 30 1 3.2.3 Recursion of τ = V ........................ 31 3.3 The Steepest Descent Variable Forgetting Factor (SDvFF) Algorithm 32 3.3.1 Recursion of ∇λ(t) ........................ 33 3.3.1.1 Updating Equation for ψt ............... 34 3.3.1.2 Updating Equation for St ............... 34 3.4 The Gauss-Newton Variable Forgetting Factor (GNvFF) Algorithm . 35 2 3.4.1 Recursion of ∇λ(t) ........................ 36 3.4.1.1 Updating Equation for ηt ............... 36 3.4.1.2 Updating Equation for Lt ............... 37 3.5 The Beta-Bernoulli Variable Forgetting Factor (BBvFF) Algorithm . 38 3.5.1 Advantages of the BBvFF over the other algorithms . 41 3.6 Pseudo-code Implementations of The VFF Algorithms . 43 3.6.1 TheSDvFF ............................ 43 3.6.2 TheGNvFF............................ 43 3.6.3 The BBvFF(d,k)......................... 44 3.7 Comparisons with Simulated Time Series . 45 3.8 Conclusion................................. 48 4 Inference for Multi-categorical Time Series 50 4.1 Introduction................................ 50 iv CONTENTS 4.2 ModelSpecification............................ 54 4.2.1 TheObservationModel . 55 4.2.2 TheEvolutionModel....................... 57 4.2.3 RecursionsofParameterEstimates . 57 4.2.3.1 Prior Distributions . 58 4.2.3.2 Posterior Distributions . 59 4.3 Recursive Updating for Πt and ηt .................... 60 4.3.1 Moments of (ηt | Dt 1)...................... 60 − 4.3.2 Relationship between (ηt | Dt 1) and (Πt | Dt 1) ....... 61 − − 4.3.2.1 The Density Function of (ηt | Dt 1).......... 61 − 4.3.2.2 Generating Functions for ηt .............. 62 4.3.3 Parameters of (Πt | Dt 1) .................... 64 − 4.3.4 Moments of (ηt | Dt)....................... 65 4.4 Inference for The Posterior of (θt | Dt) ................. 66 4.4.1 Approximate Inference by the Bayes Linear Methods . 66 4.4.2 Particle Filters . 68 4.4.2.1 TheImportanceDensity . 69 4.4.2.2 TheIncrementalWeights . 71 4.4.2.3 Resampling Methods . 72 4.5 Comparison of The Bootstrap Filter and The Particle Filter . 73 4.5.1 TheBootstrapFilter ....................... 74 4.5.2 The Particle Filter . 74 4.5.3 ComparisonResults. .. .. 75 4.6 Conclusion................................. 77 5 Algorithmic Pairs Trading 85 5.1 Introduction................................ 85 5.2 TradingRules............................... 87 5.2.1 TradingRule1 .......................... 88 5.2.2 TradingRule2 .......................... 89 5.2.3 NumberofSharesToBuyandShort-sell . 91 5.3 Illustration:AEM-NEM ......................... 92 5.3.1 TheSpreadModels........................ 92 v CONTENTS 5.3.1.1 Recursions of Parameter Estimates . 94 1 5.3.1.2 Recursion of τ = V ................... 94 5.3.2 The Variable Forgetting Factor Algorithms . 95 5.3.2.1 TheSDvFF....................... 95 5.3.2.2 TheGNvFF....................... 95 5.3.2.3 The BBvFF(d,k).................... 96 5.4 ComparisonsByTheVFFAlgorithms . 97 5.4.1 Case A: Decision by |Bˆt| ..................... 97 5.4.1.1 Case A with Trading Rule 1 . 98 5.4.1.2 Case A with Trading Rule 2 . 99 5.4.2 Case B: Decision by Monitoring Results . 112 5.4.2.1 Case B with Trading Rule 1 . 112 5.4.2.2 Case B with Trading Rule 2 . 113 5.5 ConclusionofChapter5 .. .. .. .114 6 Conclusions 128 Appendix A 131 Appendix B 138 Appendix C 144 References 148 vi List of Figures 4.1 The probabilities used to generate a multi-categorical time series of 100 data points with the counts of 1 at each time t (in black for the upper and the lower plots) with the estimated posterior probabilities by the particle filter (PF) (in red for the upper plots) and by the bootstrapfilter(BF)(inredforthelowerplots) . 79 4.2 The probabilities used to generate a multi-categorical time series of 100 data points with the counts of 100 at each time t (in black for the upper and the lower plots) with the estimated posterior probabilities by the particle filter (PF) (in red for the upper plots) and by the bootstrapfilter(BF)(inredforthelowerplots) . 80 4.3 The probabilities used to generate a multi-categorical time series of 100 data points with the counts of 1,000 at each time t (in black for the upper and the lower plots) with the estimated posterior probabilities by the particle filter (PF) (in red for the upper plots) and by the bootstrapfilter(BF)(inredforthelowerplots) . 81 4.4 The probabilities used to generate a multi-categorical time series of 100 data points with the counts of 1 at each time t (in black for the upper and the lower plots) with the estimated posterior probabilities by the particle filter (PF) (in red for the upper plots) and by the bootstrapfilter(BF)(inredforthelowerplots) . 82 vii LIST OF FIGURES 4.5 The probabilities used to generate a multi-categorical time series of 100 data points with the counts of 100 at each time t (in black for the upper and the lower plots) with the estimated posterior probabilities by the particle filter (PF) (in red for the upper plots) and by the bootstrapfilter(BF)(inredforthelowerplots) . 83 4.6 The probabilities used to generate a multi-categorical time series of 100 data points with the counts of 1,000 at each time t (in black for the upper and the lower plots) with the estimated posterior probabilities by the particle filter (PF) (in red for the upper plots) and by the bootstrapfilter(BF)(inredforthelowerplots) . 84 5.1 A flow chart of algorithmic pairs trading . 86 5.2 TradingRule2 .............................. 90 5.3 Share prices of Agnico-Eagle Mines Limited (AEM) and Newmont Mining Corporation (NEM) with their spread time series as an inset . 93 5.4 Comparison of the estimated coefficients |Bˆt| by the DLM with each of the SDvFF, the GNvFF, the BBvFF(0.1,0.99), and the BBvFF(0.1,0.5)101 5.5 Comparison of the estimated coefficients |Bˆt| over the period from 16th Oct. 2012 to 13th Feb. 2013 by the DLM with each of the SDvFF, the GNvFF, the BBvFF(0.1,0.99), and the BBvFF(0.1,0.5) .
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages167 Page
-
File Size-