Quantitative Trading. Xin Guo.pdf - QUANTITATIVE TR ADING...

This preview shows page 1 out of 374 pages.

Unformatted text preview: QUANTITATIVE TR ADING Algorithms, Analytics, Data, Models, Optimization QUANTITATIVE TR ADING Algorithms, Analytics, Data, Models, Optimization Xin Guo University of California, Berkeley, USA Tze Leung Lai Stanford University, California, USA Howard Shek Tower Research Capital, New York City, New York, USA Samuel Po-Shing Wong 5Lattice Securities Limited, Hong Kong, China To our loved ones Xin: To my husband Ravi Kumar for your support and understanding when I was working intensively with my coauthors, and to my sons Raman and Kannan for bringing me joy, and in memory of my parents. Tze: To my wife Letitia for your contributions to this book through your extensive practical experience in banking, investment, and analytics, and your innate love of data and models. Howard: To my parents, and in memory of my grandparents, for your love and unwavering support over the years, and to my goddaughter Isabelle for bringing me endless joy every time I see you. Sam: To my mother S.C. Lee, my wife Fanny, and my son Theodore, for your love and support. Contents Preface xiii List of Figures xvii List of Tables xxi 1 Introduction 1.1 1.2 1.3 1.4 1.5 1.6 1.7 Evolution of trading infrastructure . . . . . . . . . . . . . . . Quantitative strategies and time-scales . . . . . . . . . . . . Statistical arbitrage and debates about EMH . . . . . . . . . Quantitative funds, mutual funds, hedge funds . . . . . . . . Data, analytics, models, optimization, algorithms . . . . . . Interdisciplinary nature of the subject and how the book can be used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Supplements and problems . . . . . . . . . . . . . . . . . . . 2 Statistical Models and Methods for Quantitative Trading 2.1 2.2 2.3 2.4 2.5 2.6 2.7 Stylized facts on stock price data . . . . . . . . . . . . . . . . 2.1.1 Time series of low-frequency returns . . . . . . . . . . 2.1.2 Discrete price changes in high-frequency data . . . . . Brownian motion models for speculative prices . . . . . . . . MPT as a “walking shoe” down Wall Street . . . . . . . . . Statistical underpinnings of MPT . . . . . . . . . . . . . . . 2.4.1 Multifactor pricing models . . . . . . . . . . . . . . . . 2.4.2 Bayes, shrinkage, and Black-Litterman estimators . . 2.4.3 Bootstrapping and the resampled frontier . . . . . . . A new approach incorporating parameter uncertainty . . . . 2.5.1 Solution of the optimization problem . . . . . . . . . . 2.5.2 Computation of the optimal weight vector . . . . . . . 2.5.3 Bootstrap estimate of performance and NPEB . . . . From random walks to martingales that match stylized facts 2.6.1 From Gaussian to Paretian random walks . . . . . . . 2.6.2 Random walks with optional sampling times . . . . . 2.6.3 From random walks to ARIMA, GARCH . . . . . . . Neo-MPT involving martingale regression models . . . . . . 1 1 5 6 8 10 11 13 17 18 18 18 22 22 24 24 25 26 27 27 28 29 30 31 32 35 37 vii viii Contents 2.8 2.9 2.7.1 Incorporating time series e↵ects in NPEB . . . . . . . 2.7.2 Optimizing information ratios along efficient frontier . 2.7.3 An empirical study of neo-MPT . . . . . . . . . . . . Statistical arbitrage and strategies beyond EMH . . . . . . . 2.8.1 Technical rules and the statistical background . . . . . 2.8.2 Time series, momentum, and pairs trading strategies . 2.8.3 Contrarian strategies, behavioral finance, and investors’ cognitive biases . . . . . . . . . . . . . . . . . . . . . . 2.8.4 From value investing to global macro strategies . . . . 2.8.5 In-sample and out-of-sample evaluation . . . . . . . . Supplements and problems . . . . . . . . . . . . . . . . . . . 3 Active Portfolio Management and Investment Strategies 3.1 3.2 3.3 3.4 3.5 Active alpha and beta in portfolio management . . . . . . . 3.1.1 Sources of alpha . . . . . . . . . . . . . . . . . . . . . 3.1.2 Exotic beta beyond active alpha . . . . . . . . . . . . 3.1.3 A new approach to active portfolio optimization . . . Transaction costs, and long-short constraints . . . . . . . . . 3.2.1 Cost of transactions and its components . . . . . . . . 3.2.2 Long-short and other portfolio constraints . . . . . . . Multiperiod portfolio management . . . . . . . . . . . . . . . 3.3.1 The Samuelson-Merton theory . . . . . . . . . . . . . 3.3.2 Incorporating transaction costs into Merton’s problem 3.3.3 Multiperiod capital growth and volatility pumping . . 3.3.4 Multiperiod mean-variance portfolio rebalancing . . . 3.3.5 Dynamic mean-variance portfolio optimization . . . . 3.3.6 Dynamic portfolio selection . . . . . . . . . . . . . . . Supplementary notes and comments . . . . . . . . . . . . . . Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 4.4 Transactions and transactions data . . . . . . . . . . . . . Models for high-frequency data . . . . . . . . . . . . . . . . 4.2.1 Roll’s model of bid-ask bounce . . . . . . . . . . . . 4.2.2 Market microstructure model with additive noise . . Estimation of integrated variance of Xt . . . . . . . . . . . 4.3.1 Sparse sampling methods . . . . . . . . . . . . . . . 4.3.2 Averaging method over subsamples . . . . . . . . . . 4.3.3 Method of two time-scales . . . . . . . . . . . . . . . 4.3.4 Method of kernel smoothing: Realized kernels . . . . 4.3.5 Method of pre-averaging . . . . . . . . . . . . . . . . 4.3.6 From MLE of volatility parameter to QMLE of [X]T Estimation of covariation of multiple assets . . . . . . . . . 44 44 45 46 61 4 Econometrics of Transactions in Electronic Platforms 4.1 4.2 38 38 39 41 41 43 62 63 63 64 67 67 68 69 69 72 73 74 75 76 78 101 103 . . . . . . . . . . . . 104 104 105 106 107 108 109 109 110 111 112 113 Contents 4.5 4.6 4.7 4.8 ix 4.4.1 Asynchronicity and the Epps e↵ect . . . . . . . . . . . 4.4.2 Synchronization procedures . . . . . . . . . . . . . . . 4.4.3 QMLE for covariance and correlation estimation . . . 4.4.4 Multivariate realized kernels and two-scale estimators Fourier methods . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.1 Fourier estimator of [X]T and spot volatility . . . . . 4.5.2 Statistical properties of Fourier estimators . . . . . . . 4.5.3 Fourier estimators of spot co-volatilities . . . . . . . . Other econometric models involving TAQ . . . . . . . . . . . 4.6.1 ACD models of inter-transaction durations . . . . . . 4.6.2 Self-exciting point process models . . . . . . . . . . . 4.6.3 Decomposition of Di and generalized linear models . . 4.6.4 McCulloch and Tsay’s decomposition . . . . . . . . . 4.6.5 Joint modeling of point process and its marks . . . . . 4.6.6 Realized GARCH and other predictive models . . . . 4.6.7 Jumps in efficient price process and power variation . Supplementary notes and comments . . . . . . . . . . . . . . Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Limit Order Book: Data Analytics and Dynamic Models 5.1 5.2 5.3 5.4 5.5 5.6 From market data to limit order book (LOB) . . . . . . Stylized facts of LOB data . . . . . . . . . . . . . . . . 5.2.1 Book price adjustment . . . . . . . . . . . . . . . 5.2.2 Volume imbalance and other indicators . . . . . Fitting a multivariate point process to LOB data . . . . 5.3.1 Marketable orders as a multivariate point process 5.3.2 Empirical illustration . . . . . . . . . . . . . . . LOB data analytics via machine learning . . . . . . . . Queueing models of LOB dynamics . . . . . . . . . . . 5.5.1 Di↵usion limits of the level-1 reduced-form model 5.5.2 Fluid limit of order positions . . . . . . . . . . . 5.5.3 LOB-based queue-reactive model . . . . . . . . . Supplements and problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 . . . . . . . . . . . . . 6 Optimal Execution and Placement 6.1 6.2 Optimal execution with a single asset . . . . . . . . . . . 6.1.1 Dynamic programming solution of problem (6.2) . 6.1.2 Continuous-time models and calculus of variations 6.1.3 Myth: Optimality of deterministic strategies . . . . Multiplicative price impact model . . . . . . . . . . . . . 6.2.1 The model and stochastic control problem . . . . . 6.2.2 HJB equation for the finite-horizon case . . . . . . 6.2.3 Infinite-horizon case T = 1 . . . . . . . . . . . . . 113 114 115 116 118 118 120 121 122 123 124 125 126 127 128 130 132 139 144 145 145 148 151 151 153 157 159 160 163 166 169 183 . . . . . . . . . . . . . . . . 184 185 187 189 190 190 191 193 x Contents 6.3 6.4 6.5 6.6 6.2.4 Price manipulation and transient price impact . Optimal execution using the LOB shape . . . . . . . . 6.3.1 Cost minimization . . . . . . . . . . . . . . . . . 6.3.2 Optimal strategy for Model 1 . . . . . . . . . . . 6.3.3 Optimal strategy for Model 2 . . . . . . . . . . . 6.3.4 Closed-form solution for block-shaped LOBs . . . Optimal execution for portfolios . . . . . . . . . . . . . Optimal placement . . . . . . . . . . . . . . . . . . . . 6.5.1 Markov random walk model with mean reversion 6.5.2 Continuous-time Markov chain model . . . . . . Supplements and problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Market Making and Smart Order Routing 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 221 Ho and Stoll’s model and the Avellanedo-Stoikov policy . Solution to the HJB equation and subsequent extensions Impulse control involving limit and market orders . . . . 7.3.1 Impulse control for the market maker . . . . . . . 7.3.2 Control formulation . . . . . . . . . . . . . . . . . Smart order routing and dark pools . . . . . . . . . . . . Optimal order splitting among exchanges in SOR . . . . 7.5.1 The cost function and optimization problem . . . . 7.5.2 Optimal order placement across K exchanges . . . 7.5.3 A stochastic approximation method . . . . . . . . Censored exploration-exploitation for dark pools . . . . . 7.6.1 The SOR problem and a greedy algorithm . . . . . 7.6.2 Modified Kaplan-Meier estimate Tˆi . . . . . . . . . 7.6.3 Exploration, exploitation, and optimal allocation . Stochastic Lagrangian optimization in dark pools . . . . 7.7.1 Lagrangian approach via stochastic approximation 7.7.2 Convergence of Lagrangian recursion to optimizer Supplementary notes and comments . . . . . . . . . . . . Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Informatics, Regulation and Risk Management 8.1 8.2 8.3 Some quantitative strategies . . . . . . Exchange infrastructure . . . . . . . . . 8.2.1 Order gateway . . . . . . . . . . 8.2.2 Matching engine . . . . . . . . . 8.2.3 Market data dissemination . . . 8.2.4 Order fee structure . . . . . . . . 8.2.5 Colocation service . . . . . . . . 8.2.6 Clearing and settlement . . . . . Strategy informatics and infrastructure . . . . . . . . . . . . . . . . . . 196 196 199 202 203 204 204 207 208 211 215 . . . . . . . . . . . . . . . . . . 222 223 225 225 226 228 230 231 232 233 234 234 235 236 237 238 240 241 248 251 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 255 258 258 259 260 262 263 264 Contents 8.4 8.5 8.6 8.7 8.3.1 Market data handling . . . . . 8.3.2 Alpha engine . . . . . . . . . . 8.3.3 Order management . . . . . . . 8.3.4 Order type and order qualifier Exchange rules and regulations . . . . 8.4.1 SIP and Reg NMS . . . . . . . 8.4.2 Regulation SHO . . . . . . . . 8.4.3 Other exchange-specific rules . 8.4.4 Circuit breaker . . . . . . . . . 8.4.5 Market manipulation . . . . . . Risk management . . . . . . . . . . . 8.5.1 Operational risk . . . . . . . . 8.5.2 Strategy risk . . . . . . . . . . Supplementary notes and comments . Exercises . . . . . . . . . . . . . . . . xi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A Martingale Theory 295 A.1 Discrete-time martingales . . . . . . . . . . . . . . . . . . . . A.2 Continuous-time martingales . . . . . . . . . . . . . . . . . . B Markov Chain and Related Topics 295 298 303 B.1 Generator Q of CTMC . . . . . . . . . . . . . . . . . . . . . B.2 Potential theory for Markov chains . . . . . . . . . . . . . . . B.3 Markov decision theory . . . . . . . . . . . . . . . . . . . . . C Doubly Stochastic Self-Exciting Point Processes C.1 Martingale theory and compensators of multivariate processes . . . . . . . . . . . . . . . . . . . . . . . . C.2 Doubly stochastic point process models . . . . . . . C.3 Likelihood inference in point process models . . . . C.4 Simulation of doubly stochastic SEPP . . . . . . . . 264 265 266 266 269 269 272 273 274 274 274 275 277 279 289 303 304 304 307 counting . . . . . . . . . . . . . . . . . . . . D Weak Convergence and Limit Theorems D.1 Donsker’s theorem and its extensions . . . . . . . . . . . . . D.2 Queuing system and limit theorems . . . . . . . . . . . . . . 307 308 309 312 315 316 317 Bibliography 319 Index 349 Preface After the tumultuous period marked by the 2007-2008 Financial Crisis and the Great Recession of 2009, the financial industry has entered a new era. Quantitative strategies, together with statistical models and methods, knowledge representation and data analytics, and algorithms and informatics for their development and implementation, are of increasing importance in this new era. The onset of this era is marked by two “revolutions” that have transformed modern life and business. One is technological, dubbed “the FinTech revolution” for financial services by the May 9, 2015, issue of The Economist which says: “In the years since the crash of 2007-08, policymakers have concentrated on making finance safer. . . . Away from the regulator spotlight, another revolution is under way. . . . From payments to wealth management, from peerto-peer lending to crowdfunding, a new generation of startups is taking aim at the heart of the industry – and a pot of revenues that Goldman Sachs estimates is worth $4.7 trillion. Like other disrupters from Silicon Valley, fintech firms are growing fast.” The other is called “big data revolution”. In August 2014, the UN Secretary General commissioned an Independent Advisory Group to make recommendations on “bringing about a data revolution” in sustainable development. The October 2012 issue of Harvard Business Review features an article on “Big Data: The Management Revolution”. On August 20, 2015, the Premier of the People’s Republic of China asked di↵erent government departments to share their data and implement a big data action plan. Soon afterward, on September 5, 2015, the country’s State Council issued an action plan to develop and promote big data applications in economic planning, finance, homeland security, transportation, agriculture, environment, and health care. To respond to the opportunities and challenges of this new era and the big data and FinTech revolutions that have fascinated their students, the two academics (Guo and Lai) on the author team, who happen to be teaching students in the greater Silicon Valley, developed and taught new courses in the Financial Engineering/Mathematics Curriculum at Berkeley and Stanford in the past three years and exchanged their course material. They also invited practitioners from industry, in particular the other two co-authors (Shek and Wong), to give guest lectures and seminars for these courses. This informal collaboration quickly blossomed into an intense concerted e↵ort to write up the material into the present book that can be used not only to teach these courses more e↵ectively but also to give short courses and training programs elsewhere, as we have done at Shanghai Advanced Institute of Finance, Fudan University Tsinghua University, Chinese University of Hong Kong, Hong Kong University xiii xiv Preface of Science & Technology, National University of Singapore, National Taiwan University, and Seoul National University. A prerequisite or co-requisite of these courses is a course at the level of STATS 240 (Statistical Methods in Finance) at Stanford, which covers the first six chapters of Lai and Xing (2008). We will therefore make ample references to the relevant sections of these six chapters, summarizing their main results without repeating the details. The website for this book can be found at . edu/quantstratbook/. The datasets for the exercises and examples can be downloaded from the website. We want to highlight in the book an interdisciplinary approach to the development and implementation of algorithmic trading and quantitative strategies. The interdisciplinary approach, which involves computer science and engineering, finance and economics, mathematics and statistics, law and regulation, is reflected not only in the research activities of the recently established Financial and Risk Modeling Institute (FARM) at Stanford, but also in the course o↵erings of Berkeley’s Financial Engineering and Stanford’s Financial Mathematics that has currently been transformed to the broader Mathematical and Computational Finance program to reflect the greater emphasis on data science, statistical modeling, advanced programming and high performance computing. Besides the interdisciplinary approach, another distinctive feature of the book is the e↵ort to bridge the gap between academic research/education and the financial industry, which is also one of the missions of FARM. Di↵erent parts of the book can be used in short thematic courses for practitioners, which are currently being developed at FARM. Acknowledgments We want to express our gratitude to Cindy Kirby for her excellent editing and timely help in preparing the final manuscript. The first two authors thank their current and former Ph.D. students: Joon Seok Lee and Renyuan Xu at Berkeley, and Pengfei Gao, Yuming Kuang, Ka Wai Tsang, Milan Shen, Nan Bai, Vibhav Bukkapatanam, Abhay Subramanian, Zhen Wei, Zehao Chen, Viktor Spivakovsky, and Tiong-Wee Lim at Stanford for their research and teaching assistance, as well as students of IEOR 222 from 2011 to 2016 and IEOR 230X in Spring 2015 at UC Berkeley and Keith Sollers from UC Davis. They also acknowledge grant support by the National Science Foundation, under DMS 1008795 at Berkeley and DMS 1407828 at Stanford, for research projects related to the book. In addition, the first author would like to thank her collaborators Adrien de Larrard, Isaac Mao, Zhao Ruan and Lingjiong Zhu in research on algorithmic trading, funding support from the endowment of the Coleman Fung Chair Professorship, and the NASDAQ OMX education group for generous data and financial support. She also wants to thank her colleague Prof. Terry Hendershott who co-taught with her a high-frequency finance course at the Haas Business School. The last author wants to thank Prof. Myron Scholes for his valuable help and advice and Ted Givens for the excellent book cover design, while the second author wants to thank his Preface xv colleague Prof. Joseph Grundfest of Stanford Law School for insightful discussions on regulatory issues in high-frequency trading. Department of Industrial Engineering and Operations Research, University of California at Berkeley Department of Statistics, Stanford University Tower Research Capital, LLC 5Lattice Securities Limited Xin Guo Tze Leung Lai Howard Shek Samuel Po-Shing Wong List of Figures 1.1 1.2 2.1 2.2 2.3 2.4 2.5 2.6 4.1 5.1 Hand signals for trading in an open outcry system. (Used with permission of CME.) . . . . . . . . . . . . . . . . . . . . . . Stock ticker manufactured by Western Union Telegraph Company in the 1870s and now an exhibit at the Computer History Museum in Mountain View, California. Originally, only transacted prices and abbreviated stock symbol...
View Full Document

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture