Machine Learning in Pairs Trading Strategies

Similar documents
MTH6121 Introduction to Mathematical Finance Lesson 5

Chapter 7. Response of First-Order RL and RC Circuits

11/6/2013. Chapter 14: Dynamic AD-AS. Introduction. Introduction. Keeping track of time. The model s elements

Mathematics in Pharmacokinetics What and Why (A second attempt to make it clearer)

DYNAMIC MODELS FOR VALUATION OF WRONGFUL DEATH PAYMENTS

Journal Of Business & Economics Research September 2005 Volume 3, Number 9

SPEC model selection algorithm for ARCH models: an options pricing evaluation framework

4. International Parity Conditions

Random Walk in 1-D. 3 possible paths x vs n. -5 For our random walk, we assume the probabilities p,q do not depend on time (n) - stationary

Usefulness of the Forward Curve in Forecasting Oil Prices

Chapter 8 Student Lecture Notes 8-1

The Transport Equation

Stability. Coefficients may change over time. Evolution of the economy Policy changes

Term Structure of Prices of Asian Options

A Note on Using the Svensson procedure to estimate the risk free rate in corporate valuation

Statistical Analysis with Little s Law. Supplementary Material: More on the Call Center Data. by Song-Hee Kim and Ward Whitt

Cointegration: The Engle and Granger approach

Morningstar Investor Return

The naive method discussed in Lecture 1 uses the most recent observations to forecast future values. That is, Y ˆ t + 1

Chapter 8: Regression with Lagged Explanatory Variables

AP Calculus BC 2010 Scoring Guidelines

INTEREST RATE FUTURES AND THEIR OPTIONS: SOME PRICING APPROACHES

A Probability Density Function for Google s stocks

Stochastic Optimal Control Problem for Life Insurance

Measuring macroeconomic volatility Applications to export revenue data,

PROFIT TEST MODELLING IN LIFE ASSURANCE USING SPREADSHEETS PART ONE

Acceleration Lab Teacher s Guide

Time Consisency in Porfolio Managemen

Stock Trading with Recurrent Reinforcement Learning (RRL) CS229 Application Project Gabriel Molina, SUID

Mortality Variance of the Present Value (PV) of Future Annuity Payments

The Greek financial crisis: growing imbalances and sovereign spreads. Heather D. Gibson, Stephan G. Hall and George S. Tavlas

INTRODUCTION TO FORECASTING

Hedging with Forwards and Futures

Optimal Investment and Consumption Decision of Family with Life Insurance

BALANCE OF PAYMENTS. First quarter Balance of payments

RC (Resistor-Capacitor) Circuits. AP Physics C

MACROECONOMIC FORECASTS AT THE MOF A LOOK INTO THE REAR VIEW MIRROR

cooking trajectory boiling water B (t) microwave time t (mins)

CHARGE AND DISCHARGE OF A CAPACITOR

Task is a schedulable entity, i.e., a thread

Can Individual Investors Use Technical Trading Rules to Beat the Asian Markets?

AP Calculus AB 2013 Scoring Guidelines

Modeling VIX Futures and Pricing VIX Options in the Jump Diusion Modeling

Technical Appendix to Risk, Return, and Dividends

Chapter 6: Business Valuation (Income Approach)

Transient Analysis of First Order RC and RL circuits

The Application of Multi Shifts and Break Windows in Employees Scheduling

Option Put-Call Parity Relations When the Underlying Security Pays Dividends

II.1. Debt reduction and fiscal multipliers. dbt da dpbal da dg. bal

AP Calculus AB 2010 Scoring Guidelines

Vector Autoregressions (VARs): Operational Perspectives

Stochastic Calculus and Option Pricing

SEASONAL ADJUSTMENT. 1 Introduction. 2 Methodology. 3 X-11-ARIMA and X-12-ARIMA Methods

Longevity 11 Lyon 7-9 September 2015

ANALYSIS AND COMPARISONS OF SOME SOLUTION CONCEPTS FOR STOCHASTIC PROGRAMMING PROBLEMS

APPLICATION OF THE KALMAN FILTER FOR ESTIMATING CONTINUOUS TIME TERM STRUCTURE MODELS: THE CASE OF UK AND GERMANY. January, 2005

4 Convolution. Recommended Problems. x2[n] 1 2[n]

Estimating Time-Varying Equity Risk Premium The Japanese Stock Market

Pricing Single Name Credit Derivatives

Working Paper On the timing option in a futures contract. SSE/EFI Working Paper Series in Economics and Finance, No. 619

Optimal Stock Selling/Buying Strategy with reference to the Ultimate Average

Dynamic programming models and algorithms for the mutual fund cash balance problem

I. Basic Concepts (Ch. 1-4)

