Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf ·...

22
Systems and Control Seminar Mechanical & Aerospace Engineering, UCLA October 27 st , 2017 University of Tsukuba, Tokyo, Japan Cal State University Fullerton, CA, USA Yuji Yamada , James A. Primbs Model Predictive Control for Optimal Pairs Trading Portfolio with Gross Exposure and Transaction Cost Constraints E-mail: [email protected] http://www2.gssm.otsuka.tsukuba.ac.jp/staff/yuji/ 1

Transcript of Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf ·...

Page 1: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Systems and Control Seminar Mechanical & Aerospace Engineering, UCLA

October 27st, 2017

† University of Tsukuba, Tokyo, Japan ‡ Cal State University Fullerton, CA, USA

Yuji Yamada†, James A. Primbs‡

Model Predictive Control for Optimal Pairs Trading Portfolio

with Gross Exposure and Transaction Cost Constraints

E-mail: [email protected] http://www2.gssm.otsuka.tsukuba.ac.jp/staff/yuji/

1

Page 2: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Only the initial control input is implemented and is updated online

A control methodology applied to portfolio optimization recently, in which a finite horizon control problem is solved based on the prediction of future state and output variables

Find a control action by solving a finite

horizon control problem

Reference (prediction of future states)

2

Wealth consisting of Asset 1

⋮ Asset m

Model predictive control (MPC)

Myopic portfolio: Long term optimal portfolio:

1 day prediction horizon Dynamic yet fixed policy over the entire control horizon.

(e.g., Piccoli and Marigo (2004), Herzog (2005), Herzog et al. (2006, 2007), Meindl (2006), Primbs and Sung (2008), Sridharan et al. (2011), Dombrovskii et al. (2004, 2005, 2006), and so on)

Page 3: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Myopic Time in

Days Day 3 Day 2 Day 1 Day 0

Predict next day returns

3

Optimal Time in

Days Day 3 Day 2 Day 1 Day 0

Fix the target horizon at the maturity

MPC Time in

Days Day 3 Day 2 Day 1 Day 0

Predict long horizon returns (say, one month)

Myopic vs. MPC vs. Long term optimal

Page 4: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Outline Transaction cost and gross exposure constraints

MPC approach for pairs trading portfolio optimization

Empirical simulation

Model predictive control for pairs trading

4

Extend our previous work in Yamada and Primbs (2012) to incorporate transaction cost and gross exposure constraints

Page 5: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Step 1) For a pair of stocks whose spread is mean-reverting, construct a long-short position when an abnormal spread is observed.

t 𝛽 × Stock B

Stock A Abnormal spread (e.g., larger)

Spread = Price of Stock A – 𝛽 × Price of Stock B

Traditional pairs trading

Step 2) Clear the position when the spread reverts towards its mean level in a future period, resulting in the profit of

|Abnormal spread – Mean spread|

(see Elliott et al. (2005), Gatev et al. (2006), Do et al. (2006), Mudchanatongsuk et al. (2008), Tourin and Yan (2013), Song and Zhang (2013), Deshpande and Barmish (2016), Yamamoto and Hibiki (2017) and references therein). 5

Mean (clear the position)

Page 6: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

The value of the wealth 𝑊𝑡 with given prediction horizon 𝜏 ≥ 1:

( ) ( )tTttt

Ttt SuWrSuW −++= ++

τττ 1 ( ) ( )( )tt

Ttt SrSuWr τ

ττ +−++= + 11

