Post on 15-Apr-2020
transcript
Trading Strategies via Book Imbalance
Umberto Pesaventojoint work with Alexander Lipton and Michael G. Sotiropoulos
Algorithmic Trading Quantitative ResearchBank of America Merrill Lynch
Financial Engineering Workshops, Cass Business SchoolCity University London, 8 October 2014
U. Pesavento, Bank of America Merrill Lynch 1 of 26 8 October 2014
Bank of America Merrill Lynch
Contents
Limit order books and algorithmic trading
Empirical observations
Modeling the bid and ask queues
Adding trade arrival dynamics
Calibration
Conclusions and current work
Appendix
References
U. Pesavento, Bank of America Merrill Lynch 2 of 26 8 October 2014
Bank of America Merrill Lynch
Limit order books and algorithmic trading: a top down approach
Sell trade127 800126 300
130 500129 1000
131 300132 800133 1500134 1000135 500
133 1500
131 100132 800
134 1000
128 1500127 800126 300
129 1000130 500
134 1500
132 100133 800
135 1000
129 1500128 800127 300
131 500130 1000
130 300131 800132 1500133 1000134 500
127 1500126 800125 300
129 500128 1000
t
t0 t t t t t t t t1 2 3 4 5 6 7 8
time
i
volu
me
ti+1
bid
ask
Buy trade
128 1500
A divide and conquer approach based on 3 phases:• calculating a time-volume schedule;
• limit order placement: optimal trading of the allocated shares within the given horizon;
• venue allocation.
U. Pesavento, Bank of America Merrill Lynch 3 of 26 8 October 2014
Bank of America Merrill Lynch
Empirical observations: stopping times and book averaging
A separation of time scales:• queue length updates (≈ 3 s);
• best bid-ask updates (≈ 8 s);
• trade arrivals (≈ 12 s).
t0 pb0 pa
0 qb0 qa
0t1 pb
1 pa1 qb
1 qa1
t2 pb2 pa
2 qb2 qa
2t0 p0 q0 s0
t3 pb3 pa
3 qb3 qa
3t4 pb
4 pa4 qb
4 qa4
t1 p1 q1 s1
t5 pb5 pa
5 qb5 qa
5t6 pb
6 pa6 qb
6 qa6
t2 p2 q2 s2... ... ... ... ...
U. Pesavento, Bank of America Merrill Lynch 4 of 26 8 October 2014
Bank of America Merrill Lynch
Empirical observations: mid price movements conditional on an book imbalance
Non-martingale properties of prices at small time scale:• future price variations can be predicted by using the imbalance in the bid and ask queues of
the order book I = (qb − qa)/(qb + qa);
• statistically significant (about 107data points for the plot above);
• the effect is not large enough to lead to a straightforward arbitrage but significant enough toyield savings in execution costs.
U. Pesavento, Bank of America Merrill Lynch 5 of 26 8 October 2014
Bank of America Merrill Lynch
Empirical observations: trade arrivals and related stopping times
Changing the stopping time:• the overall trend in the expected price movements as a function of the book imbalance is the
same;
• conditioning on the arrival of trades on a particular side of the book breaks the symmetry inthe expected waiting time and price movements.
U. Pesavento, Bank of America Merrill Lynch 6 of 26 8 October 2014
Bank of America Merrill Lynch
Modeling the bid and ask queues: replenishment processes and the constantspread approximation
130 8600
132 9000 133 6500135 3700
127 4500128 3000129 5000130 8600
128 3000129 5000130 8600131 7200
132 9000 133 6500
137 1500135 3700
initial queues
replenished queues
bid queue (up−tick)
ask
queu
e (d
own−
tick)
bid
ask
depletion replenishment
132 9000 133 6500135 3700
127 4500128 3000129 5000
131 7200
Simple models for queues and price dynamics:
• two correlated diffusion processes to represent the bid and ask queues (qb, qa) = (W b,W a);
• price moves are associated with queues depletion;
• queues replenishment, drawing from a stationary distribution;
• assume constant spreads (not a bad approximation for liquid stocks)
.
U. Pesavento, Bank of America Merrill Lynch 7 of 26 8 October 2014
Bank of America Merrill Lynch
Modeling the bid and ask queues: time dependent dynamics
Pt +12
Pxx +12
Pyy + ρxy Pxy = 0, (1)
where ρxy is the correlation between the processes governing the depletion and replenishment ofthe bid and ask queues, which typically takes a negative value in a normal market.
α(x, y) = x
β(x, y) =−(ρxy x − y)√
1− ρ2xy
, (2)
yielding equation:
Pt +12
Pαα +12
Pββ = 0. (3)
And the second to cast the problem in polar coordinates:
α =− r sin(ϕ−$)
β =r cos(ϕ−$)←→
r =√α2 + β2
ϕ =$ + arctan(−α
β
).
(4)
where cos$ = −ρxy , so to yield the following equation for the hitting probabilities:
Pt +12
(Vrr +
1r
Pr +1r2
Pϕϕ)
= 0. (5)
with the final condition: P(T , T , r , ϕ) = 0 and boundary conditions:
P(t, T , 0, ϕ) = 0, P(t, T ,∞, ϕ) = 0, P (t, T , r , 0) = P0, P(t, T , r , $) = P1.
U. Pesavento, Bank of America Merrill Lynch 8 of 26 8 October 2014
Bank of America Merrill Lynch
Modeling the bid and ask queues: Green’s function formulationWe seek the Green’s function to equation (5) by separating its radial and angular components:
G(τ, r ′, ϕ′) = g(τ, r ′)f (ϕ′), (6)This leads to two equations coupled by the positive constant Λ2 :
gτ =12
(gr′ r′ +
1r ′
gr′ −Λ2
r ′2g
), (7)
fϕ′ϕ′ =− Λ2f . (8)
The radial part is solved by:
g(τ, r ′) =e−
r′2+r20
2τ
τIΛ
(r ′r0
τ
), (9)
where IΛ(ξ) is the modified Bessel function of the first kind corresponding to Λ. After applying theboundary conditions on the angular part of the equation, the final formula for the Green’s function is:
G(τ, r0, r
′, ϕ0, ϕ
′) =2e−
r′2+r20
2τ
$τ
∞∑n=1
Iνn
(r ′r0
τ
)sin(νnϕ′) sin (νnϕ0). (10)
where νn = nπω . Finally, we integrate the equation above to obtain the hitting probability for the of
an up-tick (or down-tick) conditional on the initial condition of the queue.
P(t, T , r0, ϕ0) =−12
T
t
∞
0
Gϕ(t′− t, r , $)1r
drdt′. (11)
U. Pesavento, Bank of America Merrill Lynch 9 of 26 8 October 2014
Bank of America Merrill Lynch
Modeling the bid and ask queues: infinite time limit
By writing out the explicit form for the Green’s function we obtain:
P (0, r0, φ0) =∞∑
n=1
ˆ T
0
ˆ ∞0
e−r2+r2
02t
$trIνn
(rr0
t
)dtdr
(−1)n+1νn sin (νnφ0) . (12)
We reverse the order of integration and evaluate the time integral using the following expression:
ˆ ∞0
e−r2+r2
02t
$trIνn
(rr0
t
)dt =
1
$νnr(√
s2 − 1 + s)νn (13)
where s = (r2 + r20 )/2rr0. We can then integrate along the radial component,
ˆ ∞0
1
$νnr(
max(
rr0,
r0r
))νn dr =1
$νnrνn0
ˆ r0
0rνn−1dr +
rνn0
$νn
ˆ ∞r0
r−νn−1dr =2
$ν2n. (14)
Finally, we sum the series to obtain:
P (0, r0, φ0) =2π
∞∑n=1
(−1)n+1
nsin(πn$φ0
)=φ0
$. (15)
As expected, the result depends only on the angular distance from the barrier.
U. Pesavento, Bank of America Merrill Lynch 10 of 26 8 October 2014
Bank of America Merrill Lynch
Modeling the bid and ask queues: time independent formulation I
We now consider the time-independent problem from the onset:
12
Pxx +12
Pyy + ρxy Pxy = 0, (16)
P (x, 0) = 1, P (0, y) = 0. (17)
Again, we perform a change of coordinates to eliminate the correlation term,α(x, y) = x
β(x, y) =(−ρxy x + y)√
1− ρ2xy
, (18)
yielding equation:
Pαα + Pββ = 0. (19)
U. Pesavento, Bank of America Merrill Lynch 11 of 26 8 October 2014
Bank of America Merrill Lynch
Modeling the bid and ask queues: time independent formulation II
We then perform a the second transformation to casts the modified problem in polar coordinates:
α =r sin(ϕ)
β =r cos(ϕ)←→
r =√α2 + β2
ϕ =arctan(α
β
),
(20)
where cos$ = −ρxy . Then the equation becomes
Pϕϕ(ϕ) = 0, (21)
with boundary conditions P(0) = 0 and P($) = 1. In this coordinate set the solution isstraightforward P(ϕ) = ϕ/$, which in the original set of coordinates has the form:
P(x, y) =12
1−arctan(
√1+ρxy1−ρxy
y−xy+x )
arctan(
√1+ρxy1−ρxy
)
.
(22)
U. Pesavento, Bank of America Merrill Lynch 12 of 26 8 October 2014
Bank of America Merrill Lynch
Adding trade arrival dynamics: the trade arrival process
In analogy with the two Brownian processes representing the bid and ask queues, we add a third(unobservable) process to model trade arrival on the near side of the book:
(dqb, dqa
, dφ) = (dwb, dwa
, dwφ)
U. Pesavento, Bank of America Merrill Lynch 13 of 26 8 October 2014
Bank of America Merrill Lynch
Adding trade arrival dynamics: handling correlation
12
Pxx +12
Pyy +12
Pzz + ρxy Pxy + ρxz Pxz + ρyz Pyz = 0 (23)
as in two dimensions, it is possible to eliminate the correlation terms,
α(x, y, z) =x
β(x, y, z) =(−ρxy x + y)√
1− ρ2xy
γ(x, y, z) =
[(ρxyρyz − ρxz ) x + (ρxyρxz − ρyz ) y + (1− ρ2
xy )z]
√1− ρ2
xy
√1− ρ2
xy − ρ2xz − ρ2
yz + 2ρxyρxzρyz
,
(24)
to obtain:
Pαα + Pββ + Pγγ = 0, (25)
U. Pesavento, Bank of America Merrill Lynch 14 of 26 8 October 2014
Bank of America Merrill Lynch
Adding trade arrival dynamics: changing the domain
Again, we can write the exit probability problem in a simpler form by changing the computationaldomain Ω:
1sin2 θ
Pφφ (φ, θ) +1
sin θ∂
∂θ(sin θPθ (φ, θ)) = 0, (26)
P (0, θ) = 0, P ($, θ) = 0, P (φ,Θ (φ)) = 1. (27)
α =r sin θ sinϕ
β =r sin θ cosϕ
γ =r cos θ
U. Pesavento, Bank of America Merrill Lynch 15 of 26 8 October 2014
Bank of America Merrill Lynch
Adding trade arrival dynamics: semi analytical solutions IWe introduce a new variable ζ = ln tan θ/2 and rewrite the exit problem again as [Lipton 2013]:
Pφφ (φ, ζ) + Pζζ (φ, ζ) = 0, (28)computational domain is now a semi-infinite strip with curvilinear boundary
ζ = Z (φ) = ln(
tan(
Θ (φ)
2
)). (29)
We look for the solution of the Dirichlet problem for the Laplace equation in the form
P(ϕ, ζ) =∞∑
n=1
cn sin(knϕ), kn =πn$
(30)
where the values of expansion coefficients cn can be determined by enforcing the boundarycondition
P(ϕ,Θ(ϕ)) = 1 (31)
ζ = ln tan θ/2
ϕ =ϕ
U. Pesavento, Bank of America Merrill Lynch 16 of 26 8 October 2014
Bank of America Merrill Lynch
Adding trade arrival dynamics: semi analytical solutions IIIn order to compute the coefficients, we introduce the integrals
Jmn =
$
0
sin(kmϕ) sin(knϕ)e(kn+km)Z (ϕ)dϕ, (32)
Im =
$
0
sin(kmϕ)ekmZ (ϕ)dϕ. (33)
Then the boundary condition (31) becomes∑n
Jmncn = Im, (34)
and cn can be computed by matrix inversion as c = J−1I.
U. Pesavento, Bank of America Merrill Lynch 17 of 26 8 October 2014
Bank of America Merrill Lynch
Calibration: putting everything together
Book event probabilities as a function of the bid-ask imbalance:• left region of the plot, price improvement is likely: get ready to reprice;
• central region of the plot, a trade on the near side is likely to anticipate an adverse price move:stay posted;
• right region of the plot: consider crossing the spread.
U. Pesavento, Bank of America Merrill Lynch 18 of 26 8 October 2014
Bank of America Merrill Lynch
Calibration: the role of correlation
• Correlation is the main effect responsible for the symmetry breaking in the evolution of theprice expectation as a function of imbalance.
• It can also explain a big part of the adverse selection effect which we observe when postingorders in a limit order book.
• The model can capture the main features of symmetry breaking in the trade arrival process.
U. Pesavento, Bank of America Merrill Lynch 19 of 26 8 October 2014
Bank of America Merrill Lynch
Conclusions and current work: from trade arrival rates to empirical fillprobabilities
Empirical fill probabilities, learning from our own execution data:• real data tends to be noisy, but it displays consistent trends• parametric forms of fill probabilities as a function of the limit order placement x can be
estimated, i.e. P(x) = 1− e−βx
U. Pesavento, Bank of America Merrill Lynch 20 of 26 8 October 2014
Bank of America Merrill Lynch
Conclusions and current work: from empirical fill probabilities to optimizationschedules, a dynamic programming approach
Given an approximate functional form for the fill probability, we can solve the recursive optimizationproblem given by:
E [Pi ] = minx
((1− p(x))E [Pi+1] + p(x)x) (35)
where p(x) is the fill probability of a limit order with a limit price of x .• what is the optimal placement of a limit order? (blue line)
• what is the expected fill price? (red line)
U. Pesavento, Bank of America Merrill Lynch 21 of 26 8 October 2014
Bank of America Merrill Lynch
Conclusions and current work: optimizing thresholds
Going on step further, parameter selection and price slippage estimation as a function of the slicesize:• as expected, larger slices will produce a larger slippage;• the optimal trade off between waiting and crossing the spread depends on the size of the slice
to be executed;• an optimal ridge in the parameter space can be calculated under certain assumptions.
U. Pesavento, Bank of America Merrill Lynch 22 of 26 8 October 2014
Bank of America Merrill Lynch
Appendix: order flow and impact
We can also attempt to predict price movements and arrival times by conditioning on localmeasurements of prevailing order flows rather than book imbalance.
U. Pesavento, Bank of America Merrill Lynch 23 of 26 8 October 2014
Bank of America Merrill Lynch
Appendix: a time dependent slice of the problem
Average time evolution of the mid-price across a trade event:• Before trade arrival prices tends to drift towards the near side of the book;
• At trade arrival impact dominates and prices moves towards the far side of the book.
U. Pesavento, Bank of America Merrill Lynch 24 of 26 8 October 2014
Bank of America Merrill Lynch
Appendix: queues depletion and replenishment
Depletion of the bid and ask queues across bid up-ticks and down-tick price movements:• down-tick move, the initial queue size is thin while the next layer if fully formed;
• up-tick move, the previous layer is fully formed and the next queue distribution is thin;
• the ask queue is statistically unaffected.
U. Pesavento, Bank of America Merrill Lynch 25 of 26 8 October 2014
Bank of America Merrill Lynch
References
[1] A. Lipton, U. Pesavento, M.Sotiropoulos, Risk, April, 2014.
[2] R. Almgren, C. Thum, H. L. Hauptmann, and H. Li. Equity market impact. Risk, 18:57, 2005.
[3] M. Avellaneda and S. Stoikov. High-frequency trading in a limit order book. QuantitativeFinance, 8:217–224, 2008.
[4] J.-P. Bouchaud, J. D. Farmer, and F. Lillo. How markets slowly digest changes in supply anddemand. In T. Hens and K Schenk-Hoppe, editors, Handbook of Financial Markets: Dynamicsand Evolution.
[5] J.-P. Bouchaud, D. Mezard, and M. Potters. Statistical properties of stock order books:empirical results and models. Quantitative Finance Finance, 2:251–256, 2002.
[6] R. Cont and A. de Larrard. Order book dynamics in liquid markets: limit theorems anddiffusion approximations. Working paper, 2012.
[7] R. F. Engle. The econometrics of ultra-high frequency data. Econometrica, 68:1–22, 2000.
[8] J. Hasbrouck. Measuring the information content of stock trades. Journal of Finance,46:179–207, 1991.
[9] A. Lipton and I. Savescu. CDSs, CVA and DVA - a structural approach. Risk, 26(4), 2013.
[10] S. Stoikov R. Cont and R. Talreja. A stochastic model for order book dynamics. Operationsresearch, 58(3):549–563, 2010.
[11] E. Smith, J.D. Farmer, L. Gillemot, and S. Krishnamurthy. Statistical theory of the continuousdouble auction. Quantitative Finance, 3:481– 514, 2003.
U. Pesavento, Bank of America Merrill Lynch 26 of 26 8 October 2014