Optimal Execution & Algorithmic Trading: Jan Ob L Oj Jan - Obloj@maths - Ox.ac - Uk
Optimal Execution & Algorithmic Trading: Jan Ob L Oj Jan - Obloj@maths - Ox.ac - Uk
&
Algorithmic Trading
Jan Oblój
jan.obloj@maths.ox.ac.uk
17 – 21 June 2019
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 1 / 74
Outline Reading
Modelling in Quantitative Finance There is a wealth of ongoing research and growing body of publications.
Brief history of modelling in QF For market impact modelling, a good start are two survey papers:
LOBs Impact – recall • Lehalle,“Market Microstructure Knowledge Needed for Controlling an Intra-Day Trading
Process”
Market Frictions • Gatheral and Schied, “Dynamical models of market impact and algorithms for order
execution”
Price Impact Models and Optimal Execution
both in 2013 Handook on Systemic Risk (ed. Fouque and Langsam) and on arXiv.
The modelling setup For market microstructure, I suggest two review papers and four books:
Almgren–Chriss models • Chakraborti et al, “Econophysics review” (parts I and II), in Quantitative Finance, 2011
• “How markets slowly digest changes in supply and demand”, Bouchaud et al (2009)
Transient Price Impact Models • O’Hara, Market Microstructure Theory, 1995
Obizhaeva–Wang type models • Hasbrouck, Empirical Market Microstructure: The Institutions, Economics, and
Non-robustness w.r.t. decay kernel Econometrics of Securities Trading, 2006
Regularity of market models • Lehalle and Laruelle, Market Microstructure in Practice, 2014.
• Cartea, Jaimungal and Penalva, Algorithmic and High-Frequency Trading, 2015.
Predatory trading and HF hot-potatos
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 2 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 3 / 74
Outline
Modelling in Quantitative Finance
Brief history of modelling in QF
LOBs Impact – recall
Market Frictions
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 4 / 74
Modelling in Quantitative Finance Brief history of modelling in QF Modelling in Quantitative Finance Brief history of modelling in QF
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 5 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 6 / 74
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 7 / 74
Modelling in Quantitative Finance LOBs Impact – recall Modelling in Quantitative Finance LOBs Impact – recall
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 8 / 74 What
c Jan Obdo you think
lój, University caused
of Oxford Price it?
Impact Models and Market Microstructure 17 – 21 June 2019 9 / 74
• A mutual fund activated a program to sell 75, 000 E-Mini S&P 500
contracts (≈ 4.1 billion USD) using VWAP algorithm at 9%
Modelling in Quantitative Finance LOBs Impact – recall • HFT began to quickly buy and resell these contracts to each other
generating more volume: between 2:45:14 and 2:45:27, HFT traded
Flash Crash of May 6th, 2010 27, 000 contracts (about 49% of total volume) while buying only 200
contracts net.
• This led the original program to rapidly sell the whole position
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 10 / 74
Modelling in Quantitative Finance Market Frictions Modelling in Quantitative Finance Market Frictions
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 11 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 12 / 74
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 13 / 74
Modelling in Quantitative Finance Market Frictions Modelling in Quantitative Finance Market Frictions
Chart 1
and exit (Kyle
Aspects of liquidity at no cost,
’85) transparent information). The Aspects ofAspects of liquidity
market liquidity (Kyle ’85)
degree of liquidity of a market is traditionally
assessed on the basis of three essential criteria: Price
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 17 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 18 / 74
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 20 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 21 / 74
Almgren–Chriss type price impact A–C model with linear price impact
The unaffected price follows a Brownian motion:
St0 = S00 + σWt . In the special case of linear impacts: g (x) = γx and h(x) = ηx
Z t
Then, the price impact has two components: X 0
St = St + γ dXs + η Ẋt = St0 + γ(Xt − X0 ) + η Ẋt .
• permanent impact: 0t g (Ẋs )ds
R
0 | {z }
=ItX
• temporary impact: h(Ẋt )
for nondecreasing functions g , h : R → R and Ẋt = dX dt the trading speed.
t The revenues are then given by
The affected price is given by Z T Z T Z T
Z t R(X ) = − StX dXt = S00 X0 + Xt dSt0 − ItX Ẋt dt
X 0
St = St + g (Ẋs )ds + h(Ẋt ). 0 0 0
0
Z T Z T
γ
= S00 x0 +σ Xt dWt − x02 − η Ẋt2 dt,
In the special case of linear impacts: g (x) = γx and h(x) = ηx 0 2 0
Z t
X 0 since XT = 0.
St = St + γ dXs + η Ẋt = St0 + γ(Xt − X0 ) + η Ẋt .
0
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 23 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 24 / 74
The last term is an integral w.r.t. P(dω) ⊗ dt of the square of Ẋt (ω). It
follows that it is minimised, and hence E[R(X )] is maximised, by the
strategy
x0
Ẋt∗ = −
T
which sells (or buys) the shares at constant speed (to see this simply apply
Jensen’s inequality). In particular the solution is independent of the
volatility! (Bertsimas & Lo ’98)
The resulting expected liquidation cost of x0 shares is
γ
E[C(X )] = + η x02
2
quadratic in number of shares and independent of volatility σ.
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 25 / 74
Price Impact Models and Optimal Execution Almgren–Chriss models Price Impact Models and Optimal Execution Almgren–Chriss models
A–C model with mean-variance criterion A–C model with mean-variance criterion
The solution is given by The solution is given by
s s
sinh(κ(T − t)) λσ 2 sinh(κ(T − t)) λσ 2
Xt∗ = x0 for κ = . Xt∗ = x0 for κ = .
sinh κT 2η sinh κT 2η
1 × 106 1 × 106
1 2 3 4 5 1 2 3 4 5
6 6
Optimal liquidation strategy of 10 shares over 5 days under 30% annual vol and Optimal liquidation strategy of 10 shares over 5 days under 30% annual vol and
impact 1% of daily volume = bid-ask. Moderate λ. impact 1% of daily volume = bid-ask. High λ.
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 29 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 30 / 74
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 31 / 74
Price Impact Models and Optimal Execution Almgren–Chriss models Price Impact Models and Optimal Execution Almgren–Chriss models
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 32 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 33 / 74
Outline
Modelling in Quantitative Finance
Brief history of modelling in QF
LOBs Impact – recall
Market Frictions
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 34 / 74
Transient Price Impact Models Obizhaeva–Wang type models Transient Price Impact Models Obizhaeva–Wang type models
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 35 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 36 / 74
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 37 / 74
Transient Price Impact Models Obizhaeva–Wang type models Transient Price Impact Models Obizhaeva–Wang type models
Simple transient price impact – cont. Simple transient price impact – cont.
• Assume now trading is only possible at some give time points: n
X Z t Z t
0 = t0 < t1 < . . . < tn = T , X0 given, XT = 0 and S00 X0 + St0i ∆i = S00 X0 + St0 dXt =− Xt− dSt0
X
i=0 0 0
Xt = X0 + ∆i , where ∆i := Xti + − Xti
i:ti <t which has zero expectation (assuming ∆i bounded). Further,
• The mid-price resulting from strategy X is n
G (0) ∆2i + ∆i
X X
X G (ti − tj )∆j
StX = St0 + G (t − ti )∆i 2
i=0 j<i
i:ti <t X G (0) XX
• The total cost of executing X is = ∆2i + G (ti − tj )∆i ∆j
2
n i i j<i
X G (0) 1 XX
C(X ) = S00 X0 − R(X ) = S00 X0 + ∆2i + ∆i StX = G (|ti − tj |)∆i ∆j
2 2
i=0 i j
n n
X X
G (0) ∆2i + ∆i
X In consequence, the total expected cost of liquidation following X is
= S00 X0 + St0i ∆i + G (ti − tj )∆j
2 1 XX
i=0 i=0 j<i E[C(X )] = G (|ti − tj |) E [∆i ∆j ]
2
i j
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 38 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 39 / 74
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 40 / 74
Transient Price Impact Models Obizhaeva–Wang type models Transient Price Impact Models Obizhaeva–Wang type models
16
12
12 1
14
10
12 10
0.5
8 10
8
0
8
6
6
6
−0.5
4
4
4
2 −1
2 2
20
0
−5 0 5 10 15 20 25
9
0
−5 0 5 10 15 20 25
Which one is which? 0
−20 0 20 40 60 80 100 120
−1.5
−20 0 20 40 60 80 100 120
Which one is which?
8
x 10 6
1.5
8
15
7 1 5
10 0.5 4
4 0 3
5
3
−0.5 2
2
0
1 −1 1
−5 0
−5 0 5 10 15 20 25 −5 0 5 10 15 20 25
−1.5 0
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 41 / 74 −20
c Jan Oblój, University of Oxford
0 20 40 60 80 100
Price
120 −20
Impact
0
Models
20
and Market
40 60 80
Microstructure
100 120
17 – 21 June 2019 42 / 74
1 1 1
G2 (t) = 2
, G3 (t) = 2
G4 (t) = .
(1 + 5t) 1 + (10t) 1 + (7t)2
1.0
0.8
0.6
0.4
0.2
differ dramatically...
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 43 / 74
Transient Price Impact Models Non-robustness w.r.t. decay kernel Transient Price Impact Models Non-robustness w.r.t. decay kernel
Notion of “price manipulation strategy” Transient price impact with arbitrary strategies
With discrete X , the impacted price process was
X Z
X 0 0
We saw that very similar decay functions may lead to drastically different St = St + G (t − ti )∆i = St + G (t − s)dXs
i:ti <t s<t
optimal portfolios, including round-trip-taking trading. Clearly requires
further studies. and the last term extends to arbitrary X (predictable, left-continuous, of
bounded variation). The revenues of a continuous strategy are given as
Definition previously
A round trip strategy X , X0 = XT = 0 with strictly negative expected cost Z T Z T Z TZ
E[C(X )] < 0 is called a price manipulation strategy. − X
St dXt = − 0
St dXt − G (t − s)dXs dXt .
Note that this is not the usual arbitrage since profit is not a.s. but in 0 0 0 s<t
expectation. However in some models rescaling and repeating price In the case of discrete X we had
manipulation leads to (weak) arbitrage. Xn
1 XX
− St0i ∆i − G (|ti − tj |)∆i ∆j
We first extend our previous analysis to arbitrary strategies X . 2
i=0 i j
Z T Z Z
0 1
=− St dXt − G (|t − s|)dXs dXt
0 2
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 44 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 45 / 74
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 46 / 74
Transient Price Impact Models Non-robustness w.r.t. decay kernel Transient Price Impact Models Non-robustness w.r.t. decay kernel
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 47 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 48 / 74
12
10
0
0 1 2 3 4 5 6 7 8 9 10
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 49 / 74
Transient Price Impact Models Non-robustness w.r.t. decay kernel Transient Price Impact Models Non-robustness w.r.t. decay kernel
Optimal trading with Gaussian decay G (t) = exp(−t 2 ), Optimal trading with Gaussian decay G (t) = exp(−t 2 ),
T = 10, X0 = −100, N = 15 T = 10, X0 = −100, N = 20
16 40
14
30
12
20
10
8 10
6
0
4
−10
−20
0
−2 −30
−2 0 2 4 6 8 10 12 14 16 −5 0 5 10 15 20 25
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 50 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 51 / 74
150
100
50
−50
−100
−150
−200
−5 0 5 10 15 20 25 30
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 52 / 74
Transient Price Impact Models Non-robustness w.r.t. decay kernel Transient Price Impact Models Non-robustness w.r.t. decay kernel
Optimal trading with Gaussian decay G (t) = exp(−t 2 ), Optimal trading with Gaussian decay G (t) = exp(−t 2 ),
T = 10, X0 = −100, N = 37 T = 10, X0 = −100, N = 38
5 6
x 10 x 10
3 2
1.5
2
1
0.5
0 0
−0.5
−1
−1
−2
−1.5
−3 −2
−5 0 5 10 15 20 25 30 35 40 −5 0 5 10 15 20 25 30 35 40
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 53 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 54 / 74
−1
−2
−3
−4
−5
−20 0 20 40 60 80 100 120
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 56 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 57 / 74
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 58 / 74
Transient Price Impact Models Regularity of market models Transient Price Impact Models Regularity of market models
• Non-linear transient price impact models: the book has varying depth • Transient price impact models take into account the interaction of
according to a given shape f , see Alfonsi & Schied ’10 orders with the LOB and market resilience
• A combination of impacts, e.g. Gatheral ’10 • Under constant LOB depth, discrete trading at (ti ) and maximising
Z t expected revenues the optimal strategy explicit for many impact
StX = St0 + h(−Ẋt )G (t − s)ds decay kernels G
0
• More generally the problem quickly becomes very hard...
• Stochastic models of LOB where the shape f is a stochastic process • Even in simple setting, the optimal strategies may often involve round
in space of curves and/or stochastic resilience, see Alfonsi & Infante trips. Solution is non-robust with respect to G .
Acevedo ’12, Klöck ’12, Fruth, Schöneborn & Urusov ’11, Müller &
• Possible to study, and provide sufficient conditions for, the absence of
Keller-Ressel ’15.
price-triggered manipulation strategies.
• ...
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 59 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 60 / 74
Outline
Modelling in Quantitative Finance
Brief history of modelling in QF
LOBs Impact – recall
Market Frictions
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 61 / 74
Predatory trading and HF hot-potatos Predatory trading and HF hot-potatos
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 62 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 63 / 74
Predatory Trading
“... if lenders know that a hedge fund needs to sell something quickly, they
will sell the same asset – driving the price down even faster. Goldman,
Sachs & Co. and other counterparties to LTCM did exactly that in 1998.”
Business Week, 26 Feb 2001
“When you smell blood in the water, you become a shark ... when you
know that one of your number is in trouble ... you try to figure out what
he owns and you start shorting those stocks ... ”
Cramer, 2002
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 64 / 74
Predatory trading and HF hot-potatos Predatory trading and HF hot-potatos
Predatory Trading – mechanisms One-period game model with A–Ch price impact
When a need of a large trader (prey) to liquidate is recognised, the • n + 1 players with portfolios X0 (t), . . . , Xn (t), t ∈ [0, T ], assumed
strategic traders (predators) might cont. diff. in time
• first trader in the same direction • one prey (seller): X0 (0) = x0 > 0, X0 (T ) = 0
• withdraw liquidity instead of providing it • n predators: Xi (0) = Xi (T ) = 0, i = 1, . . . , n
• market impact is greater leading to price overshooting • and the above is common knowledge
• may further enforce distressed trader’s need to liquidate
• players are risk-neutral and maximise their expected profit
• then reverse direction to profit from the overshoot
Z T
• closing the roundtrip at a profit. i
R (X ) = − E St dXi (t)
However when strategic traders have a longer horizon than the liquidation, 0
their behaviour may depend on market characteristics: • one risk-free and one risky asset, continuous trading, Almgren–Chriss
• could act as predators as above large trader tries to keep linear price impact model
intentions hidden (stealth trading)
n n
• could act as liquidity providers large trader announces intentions S(t) = S(0) + σWt + γ
X
(Xi (t) − Xi (0)) + η
X
Ẋi (t)
(sunshine trading) i=1 i=1
see Brunnermeier & Pedersen ’05, Carlin, Lobo & Viswanathan ’05, Schied &
• Solved by searching for Nash equilibrium.
Schöneborn ’08.
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 65 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 66 / 74
where
−n γ − n γ T −1 x0
α= 1 − e n+2 η ,
n+2η n+1
−1
γ γη T x0
βi = e −1 Xi (T ) − Xi (0) +
η n+1
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 67 / 74
Predatory trading and HF hot-potatos Predatory trading and HF hot-potatos
γ γ
Optimal strategies with n = 1, T = 1, η = 0.3 Optimal strategies with n = 1, T = 1, η = 20
100 100
80
50
60
40
Distressed trader (blue) and one predator in a elastic market Distressed trader (blue) and one predator in an plastic market
(i.e. temporary impact > permanent impact) (i.e. permanent impact > temporary impact)
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 68 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 69 / 74
γ
Optimal strategies with n = 1, T = 1, η = 100
100
50
!50
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 70 / 74
Predatory trading and HF hot-potatos Predatory trading and HF hot-potatos
80 80
50
50
60
60
97.2
96.86 70 60.10
97.0
96.8 96.84
65 60.05
96.6
96.82
96.4
0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0
0.2 0.4 0.6 0.8 1.0 0.2 0.4 0.6 0.8 1.0
Expected execution cost E[C(X )]: 3.1% and 3.2% (compare with 3% when n = 0) Expected execution cost E[C(X )]: 33.3% and 40% (was 22% when n = 0)
Expected revenue per predator: 665 and 2.3.
Expected revenue per predator: 7.27 and 0.4.
Price and execution costs scale linearly with costs when keeping γη fixed.
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 71 / 74 c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 72 / 74
HF hot-potato game
c Jan Oblój, University of Oxford Price Impact Models and Market Microstructure 17 – 21 June 2019 73 / 74
Predatory trading and HF hot-potatos