Key Words: Steel Modelling, ARMA, GARCH, COGARCH, Lévy Processes, Discrete Time Models, Continuous Time Models, Stochastic Modelling

Description of the CBOE S&P 500 BuyWrite Index (BXM SM )

A Re-examination of the Joint Mortality Functions

Carbon Trading. Diederik Dian Schalk Nel. Christ Church University of Oxford

How To Price An Opion

Return Calculation of U.S. Treasury Constant Maturity Indices

Understanding the Profitability of Pairs Trading

Table of contents Chapter 1 Interest rates and factors Chapter 2 Level annuities Chapter 3 Varying annuities

Chapter 2 Problems. 3600s = 25m / s d = s t = 25m / s 0.5s = 12.5m. Δx = x(4) x(0) =12m 0m =12m

Economics Honors Exam 2008 Solutions Question 5

Optimal Time to Sell in Real Estate Portfolio Management

UNDERSTANDING THE DEATH BENEFIT SWITCH OPTION IN UNIVERSAL LIFE POLICIES. Nadine Gatzert

Hotel Room Demand Forecasting via Observed Reservation Information

Journal Of Business & Economics Research Volume 1, Number 11

A Two-Account Life Insurance Model for Scenario-Based Valuation Including Event Risk Jensen, Ninna Reitzel; Schomacker, Kristian Juul

ON THE PRICING OF EQUITY-LINKED LIFE INSURANCE CONTRACTS IN GAUSSIAN FINANCIAL ENVIRONMENT

Does Option Trading Have a Pervasive Impact on Underlying Stock Prices? *

DOES TRADING VOLUME INFLUENCE GARCH EFFECTS? SOME EVIDENCE FROM THE GREEK MARKET WITH SPECIAL REFERENCE TO BANKING SECTOR

Investor sentiment of lottery stock evidence from the Taiwan stock market

INDEX RULE BOOK Leverage, Short, and Bear Indices

LIFE INSURANCE WITH STOCHASTIC INTEREST RATE. L. Noviyanti a, M. Syamsuddin b

Capacitors and inductors

Pricing Futures and Futures Options with Basis Risk

The Kinetics of the Stock Markets

Predicting Stock Market Index Trading Signals Using Neural Networks

Term Structure of Commodities Futures. Forecasting and Pricing.

Module 4. Single-phase AC circuits. Version 2 EE IIT, Kharagpur

Analogue and Digital Signal Processing. First Term Third Year CS Engineering By Dr Mukhtiar Ali Unar

Supplementary Appendix for Depression Babies: Do Macroeconomic Experiences Affect Risk-Taking?

Transcription:

Machine Learning in Pairs Trading Sraegies Yuxing Chen (Joseph) Deparmen of Saisics Sanford Universiy Email: osephc5@sanford.edu Weiluo Ren (David) Deparmen of Mahemaics Sanford Universiy Email: weiluo@sanford.edu Xiaoxiong Lu Deparmen of Elecrical Engineering Sanford Universiy Email: lxx@sanford.edu Keywords: pairs rading mean revering Ornsein-Uhlenbec process porfolio rebalancing Kalman filer Kalman smooher EM.Inroducion Pairs rading consiss of long posiion in one financial produc shor posiion in anoher produc we focus he form of saisical arbirage insead of rend following; hese sraegies are mare neural have low ris. Choose wo securiies denoe heir prices as S S. Then he spread is S S where is a carefully chosen consan depending on ime. The simples case is ha ; he spread becomes simply difference beween wo prices. We assume ha he spread is a mean revering process meaning if deviaions of spread from is mean occur his deviaion will evenually vanish. Then when deviaions arise we long he relaively cheap securiies shor sell he relaively expensive securiies hen wai for he spread will go bac o is mean level o mae profi. This is he basic idea behind many pairs rading sraegies including ours. The quesion now becomes how o model he meanrevering process of spread so ha enering exiing rading signal can be developed from ha model. In his paper Ornsein-Uhlenbec process is used as he underlying model of spread: dx ( ) ( X( )) d dw( ) (.) where X () is he spread a ime measures he speed of X () reurning o is mean level is he volailiy of spread. In his proec wo approaches are applied. One is saring from difference of daily reurns insead of spread of prices inegraing his process using a linear regression o esimae coefficiens. Anoher one is assuming a spread model which is a laen O-U process plus some noise building signals based on predicion generaed from Kalman filer; E-M algorihm modified for Kalman smooher/filer is applied o esimae coefficiens in he spread model. In Secion 3 models algorihms are given in a bacwards order firs saring from models hen inroducing algorihms in order o esimae parameers in models. Very brief summaries of real procedures are given in laer par of Secion 3 showing he order of how algorihms should be implemens..porfolio Rebalancing & Linear Regression Approach The advanage of his approach is simpliciy: linear model is convenien o be inerpreed if anyhing goes wrong i is easy o spo he source of problem.. Assumpions Porfolio Rebalancing We assume ha he daily reurns of wo financial producs saisfy he following sochasic differenial equaion: ds( ) ds( ) d dx () (.) S ( ) S ( ) The drif erm is he rend of spread of daily reurns; is a consan which canno change much along ime; X () is a mean revering process. In pracice his equaion says ha if we long $ securiies one shor selling $ securiies wo he daily reurn of our porfolio should be mean revering given he condiion ha he magniude of flucuaion of X () which is usually he case. From he above explanaion we can see why canno change much along ime. Since / ( ) / ( ) are weighs wihin our porfolio if changes frequenly in a large magniude meaning ha porfolio needs rebalancing frequenly weighs change much. Then he profi canno cover he cos of rebalancing. I is beer o run a regression o find a 0 eep as a consan for a shor period of ime e.g. 5 or 0 days chec wheher X () from ds( ) ds( ) dx () has mean-revering propery. S ( ) S ( )