[ ]Tmttt SSS )()1( ,,: =[ ]Tm

ttt uuu )()1( ,,: = : Share unit vector on

m pairs of stock prices, 𝑋𝑡(𝑖),𝑌𝑡

(𝑖) , 𝑖 = 1, … ,𝑚 with spreads given as

,: )()()()( it

iit

it YXS β−= mi ,,1=

Pairs trading portfolio

Each spread provides a portfolio of a pair of stocks, and is invested as

6

Total return 𝑅𝑡,𝜏 between times 𝑡 to 𝑡 + 𝜏:

( ) ( )[ ]tftt

Tt

t

tt SrS

Wur

WWR τ

τττ

τ +−++== ++ 11:,

Page 7: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Construction of MPC MPC strategy may be formulated based on a conditional MV optimization

problem for any given prediction horizon (Yamada and Primbs (2012))

[ ] [ ] ,V2

max ,,

⋅−Ε

ℜ∈ττ

γtttt

uRR

mt

( ) ( )[ ]ttt

Tt

t

tt SrS

Wur

WWR τ

τττ

τ +−++== ++ 11:,

7

Mean-reverting spread process:

( ) mmmitqtqtt cecSSSqVAR ℜ∈ℜ∈Φ++Φ++Φ= ×

−− , ,: 11

[ ] ,,,: )()1( Tmttt SSS = ,: )()()()( i

tii

ti

t YXS β−= mi ,,1=

( ),,0~ ΣNetmm×ℜ∈Σ : covariance matrix

A closed form solution is obtained in Yamada and Primbs (2012) as a function of observed spreads and the wealth.

Page 8: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Outline Transaction cost and gross exposure constraints

MPC approach for pairs trading portfolio optimization

Empirical simulation

Model predictive control for pairs trading

8

Extend our previous work in Yamada and Primbs (2012) to incorporate transaction cost and gross exposure constraints

Page 9: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Consideration of transaction costs Proportional transaction cost incurred at time 𝑡:

( ) , 1

)()()()(∑=

∆+m

i

it

it

iit uYX βρ

Absolute value of the sum of positions in 𝑋𝑡

(𝑖) and 𝑌𝑡(𝑖)

Changes in shares in the i-th spread

Wealth & Total return

)()()()( : it

iit

it YX β+=Γ

( ) ( )[ ] ( ) ,1111

)()()(

, ∑=

−+ −Γ+−++++=

m

i t

iti

ti

ttttt WuvrSrSvrR ρττ

ττ

τ

( ) , 11

)(

∆Γ−−++= ∑

=

ΤΤ+

Τ+

m

it

ittttttt uSuWrSuW ρτ

ττ

t

iti

t Wuv

)()( :=( )ρτ,tR

( )0,τtR

)()()( : it

it

it uuu −−=∆

Transaction cost per wealth measured at time 𝑡 9

Page 10: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Transaction cost (TC) constraint Introduce a set of new variables:

)(

)()(

t

iti

ti

t Wuv −−≥κ

( ) ( ) ∑=

Γ+−=m

i

it

ittt rRR

1

)()(,, 10 κρτττ,

)()()(

t

iti

ti

t Wuv −−=κ

Conditional MV problem with TC constraint parameter 𝜌𝑐

)()(

)()( it

t

iti

ti

t Wuv κκ ≤−≤−⇔ −

( )[ ] ( )[ ]0V2

0 max ,, ττγ

ttttv

RRm

t

⋅−Εℜ∈

( ) ∑=

Γ+−m

i

it

itcr

1

)()(1 κρτ

[ ] ( )[ ] ( ) ,101

)()(,, ∑

=

Γ+−Ε=Εm

i

it

ittttt rRR κρτ

ττ [ ] ( )[ ]0VV ,, ττ tttt RR =

Convex quadratic programing problem 10

Page 11: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Gross Exposure (GE) constraint

In academic literature:

Percentage of the size of positions exposed to market risk

If, for example, $100 million has been invested in a fund, which has sold short $50 million of stock and holds $60 million worth of shares, gross exposure is $110 million: 110 divided by 100 times 100 =110 percent.

Constraint on the sum of absolute values of weights

|Long positions|+|Short positions| Total wealth

GE =

(Fan et al. (2012) and Qiu et al. (2015))

In practice:

11

Page 12: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Gross Exposure (GE) constraint Absolute value of long and short positions in the i-th spread:

( ) )()()()()()( it

it

it

iit

it uYXu Γ=+ β

∑∑==

Γ=Γ m

i

it

it

m

i t

it

it

vW

u

1

)()(

1

)()(

λ≤

∑=

≤Γm

i

it

it

1

)()( ,λξ

GE constraint:

, .. )()(

)()( it

t

iti

ti

t Wuvts κκ ≤−≤− − miv i

ti

ti

t

m

i

it

it ,,1 , , )()()(

1

)()( =≤≤−≤Γ∑=

ξξλξ

( )[ ] ( )[ ]0V2

0 max ,, ττγ

ttttv

RRm

t

⋅−Εℜ∈

( ) ∑=

Γ+−m

i

it

itcr

1

)()(1 κρτ

)()()( it

it

it v ξξ ≤≤−⇔

Conditional MV problem with TC and GE constraints:

12

Page 13: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Outline Transaction cost and gross exposure constraints

MPC approach for pairs trading portfolio optimization

Empirical simulation

Model predictive control for pairs trading

13

Extend our previous work in Yamada and Primbs (2012) to incorporate transaction cost and gross exposure constraints

Page 14: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Empirical simulation

Nikkei 225 as of Sep. 2016 with 5 years daily data (218 stocks)

3 year period:

Oct. 2013 – Sep. 2016

Select pairs based on the pairs selection procedure in Yamada and Primbs (2012): 27 pairs

Oct. 2011 – Sep. 2014, Oct. 2012 – Sep. 2015,

In-sample (2 year estimation period):

Out-of-sample (1 year simulation period):

14

Oct. 2013 – Sep. 2015

Oct. 2015 – Sep. 2016

Estimate required parameters including VAR coefficients

Apply the MPC algorithm by solving a QP problem

Page 15: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

MPC Time in

Days Day 3 Day 2 Day 1 Day 0

Prediction horizon: τ

Control period (rebalance interval): δ

Empirical simulation Out-of-sample (1 year simulation period): Oct. 2015 – Sep. 2016

Apply the MPC algorithm by solving a QP problem

15

Parameter specification (if fixed or given):

𝛾 = 1 × 103, 𝜆 = 1 𝐺𝐺 ,𝜌𝑐 = 𝜌 𝑇𝑇 , 𝛿 = 1 (𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟𝑟)

Mean rate of return – Risk free rate Standard deviation

Sharpe ratio = (Annualized)

Page 16: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Prediction horizon vs. Sharpe ratio w/o Transaction cost const.

The decrease in Sharpe ratio is slower if the TC constraint is incorporated.

The Sharpe ratio tends to increase with the length of prediction horizon up to 𝜏 = 40 − 50.

16

w/ Transaction cost const.

Page 17: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

17

w/ Transaction cost const. w/o Transaction cost const.

The Sharpe ratio drops significantly as 𝛿 goes to 1 in the case of 𝜌 = 0.5% for the MPC w/o TC constraint.

Although the Sharpe ratio fluctuates as 𝛿 changes, and drops a little as 𝛿 moves closer to 1, there is not a clear dependence of the Sharpe ratio on 𝛿 for 𝛿 less than 20 for the MPC w/ TC constraint.

𝜏 = 40 𝜏 = 40

Rebalance interval vs. Sharpe ratio

Page 18: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

18

TC rate vs. Sharpe ratio w/ or w/o GE const.

The Sharpe ratio is improved by incorporating the TC constraint (𝜌𝑐 = 𝜌).

It can be further improved by adding the GE constraint.

Rebalance interval =10 Rebalance interval =1

Page 19: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Comparison with unconditional MV optimal portfolio

Estimate expected values and a covariance matrix of stock returns using the same parameter estimation period.

Unconditional MV optimal portfolio:

Effectiveness of using spread information and conditional MV approach vs. unconditional MV objective without spread information

[ ] [ ]ttw

RRm

V2

max2

⋅−Εℜ∈

γ Apply Markowitz model for 27 × 2 = 54 stock returns

,2

1

)(∑=

=m

j

jtjt RwR 𝑅𝑡

(𝑗): Total return on stock 𝑗 = 1, … ,2𝑚

𝜏 = 𝛿 = 1 in the MPC (which is myopic)

Vary 𝛾 (= 10 ∼ 104) 19

Page 20: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

In-sample Out-of-sample

20

MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In-sample): Oct. 2013 – Sep. 2015 Simulation period (Out-of-sample): Oct. 2015 – Sep. 2016

The difference between the lines provides the effect of pairs vs. non-pairs,

The GE constraint actually lowers the SR in myopic & out-of-sample cases w/ GE vs. w/o GE, or in-sample vs. out-of-sample

Page 21: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

21

Role of GE constraint against default Selected sample paths of the wealth when 𝛾 = 10, … , 𝛾 = 25.1

The fund may be able to avoid the risk of default by imposing the GE constraint.

Cases that the wealth drops below zero, indicating that the fund is in default.

MPC w/o GE constraint MPC w/ GE constraint

Page 22: Model Predictive Control for Optimal Pairs Trading ...yamada.yuji.gn/workshop/UCLA20171027.pdf · MPC vs. MV optimal portfolio for different 𝛾 Parameter estimation period (In -sample):

Summary

The conditional MV optimization problem is reduced to a convex quadratic problem even with the TC and the GE constraints.

An important role of the GE constraint may be to avoid the risk of default

MPC strategy for pairs trading portfolio is provided based on a conditional MV optimization problem.

Extended our previous work in Yamada and Primbs (2012) to incorporate transaction cost and gross exposure constraints

Model predictive control for pairs trading

Incorporation of the transaction cost constraint improves the empirical performance of the wealth in terms of Sharpe ratio

22