. The O-U Model of Spread As saed in Secion we use O-U process (.) o model he dynamic of he spread X () hus we have dx ( ) ( X( )) d dw( ) (.) Inegraing he above equaion we have [] X ( ) e X ( ) ( e ) A( ) 0 0 0 0 ( 0 s) A e dw s () (.3) 0 ow le end o infiniy he equilibrium probabiliy disribuion of X () is normal wih E[ X ( )] Var[ X ( )] (.4) Wih (.3) (.4) we are able o esimae he parameers in he O-U process..3 Linear Regression for Esimaing Weighs Parameers Le us denoe R S S S Run a linear regression of window wih lengh 60. R agains R on a moving R 0 R 60 noe ha / ( ) / ( ) is he weigh of porfolio also ha we may run he above regression every 5 days as indicaed in Secion.. Then we use he sum of residuals o obain he discree version of X X 60 Then use hese X linear regression again o esimae parameers as below. Thus log( b) 5 m a / ( b) Var( ) b Moreover we are able o ge he equilibrium sard deviaion from (3.4) now. eq : Var( X ( )) (.5) A his sage we can use he sardized version of X () called Z-score as rading signal. This facor measures how far X () deviaes from is mean level is a valid measure across all securiies since i is dimensionless. More deails of signal will be given laer..4 Summary of he Procedure A summary of he whole procedure will be given i displays he order wihin he implemenaion of he rading sraegy. Firs run a linear regression on daily reurns on a moving window o ge new weigh (performing rebalancing if necessary); hen use o sum o discree version of X run anoher regression of X o obain parameers in he O-U process z-score as rading signal. The buying selling rules are buy o open if s i s bo sell o open if s i s close long posiion if s i s close shor posiion if s i s.5 Bac-Tes Resuls We use closing price (daily daa) of wo chosen fuure conracs in China fuure mare. The daily reurn plo is shown as below. so sc bc X a bx 60 By (.3) we have a( e ) b e Var( ) e Figure. Daily reurns of wo securiies

The plo of (updaed every five rading days) is Figure. which indicaes he weigh of porfolio The plo of cumulaive profi summary are given; we consider he ransacion cos of buying/selling plus slippage is 0 basis poins. The Observaion Process We assume he spread process { y } is he observaion of { x } wih Gaussian noise y x D (3.3) where { } are also i.i.d Gaussian (0) independen of { }. The Trading Signal Here we define x E[ x F ] l l (3.4) (3.5) l E[( x x ) Fl ] x x (3.6) Annualized Reurn Rae Figure.3 Cumulaive profi Volailiy Sharpe Maximal Drawdown 8.0% 7.59%.4 5.57% 3.Kalman Filer EM Algorihm Approach 3. The Spread Model The Sae Process We sudied { y } he simples spread S S wih he assumpion ha i is a noisy observaion of a laen meanrevering sae process { x }. Here ss for one day x is some variable a ime for 0 saisfying he following mean-revering dynamic (discree version of OU process). x x ( a bx ) (3.) where 0 b 0 a { } is i.i.d Gaussian (0). Thus in he above equaion is independen of all x. And he process mean revers o a/ bwih "speed" b. Therefore we can rewrie (3.) as follows x A Bx C (3.) The condiional expecaion given observed informaion F eiher from an exping window or a moving window. l If y x ransacion cos + premium here he premium is he profi ha we wan o ensure when ener a posiion hen he spread is regarded as oo large meaning he securiies if relaively expensive han securiies ; we would ae a long posiion in he spread porfolio (shor selling one uni longing one uni of produc ) expecing ha he spread will shrin evenually. Similarly if y x ransacion cos - premium hen he spread is lower han he expecaion significanly; we would ae a shor posiion in he spread porfolio. We close posiions when y x where is a predeermined hreshold. 3. Kalman Filer Equiped wih sae equaion (3.) observaion equaion (3.) our nex sep is o esimae he hidden process. x In order o esimae he predicion of he nex day a ime we will sar from ime 0 he iniializaion x y ; recall he definiion (3.4) o 0 0 0 0 D (3.6).Then perform he following procedure ieraively unil. In he predicion sep we would compue he "predicion" x A Bx (3.7) B C (3.8) The sae esimae. x is hidden which needs observaions o The opimal Kalman gain is K / ( D ) (3.9)

Then we can compue our esimaion wih he new observaion y in he following updae sep: x x x K [ y x ] (3.0) R D K K (3.) Repea he above process o obain x x. E[( x x ) F ] E[( x x ) ] (3.5) E[( x x )( x x )] (3.6) They can be compued bacwards meaning ha x [5]. can be obained from x Le us use firs few seps o illusrae how EM algorihm wors in he form of Kalman smooher/filer. Figure 3. Kalman filer The above algorihm is based on nowing ( A B C D ) bu is unnown now. We need an exra raining se o esimae he parameers A B C D before using Kalman filer hese parameers are esimaed via EM algorihm. 3.3 Esimaion using EM Algorihm x Before predicing We now use he EM algorihm o esimae y0 y... y. ( A B C D ) based on he observaions Recall he general form of EM algorihm ( P is a probabiliy measure wih parameer ): Sep (E-sep) Sep (M-sep) dp Compue E log F dp Updae o by maximizing condiional expecaion. dp arg max E log F dp Here we are going o use Shumwau Soffer [6] smooher o implemen EM algorihm. We define smoohers for (noe ha hey have he same form of definiion for filering when ): x E[ x F ] (3.4) Figure 3. EM in he form of smooher/filer From he above figure he operaion rules wih blue arrows indicaing smooher filer are nown; so now we go o he rule of updaing A B C D using X. ( ) Given A B C D iniial values for he Kalman Filer he updae ( A B C D ) are calculae as follows: where  B C [( x A Bx ) F ] (3.7) (3.7) (3.9) D y x F (3.0) [( ) ] 0 E x F x [ ] [ ]

E x x F x x x [ ] [ ] x x x 0 3.4 Summary of Algorihms As shown in Figure 3. we sar from X : X : 0 coninuing updaing. Afer 300 predicion x as rading signal. we use he Figure 3.4 Acual Spread vs Predicion Besides he EM algorihm in [4] is implemenaed using exping window as above which would cause heavy compuaional burden. So we also implemen he EM using moving window for updaing as well. 3.5 Resul of Implemenaion We pair wo fuure conracs of agriculural producs in China mare esimae he process of spread. Wih Kalman Filer EM Algorihm we can predic he hidden sae x using an exping window ploed in Figure 3.3. Figure 3.5 Cumulaive Profis Figure 3.3 Acual Spread vs Predicion As shown in Figure 3.3 he acual spread y is osillaing around our predicion. When y deviaes from x significanly we would expec ha he spread will shrin evenually we will ae advanage of his o mae profi. Figure 3.4 is he predicion made from EM on a moving window. Comparison of cumulaive profis of using wo windows is given as well (Figure 3.5). 4.Conclusion Analysis We are being on meaning reversion of spread hus i is necessary o chec wheher he spread beween wo securiies has such propery in hisorical daa. If he spread has obvious upward or downward rend hen loss may incurr; seing a loss cuing limi can be implemened. I seems ha he smooher/filer approach has beer reurns (0.4% 8.79%) compared wih he linear regression approach. The cos of rebalancing in he laer one may be he reason. We have o realize ha linear regression is simple i is easy o be inerpreed while smooher/filer approach is a blac box. Reference [] Saisical Arbirage in he U.S. Equiies Mare Marco Avellaneda Jeong-Hyun Lee. [] Sanford Weisberg Applied Linear Regression hird ediion John Wiley & Sons Inc. [3] David Serbin Trend following signal confirmaion using non-price indicaors. [4] Rober J. Ellio John van der Hoe William P. Malcolm Pairs Trading Quaniaive Finance Vol. 5(3) pp. 7-76. [5] Ellio R.J. L. Aggoun J.B. Moore Hidden Marov Models. (Springer Verlag 995) [6] Shumway R.H. D.S. Soffer. An Approach o Time Series Smoohing Fore-casing using he EM Algorihm. Journal of Time Series 3 [4] (98) 53-64.