0% found this document useful (0 votes)
52 views16 pages

A Stochastic Model For Order Book Dynamics

Uploaded by

Yuxiang Wu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views16 pages

A Stochastic Model For Order Book Dynamics

Uploaded by

Yuxiang Wu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

This article was downloaded by: [128.119.168.

112] On: 06 November 2017, At: 11:25


Publisher: Institute for Operations Research and the Management Sciences (INFORMS)
INFORMS is located in Maryland, USA

Operations Research
Publication details, including instructions for authors and subscription information:
http://pubsonline.informs.org

A Stochastic Model for Order Book Dynamics


Rama Cont, Sasha Stoikov, Rishi Talreja,

To cite this article:


Rama Cont, Sasha Stoikov, Rishi Talreja, (2010) A Stochastic Model for Order Book Dynamics. Operations Research
58(3):549-563. https://doi.org/10.1287/opre.1090.0780

Full terms and conditions of use: http://pubsonline.informs.org/page/terms-and-conditions

This article may be used only for the purposes of research, teaching, and/or private study. Commercial use
or systematic downloading (by robots or other automatic processes) is prohibited without explicit Publisher
approval, unless otherwise noted. For more information, contact [email protected].

The Publisher does not warrant or guarantee the article’s accuracy, completeness, merchantability, fitness
for a particular purpose, or non-infringement. Descriptions of, or references to, products or publications, or
inclusion of an advertisement in this article, neither constitutes nor implies a guarantee, endorsement, or
support of claims made of that product, publication, or service.

Copyright © 2010, INFORMS

Please scroll down for article—it is on subsequent pages

INFORMS is the largest professional society in the world for professionals in the fields of operations research, management
science, and analytics.
For more information on INFORMS, its publications, membership, or meetings visit http://www.informs.org
OPERATIONS RESEARCH informs ®
Vol. 58, No. 3, May–June 2010, pp. 549–563
issn 0030-364X  eissn 1526-5463  10  5803  0549 doi 10.1287/opre.1090.0780
© 2010 INFORMS

A Stochastic Model for Order Book Dynamics


Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

Rama Cont
Department of Industrial Engineering and Operations Research, Columbia University, New York, New York 10027,
[email protected]
Sasha Stoikov
Cornell Financial Engineering Manhattan, New York, New York 10004,
[email protected]

Rishi Talreja
Department of Industrial Engineering and Operations Research, Columbia University, New York, New York 10027,
[email protected]

We propose a continuous-time stochastic model for the dynamics of a limit order book. The model strikes a balance
between three desirable features: it can be estimated easily from data, it captures key empirical properties of order book
dynamics, and its analytical tractability allows for fast computation of various quantities of interest without resorting to
simulation. We describe a simple parameter estimation procedure based on high-frequency observations of the order book
and illustrate the results on data from the Tokyo Stock Exchange. Using simple matrix computations and Laplace transform
methods, we are able to efficiently compute probabilities of various events, conditional on the state of the order book: an
increase in the midprice, execution of an order at the bid before the ask quote moves, and execution of both a buy and a
sell order at the best quotes before the price moves. Using high-frequency data, we show that our model can effectively
capture the short-term dynamics of a limit order book. We also evaluate the performance of a simple trading strategy based
on our results.
Subject classifications: limit order book; financial engineering; Laplace transform inversion; queueing systems;
simulation.
Area of review: Financial Engineering.
History: Received September 2008; revision received March 2009; accepted August 2009. Published online in Articles in
Advance February 26, 2010.

The evolution of prices in financial markets results from some insight into the interplay between order flow, liquid-
the interaction of buy and sell orders through a rather com- ity, and price dynamics (Bouchaud et al. 2002, Smith et al.
plex dynamic process. Studies of the mechanisms involved 2003, Farmer et al. 2004, Foucault et al. 2005). At the level
in trading financial assets have traditionally focused on of applications, such models provide a quantitative frame-
quote-driven markets, where a market maker or dealer cen- work in which investors and trading desks can optimize
tralizes buy and sell orders and provides liquidity by set- trade execution strategies (Alfonsi et al. 2010, Obizhaeva
ting bid and ask quotes. The NYSE specialist system is and Wang 2006). An important motivation for modelling
an example of this mechanism. In recent years, electronic high-frequency dynamics of order books, is to use the infor-
communications networks (ECNs) such as Archipelago, mation on the current state of the order book to predict
Instinet, Brut, and Tradebook have captured a large share its short-term behavior. We focus, therefore, on conditional
of the order flow by providing an alternative order-driven probabilities of events, given the state of the order book.
trading system. These electronic platforms aggregate all The dynamics of a limit order book resembles in many
outstanding limit orders in a limit order book that is avail- aspects that of a queuing system. Limit orders wait in a
able to market participants and market orders are exe- queue to be executed against market orders (or canceled).
cuted against the best available prices. As a result of Drawing inspiration from this analogy, we model a limit
the ECN’s popularity, established exchanges such as the order book as a continuous-time Markov process that tracks
NYSE, NASDAQ, the Tokyo Stock Exchange, and the the number of limit orders at each price level in the book.
London Stock Exchange have adopted electronic order- The model strikes a balance between three desirable fea-
driven platforms, either fully or partially through “hybrid” tures: it can be estimated easily using high-frequency data,
systems. it reproduces various empirical features of order books, and
The absence of a centralized market maker, the mechan- it is analytically tractable. In particular, we show that our
ical nature of execution of orders and, last but not least, model is simple enough to allow the use of Laplace trans-
the availability of data have made order-driven markets form techniques from the queuing literature to compute
interesting candidates for stochastic modelling. At a funda- various conditional probabilities. These include the prob-
mental level, models of order book dynamics may provide ability of the midprice increasing in the next move, the
549
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
550 Operations Research 58(3), pp. 549–563, © 2010 INFORMS

probability of executing an order at the bid before the ask 1. A Continuous-Time Model for a
quote moves, and the probability of executing both a buy Stylized Limit Order Book
and a sell order at the best quotes before the price moves,
given the state of the order book. Although here we only 1.1. Limit Order Books
focus on these events, the methods we introduce allow one
Consider a financial asset traded in an order-driven market.
to compute conditional probabilities involving much more
Market participants can post two types of buy/sell orders. A
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

general events such as those involving latency associated


limit order is an order to trade a certain amount of a security
with order processing (see Remark 1). We illustrate our
at a given price. Limit orders are posted to a electronic
techniques on a model estimated from order book data for
trading system, and the state of outstanding limit orders can
a stock on the Tokyo Stock Exchange.
be summarized by stating the quantities posted at each price
Related literature. Various recent studies have focused
level: this is known as the limit order book. The lowest
on limit order books. Given the complexity of the struc-
price for which there is an outstanding limit sell order is
ture and dynamics of order books, it has been difficult
called the ask price and the highest buy price is called the
to construct models that are both statistically realistic and
bid price.
amenable to rigorous quantitative analysis. Parlour (1998),
A market order is an order to buy/sell a certain quantity
Foucault et al. (2005), and Rosu (2009) propose equilib-
of the asset at the best available price in the limit order
rium models of limit order books. These models provide
book. When a market order arrives it is matched with the
interesting insights into the price formation process, but
contain unobservable parameters that govern agent prefer- best available price in the limit order book, and a trade
ences. Thus, they are difficult to estimate and use in appli- occurs. The quantities available in the limit order book are
cations. Some empirical studies on properties of limit order updated accordingly.
books are Bouchaud et al. (2002), Farmer et al. (2004), A limit order sits in the order book until it is either exe-
and Hollifield et al. (2004). These studies provide an exten- cuted against a market order or it is canceled. A limit order
sive list of statistical features of order book dynamics that may be executed very quickly if it corresponds to a price
are challenging to incorporate in a single model. Bouchaud near the bid and the ask, but may take a long time if the
et al. (2008), Smith et al. (2003), Bovier et al. (2006), market price moves away from the requested price or if the
Luckock (2003), and Maslov and Mills (2001) propose requested price is too far from the bid/ask. Alternatively, a
stochastic models of order book dynamics in the spirit of limit order can be canceled at any time.
the one proposed here, but focus on unconditional/steady– We consider a market where limit orders can be placed
state distributions of various quantities rather than the con- on a price grid 1     n representing multiples of a price
ditional quantities we focus on here. tick. The upper boundary n is chosen large enough so that
The model proposed here is admittedly simpler in struc- it is highly unlikely that orders for the stock in question are
ture than some others existing in the literature: It does not placed at prices higher than n within the time frame of our
incorporate strategic interaction of traders as in the game- analysis. Because the model is intended to be used on the
theoretic approaches of Parlour (1998), Foucault et al. time scale of hours or days, this finite boundary assumption
(2005), and Rosu (2009), nor does it account for “long is reasonable. We track the state of the order book with
memory” features of the order flow as pointed out by a continuous-time process Xt ≡ X1 t     Xn tt0 ,
Bouchaud et al. (2002, 2008). However, contrarily to these where Xp t is the number of outstanding limit orders at
models, it leads to an analytically tractable framework price p, 1  p  n. If Xp t < 0, then there are −Xp t bid
where parameters can be easily estimated from empirical orders at price p; if Xp t > 0, then there are Xp t ask
data and various quantities of interest may be computed orders at price p.
efficiently. The ask price pA t at time t is then defined by
Outline. The paper is organized as follows. Section 1
pA t = infp = 1     n Xp t > 0 ∧ n + 1
describes a stylized model for the dynamics of a limit
order book, where the order flow is described by inde- Similarly, the bid price pB t is defined by
pendent Poisson processes. Estimation of model param-
eters from high-frequency order book time-series data is pB t ≡ supp = 1     n Xp t < 0 ∨ 0
described in §2 and illustrated using data from the Tokyo
Stock Exchange. In §3 we show how this model can be Notice that when there are no ask orders in the book we
used to compute conditional probabilities of various types force an ask price of n + 1, and when there are no bid
of events relevant for trade execution using Laplace trans- orders in the book we force a bid price of 0. The midprice
form methods. Section 4 explores steady-state properties of pM t and the bid-ask spread pS t are defined by
the model using Monte Carlo simulation, compares condi-
pB t + pA t
tional probabilities computed by simulation to those com- pM t ≡ and pS t ≡ pA t − pB t
puted with the Laplace transform methods presented in §3, 2
and analyzes a high-frequency trading strategy based on Because most of the trading activity takes place in the
our results in §4.3. Section 5 concludes. vicinity of the bid and ask prices, it is useful to keep track
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
Operations Research 58(3), pp. 549–563, © 2010 INFORMS 551

of the number of outstanding orders at a given distance • Limit buy (respectively sell) orders arrive at a dis-
from the bid/ask. To this end, we define tance of i ticks from the opposite best quote at independent,
⎧ exponential times with rate i,
⎨XpA t−i t 0 < i < pA t • Market buy (respectively sell) orders arrive at inde-
QiB t = (1) pendent, exponential times with rate
,

0 pA t  i < n • Cancellations of limit orders at a distance of i ticks
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

from the opposite best quote occur at a rate proportional


the number of buy orders at a distance i from the ask, and to the number of outstanding orders: If the number of out-
⎧ standing orders at that level is x, then the cancellation rate
⎨XpB t+i t 0 < i < n − pB t is ix. This assumption can be understood as follows: if
QiA t = (2) we have a batch of x outstanding orders, each of which

0 n − pB t  i < n can be canceled at an exponential time with parameter i,
then the overall cancellation rate for the batch is ix.
the number of sell orders at a distance i from the bid. • The above events are mutually independent.
Although Xt and pA t pB t QA t QB t contain Order arrival rates depend on the distance to the bid/ask
the same information, the second representation highlights with most orders being placed close to the current price. We
the shape or depth of the book relative to the best quotes. model the arrival rate as a function  1     n → 0 
of the distance to the bid/ask. Empirical studies (Zovko and
1.2. Dynamics of the Order Book Farmer 2002 or Bouchaud et al. 2002) suggest a power law,
Let us now describe how the limit order book is updated by
the inflow of new orders. For a state x ∈ n and 1  p  n, k
i = 
define i
as a plausible specification.
xp±1 ≡ x ± 0     1     0
Given the above assumptions, X is a continuous-time
Markov chain with state space n and transition rates
where the 1 in the vector on the right-hand side is in the
given by:
pth component. Assuming that all orders are of unit size (in
empirical examples we will take this unit to be the average
x → xp−1 with rate pA t − p for p < pA t
size of limit orders observed for the asset),
• a limit buy order at price level p < pA t increases the x→x p+1
with rate p − pB t for p > pB t
quantity at level p x → xp−1
x → xpB t+1 with rate

• a limit sell order at price level p > pB t increases the
quantity at level p x → xp+1 x→x pA t−1
with rate

• a market buy order decreases the quantity at the ask
x → xp+1 with rate pA t − pxp  for p < pA t
price: x → xpA t−1
• a market sell order decreases the quantity at the bid x→x p−1
with rate p − pB txp  for p > pB t
price: x → xpB t+1
• a cancellation of an oustanding limit buy order at price In practice, the ask price is always greater than the bid
level p < pA t decreases the quantity at level p x → xp+1 price. We say a state is admissible if it fulfills this
• a cancellation of an oustanding limit sell order at price requirement:
level p > pB t decreases the quantity at level p x → xp−1
The evolution of the order book is thus driven by the  ≡ x ∈ n  ∃k l ∈  s.t. 1  k  l  n xp  0 for p  l
incoming flow of market orders, limit orders, and cancella-
xp = 0 for k  p  l xp  0 for p  k (3)
tions at each price level, each of which can be represented
as a counting process. It is empirically observed (Bouchaud
If the initial state of the book is admissible, it remains
et al. 2002) that incoming orders arrive more frequently
admissible with probability one:
in the vicinity of the current bid/ask price and the rate
of arrival of these orders depends on the distance to the Proposition 1. If X0 ∈ , then  Xt ∈ 
bid/ask. ∀t  0 = 1.
To capture these empirical features in a model that is
Proof. It is easily verified that  is stable under each
analytically tractable and allows computation of quantities
of the six transitions defined above, which leads to our
of interest in applications, most notably conditional prob-
assertion. 
abilities of various events, we propose a stochastic model
where the events outlined above are modelled using inde- Proposition 2. If ≡ min1in i > 0, then X is an
pendent Poisson processes. More precisely, we assume that, ergodic Markov process. In particular, X has a proper sta-
for i  1, tionary distribution.
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
552 Operations Research 58(3), pp. 549–563, © 2010 INFORMS


Proof. Let N ≡ N t t  0, where N t ≡ np=1 Xp t, 2. Parameter Estimation
and let N be a birth-death process with birth rate given
by ≡ 2 np=1 p and death rate in state i,
i ≡ 2
+ i . 2.1. Description of the Data Set
Notice that N increases by one at a rate bounded from Our data consist of time-stamped sequences of trades (mar-
above by and decreases by one at a rate bounded from ket orders) and quotes (prices and quantities of outstanding
below by
i ≡ 2
+ i when in state i. Thus, for all limit orders) for the five best price levels on each side of the
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

t  0, N is stochastically bounded by N . For k  1, let T0k order book, for stocks traded on the Tokyo stock exchange
k
and T−0 denote the duration of the kth visit to 0 and the over a period of 125 days (Aug.–Dec. 2006). This data set,
duration between the k − 1th and kth visit to 0 of pro- referred to as Level II order book data, provides a more
cess N , respectively. Define random variables T 0k and T −0 k
, detailed view of price dynamics than the trade and quotes

k  1, for process N similarly. Then the point process with (TAQ) data often used for high-frequency data analysis,
1
interarrival times T−0  T01  T−0
2
 T02     and the point process which consist of prices and sizes of trades (market orders)
with interarrival times T−0  T01  T −0
1 2
 T 02     are alternating and time-stamped updates in the price and size of the bid
renewal processes. By Theorem VI.1.2 of Asmussen (2003) and ask quotes.
and the fact that N is stochastically dominated by N , we In Table 1, we display a sample of three consecutive
then have for each k  1, trades for Sky Perfect Communications. Each row provides
the time, size, and price of a market order. We also display
Ɛ T0k 
= lim  N t = 0 a sample of Level II bid-side quotes. Each row displays the
Ɛ T0  + Ɛ T−0
k k
 t→
five bid prices (pb1, pb2, pb3, pb4, pb5), as well as the
Ɛ T 0k  quantity of shares bid at these respective prices (qb1, qb2,
 lim  N t = 0 =  (4) qb3, qb4, qb5).
t→ Ɛ T 0k  + Ɛ T −0
k

2.2. Estimation Procedure
Notice that in state 0 both N and N have birth rate . Thus,
Recall that in our stylized model we assume orders to be
1
Ɛ T0k  = Ɛ T 0k  =  (5) of “unit” size. In the data set, we first compute the average
sizes of market orders Sm , limit orders Sl , and canceled
orders Sc and choose the size unit to be the average size
Combining (4) and (5) gives us
of a limit order Sl . The limit order arrival rate function for
Ɛ T−0
k
  Ɛ T −0
k
 (6) 1  i  5 can be estimated by

To show N is ergodic, notice the inequalities ˆ = Nl i 


i
T∗
 


i 

1 i
< = e / − 1 <  (7) where Nl i is the total number of limit orders that arrived
i=1
1 · · ·
i i=1 i! at a distance i from the opposite best quote, and T∗ is
the total trading time in the sample (in minutes). Nl i is
and
obtained by enumerating the number of times that a quote
 i increases in size at a distance of 1  i  5 ticks from the



1 ···
i 
M

1 ···
i 

2
+M
> + =  (8) opposite best quote. We then extrapolate by fitting a power
i=1 i i=1 i i=M+1
law function of the form
for M > 0 chosen large enough so that 2
+M > . There-
ˆ = k
fore, by Corollary 2.5 of Asmussen (2003), N is ergodic i
i
so that Ɛ T −0
k
 < . Combining this with the bound (6) and
the fact that for each t  0 Xt = 0     0 if and only if (suggested by Zovko and Farmer 2002 or Bouchaud et al.
N t = 0 shows that X is positive recurrent. Because X is 2002). The power law parameters k and are obtained by
clearly also irreducible, it follows that X is ergodic.  a least-squares fit
The ergodicity of X is a desirable feature of theoretical  2

5
interest: it allows comparison of time averages of various min ˆ − k
i 
k
i=1 i
quantities in simulations (average shape of the order book,
average price impact, etc.) to unconditional expectations of Estimated arrival rates at distances 0  i  10 from the
these quantities computed in the model. The steady-state opposite best quote are displayed in Figure 1(a).
behavior of X will be further discussed in §4.1. We note, The arrival rate of market orders is then estimated by
however, that our results involving conditional probabilities
in §3 and applications discussed in §4.3 do not rely on this N m Sm
ergodicity result.
ˆ = 
T ∗ Sl
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
Operations Research 58(3), pp. 549–563, © 2010 INFORMS 553

Table 1. A sample of three trades and five quotes for Sky Perfect Communications.
Time Price Size
9:11:01 74300 1
9:11:04 74600 2
9:11:19 74400 1
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

Time pb1 pb2 pb3 pb4 pb5 qb1 qb2 qb3 qb4 qb5
9:11:01 74300 74200 74000 73900 73800 12 13 1 52 11
9:11:03 74400 74300 74200 74000 73900 20 12 13 1 52
9:11:04 74400 74300 74200 74000 73900 21 11 13 1 52
9:11:05 74400 74300 74200 74000 73900 34 4 13 1 52
9:11:19 74400 74300 74200 74000 73900 33 4 13 1 52

where T∗ is the total trading time in the sample (in minutes) in order to estimate the cancellation rates we first need to
and Nm is the number of market orders. Note that we ignore estimate the steady-state shape of the order book Qi , which
market orders that do not affect the best quotes, as is the is the average number of orders at a distance of i ticks from
case when a market order is matched by a hidden order. the opposite best quote, for 1  i  5. If M is the number
Because the cancellation rate in our model is propor- of quote rows and SiB j the number of shares bid at a dis-
tional to the number of orders at a particular price level, tance of i ticks from the ask on the jth row, for 1  j  M,
we have
1 1  M
Figure 1. The arrival rates as a function of the distance QiB = S B j
Sl M j=1 i
from the opposite quote.
The vector QiA is obtained analogously, and Qi is the aver-
(a) Limit orders rates
2.0
age of QiA and QiB .
Data
An estimator for the cancellation rate function is then
1.8
Model
given by
1.6
ˆ = Nc i Sc for i  5 and
i
1.4 T Q i Sl (9)
1.2 ˆ = 5
i ˆ for i > 5
1.0
where Nc i is obtained by counting the number of times
0.8 that a quote decreases in size at a distance of 1  i  5
0.6 ticks from the opposite best quote, excluding decreases
0.4
due to market orders. The fitted values are displayed in
Figure 1(b).
0.2
Estimated parameter values for Sky Perfect Communica-
0
1 2 3 4 5 6 7 8 9 10
tions are given in Table 2.
Distance from opposite quote
3. Laplace Transform Methods for
(b) Cancellation rates Computing Conditional Probabilities
0.9
As noted above, an important motivation for modelling
0.8
high-frequency dynamics of order books is to use the infor-
0.7 mation provided by the limit order book for predicting
0.6
Table 2. Estimated parameters: Sky Per-
0.5 fect Communications.
0.4 i
0.3 1 2 3 4 5
0.2 ˆ
i 185 151 109 088 077
0.1
ˆ
i 071 081 068 056 047

ˆ 094
0
1 2 3 4 5 6 7 8 9 10 k 192
Distance from opposite quote 052
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
554 Operations Research 58(3), pp. 549–563, © 2010 INFORMS

short-term behavior of various quantities that are useful in denominators, which are complex numbers with an = 0 for
trade execution and algorithmic trading, for instance, the all n  1, is the sequence wn  n  1, where
probability of the midprice moving up versus down, the
ak
probability of executing a limit order at the bid before wn = t1 t2 ···tn 0 n  1 tk u =  k  1
the ask quote moves, and the probability of executing both bk +u
a buy and a sell order at the best quotes before the price and  denotes the composition operator. If w ≡ limn→ wn ,
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

moves. These quantities can be expressed in terms of con- then the continued fraction is said to be convergent and the
ditional probabilities of events, given the state of the order limit w is said to be the value of the continued fraction
book. In this section we show that the model proposed (Abate and Whitt 1999). In this case, we write
in §1 allows such conditional probabilities to be analyt-
ically computed using Laplace methods. After presenting  an
w ≡ n=1 
some background on Laplace transforms in §3.1, we give bn
various examples of these computations. The probability of
Consider now a birth-death process with constant birth rate
an increase in the midprice is discussed in §3.2, the prob-
and death rates
i in state i  1, and let b denote the
ability that a limit order executes before the price moves
first-passage time of this process to 0 given that it begins
is discussed in §3.3, and the probability of executing both
in state b. Next, notice that we can write B as the sum
a buy and a sell limit order before the price moves is
discussed in §3.4. Laplace transform methods allow effi- b = b b−1 + b−1 b−2 + · · · + 1 0 
cient computation of these quantities, bypassing the need
for Monte Carlo simulation. where i i−1 denotes the first-passage time of the birth-
death process from the state i to the state i − 1, for
3.1. Laplace Transforms and First-Passage i = 1     b, and all terms on the right-hand side are
Times of Birth-Death Processes independent. If fˆb denotes the Laplace transform of b
We first recall some basic facts about two-sided Laplace and fˆi i−1 denotes the Laplace transform of i i−1 for i =
transforms and discuss the computation of Laplace trans- 1     b, then we have by (10),
forms for first-passage times of birth-death processes
(Abate and Whitt 1999). Given a function f   → , its
b
fˆb s = fˆi i−1 s (12)
two-sided Laplace transform is given by i=1

fˆs = e−st f t dt Therefore, in order to compute fˆb , it suffices to compute
− the simpler Laplace transforms fˆi i−1 , for i = 1     b. By
where s is a complex numbers. When f is the probabil- Equation (4.9) of Abate and Whitt (1999), we see that the
ity density function (pdf) of some random variable X, we Laplace transform of fˆi i−1 is given by
also say that fˆ is the two-sided Laplace transform of the 1  −
k
random variable X. We work with two-sided Laplace trans- fˆi i−1 s = − k=i  (13)
+
k + s
forms here because for our purposes the function f will
usually correspond to the pdf of a random variable with The computation there is based on a recursive relation-
both positive and negative support. From now on, we drop ship between the fˆi i−1 , i = 1     b, which is derived by
the prefix “two-sided” when referring to two-sided Laplace considering the first transition of the birth-death process.
transforms. When we say conditional Laplace transform of Combining (12) and (13), we obtain
the random variable X conditional on the event A, we mean
  b 
the Laplace transform of the conditional pdf of X given A.
ˆ 1 b  −
k
Recall that if X and Y are independent random variables fb s = − k=i  (14)
i=1 +
k + s
with well-defined Laplace transforms, then
We will use this result in all our computations below.
fˆX+Y s = Ɛ e−sX+Y   = Ɛ e−sX Ɛ e−sY  = fˆX sfˆY s (10)

 3.2. Direction of Price Moves
If for some  ∈  we have − fˆ + i d <  and
We now compute the probability that the midprice increases
f t is continuous at t, then the inverse transform is given
at its next move. The first move in the midprice occurs at
by the Bromwich contour integral
the first-passage time of the bid or ask queue to zero or, if
1 +i ts ˆ the bid/ask spread is greater than one, the first time a limit
f t = e f s ds (11) order arrives inside the spread. Throughout this section,
2i −i
let XA ≡ XpA · · and XB ≡ XpB · ·. Furthermore, let
The continued fraction associated with a sequence WB ≡ WB t t  0 (WA ≡ WA t t  0), where WB t
an  n  1 of partial numerators and bn  n  1 of partial (WA t) denotes the number of orders remaining at the bid
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
Operations Research 58(3), pp. 549–563, © 2010 INFORMS 555

(ask) at time t of the initial XB 0 (XA 0) orders and let for j  1, and let S ≡ S−1 i=1 i. Then (15) is given by
B (A ) be the first-passage time of WB (WA ) to 0. Further- the inverse Laplace transform of
more, let T be the time of the first change in midprice:  
1 ˆS S ˆ
Fa b s =
S
f  + s + 1 − fa S + s
S
T ≡ inft  0 pM t = pM 0 s a S S + s
 
S
Given an initial configuration of the book, the probability · fˆbS S − s + 1 − fˆbS S − s  (19)
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

that the next change in midprice is an increase can then be S − s


written as
evaluated at 0. When S = 1, (19) reduces to
 pM T  > pM 0  XA 0 = aXB 0 = bpS 0 = S (15) 1
Fa1 b s = fˆa1 sfˆb1 −s (20)
where S > 0. For ease of notation, we will omit the condi- s
tion in (15) in all proofs below. Proof. We will first focus on the special case when S = 1
The idea for computing (15) is to use a coupling and then extend the analysis to the case S > 1, using
argument. Lemma 5 below. Construct the independent birth-death pro-
Lemma 3. Let pS 0 = S. Then cesses X A and X B as in Lemma 3. When S = 1, the price
1. There exist independent birth-death processes changes for the first time exactly when one of the two pro-
X A and X B with constant birth rates S and death cesses X A and X B reaches the state 0 for the first time.
rates
+ i S, i  1, such that for all 0  t  T , Thus, given our initial conditions, the distribution of T
X A t = XA t, and X B t = XB t. is given by the minimum of the independent first-passage
2. There exist independent pure death processes times A and B . Furthermore, the quantity (15) is given
WA and W B with death rate
+ i S in state i  1, such by  A < B . By (14), the conditional Laplace trans-
that for all 0  t  T , W B t = WB t.
A t = WA t and W form of A − B given the initial conditions is given by
Furthermore, W A is independent of X B , WB is independent fˆa1 sfˆb1 −s so that the conditional Laplace transform of
A  X A , and W
of X A , W B  X B . the cumulative distribution function (cdf) of A − B is
given by (20). Thus, our desired probability is given by the
Proof. We prove Part 1. Part 2 can be proven analogously. inverse Laplace transform of (20) evaluated at 0.
X is a continuous-time Markov chain, with transition rates We now move on to the case where S > 1. Let Ai denote
given by (1.2). For 0  t  T , pA t = pA 0 and pB t = the first time an ask order arrives i ticks away from the
pB 0, so substituting in (1.2) yields that XA t and XB t bid and Bi denote the first time a bid order arrives i ticks
have the following (identical) transition rates for 0  t  T away from the ask, for i = 1     S − 1. The time of the
first change in midprice is now given by
n→n+1 with rate S (16)
n→n−1 with rate
+ n S (17) T = A ∧ B ∧ minAi  Bi  i = 1     S − 1

Define X A and X B such that Notice that X A and X B are independent of the mutually
• X A t = XA t and X B t = XB t for t  T and independent arrival times Ai , Bi , for i = 1     S − 1. Also,
• X A t X B t t  T follow independent birth-death notice that Ai and Bi are exponentially distributed with
processes with rates given by (16) and (17). rates i for i = 1     S − 1. The first change in midprice
The above remarks show that in fact X A tt0 (respec- is an increase if there is an arrival of a limit bid order
tively X B tt0 ) has the same law as a birth-death within S − 1 ticks of the best ask or X A hits zero, before
process with rates (16)–(17). To show that X A and there is an arrival of a limit ask order within S − 1 ticks of
X B are independent, we note that because the tran- the best bid or X B hits zero. Thus, the quantity (15) can be
sition rates of XA (respectively XB ) do not depend written as
on Xp t p = pA 0 (respectively Xp t p = pB 0)  A ∧ B1 ∧ · · · ∧ BS−1 < B ∧ A1 ∧ · · · ∧ AS−1 
for 0  t  T , we have, in particular, conditional
independence of XA t and XB t given X0 and =  A ∧ B < B ∧ A  (21)
t  T . 
where A and B are independent exponential random vari-
Henceforth, we let A and B denote the first-passage ables, both with rate S . To compute (21), we first need
times of X A and X B to 0, respectively. The conditional to compute the conditional Laplace transform of the mini-
probability (15) can then be computed as follows: mum B ∧ A . This is given in Lemma 5, substituting A
Proposition 4 (Probability of Increase in Midprice). for Z. The conditional Laplace transform of the random
Let fˆjS be given by variable B ∧ A − A ∧ B can then be computed using
(10), and the probability (15) can be computed by inverting
 j  b 
1  − S
+k S the conditional Laplace transform of the cdf of this random
fˆjS s = − k=i  (18) variable and evaluating at 0 as in the case S = 1. 
S i=1 S+
+k S+s
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
556 Operations Research 58(3), pp. 549–563, © 2010 INFORMS

Lemma 5. Let Z be an exponentially distributed random S = 1 the probability we are interested in is equal to the
variable with parameter . Then the Laplace transform of probability that the order is executed before the midprice
the random variable B ∧ Z is given by moves away from the desired price, given that the order is
not canceled. Although we focus here on an order placed

fˆb1  + s + 1 − fˆb1  + s at the bid price, because our model is symmetric in bids
+s and asks, our result also holds for orders placed at the ask
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

price.
where fˆb1 is given in (18). We introduce some new notation that we will use in this
Proof. We first compute the density fB ∧Z of the random subsection as well as the next. Let NCb (NCa ) denote the
variable B ∧ Z in terms of the density fb of the random event that an order that never gets canceled is placed at
variable B . Because Z is exponential with rate , we have the bid (ask) at time 0. Then, the probability that an order
for all t  0, placed at the bid is executed before the midprice moves is
given by
 B ∧ Z < t = 1 −  B > t Z > t
 B < T  XB 0 = b XA 0 = a pS 0 = S NCb  (23)
= 1 − 1 − FB te−t 
Proposition 6 (Probability of Order Execution
Taking derivatives with respect to t gives Before Midprice Moves). Define fˆaS s as in (18), let ĝjS
be given by
fB ∧Z t = fb1 te−t + 1 − Fb1 te−t  (22)

j

+ Si − 1
ĝjS s =  (24)
for t  0, where Fb1 t (fb1 t)
is the cdf (pdf) of B . Also, i=1
+ Si − 1 + s
fB ∧Z t = 0 for t < 0. The Laplace transform of B ∧ Z is 
thus given by for j  1, and let S ≡ S−1 i=1 i. Then the quantity (23)
 is given by the inverse Laplace transform of
fˆB ∧Z s = e−st fB ∧B t dt 
1

−
FaS b s = ĝbS s fˆbS 2S − s
 s
= e−st fb1 te−t +1−Fb1 te−t  ds 
0 2S ˆ
  + 1 − fb 2S − s 
S
(25)
= e−ts+ fb1 t dt + 1−Fb1 te−ts+ dt 2S − s
0 0
evaluated at 0. When S = 1, (25) reduces to

= fˆb1 s ++ 1− fˆb1 s + 1
+s Fa1 b s = ĝb1 sfˆa1 −s (26)
s
where the last equality follows from integration by
parts.  Proof. Construct X A and W B using Lemma 3. Let us first
consider the case S = 1. Let T  ≡ B ∧ T denote the first
Proposition 4 yields a numerical procedure for comput- B hits 0 or the midprice
time when either the process W
ing the probability that the next change in the midprice will
changes. Conditional on an infinitely patient order being
be an increase. We discuss implementation of the procedure
placed at the bid price at time 0, T  is the first time when
in §4.2.2.
either that order gets executed or the midprice changes.
Notice that conditional on our initial conditions, B is given
3.3. Executing an Order Before by a sum of b independent exponentially distributed ran-
the Mid-Price Moves dom variables with parameters
+ i − 1 1, for i =
A trader that submits a limit order at a given time obtains 1     b, and independent of X A . Thus, the conditional
a better price than a trader that submits a market order at Laplace transform of B given our initial conditions is given
that same time, but faces the risk of nonexecution and the by (24). Because in the case S = 1 the midprice can change
“winner’s curse.” Whereas a market order executes with before time B if and only if A < B , the quantity (23)
certainty, a limit order stays in the order book until either can be written simply as  B < A . Using (10) with the
a matching order is entered or the order is canceled. The conditional Laplace transforms of B and A , given in (24)
probability that a limit order is executed before the price and (18), respectively, we obtain (26).
moves is therefore useful in quantifying the choice between This analysis can be extended to the case where S > 1
placing a limit order and placing a market order. We now just as in the proof of Proposition 4. When S > 1, our
compute the probability that an order placed at the bid price desired quantity can be written as  B < A ∧ B ∧ A .
is executed before any movement in the midprice, given Because the conditional distribution of B ∧ A is expo-
that the order is not canceled. Our result holds for initial nential with parameter 2S , Lemma 5 then yields the
spread S ≡ pS 0  1, but we remark that in the case where result. 
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
Operations Research 58(3), pp. 549–563, © 2010 INFORMS 557

3.4. Making the Spread placed at the best bid and ask prices at time 0, T  is the first
We now compute the probability that two orders, one time when either both the orders get executed or the mid-
price changes. Furthermore, by Lemma 3, W A and W B are
placed at the bid price and one placed at the ask price, are
both executed before the midprice moves, given that the independent pure death processes with death rate
+ i 1
A t  X A t and W
in state i  1, and W B t  X B t. This
orders are not canceled. If the probability of executing both
a buy and a sell limit order before the price moves is high, implies that A and B are independent of each other and
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

a statistical arbitrage strategy can be designed by submit- A and B are independent of each other with A  A and
ting limit orders at the bid and the ask and wait for both B  B . Using these properties, we obtain
orders to execute. If both orders execute before the price
moves, the strategy has paid off the bid-ask spread: we  maxB  A  < minB  A 
refer to this situation as “making the spread.” Otherwise, =  B < A  A < B 
losses may be minimized by submitting a market order and
losing the bid-ask spread. We restrict attention to the case =  B < A  A < B  B < A 
where the initial spread is one tick: S = 1. The probability +  B < A  A < B  A < B 
of making the spread can be expressed as
=  A < B  B < A  +  B < A  A < B 
 maxA  B  < T  XB 0 = b XA 0 = a = ha b + hb a  (33)
pS 0 = 1 NCa  NCb  (27)
where we define ha b ≡  B < A < B , the probability
The following result allows one to compute this probability that the order placed at the bid is executed before the order
using Laplace transform methods: placed at the ask, and the order at the ask is executed before
the bid quote disappears. We now focus on computing ha b .
Proposition 7. The probability (27) of making the spread Conditioning on the value of B gives
is given by ha b + hb a , where


 
a  ha b =  B < A < B  B = tgb1 t dt (34)
ha b =  j < i  P0X i tPaWj tgb1 t dt (28) 0

i=0 j=1 0
Focusing on the first factor in the integrand in (34) and
where conditioning on the values of X B t and W
A t gives us

e−
X t
X ti  B < A < B  B = t
P0X i t ≡  X t ≡ 1 − e− t  (29)
i! 
 
a
 k  =  B < A < B  B = t X B t = i W
A t = j
W  t
PaWj t ≡ eQa t a j ≡ QaW k  (30) i=0 j=0

k=0 k!

a j

A t = j  B = t
·  X B t = i W (35)
0 0 0 ··· 0
⎢ ⎥ The first conditional probability on the right hand of (35)


0 ··· 0 ⎥
⎢ ⎥ can now be simplified as follows. For i = 0 or j = 0 it is
⎢ ⎥
⎢ ⎥ simply 0. For i j  1, under the condition of the probabil-
QaW ≡ ⎢ 0
+ −
− ··· 0 ⎥
⎢ ⎥ ity, at time t there are j orders in the ask queue that have
⎢      ⎥
⎢     ⎥ been placed before time 0 that have yet to be executed,
⎣ ⎦
and there are a total of i orders in the bid queue. Thus, the
0 0 ···
+ a − 1 −
− a − 1 probability of interest is simply the probability that the j
(31) ask orders get executed before the number of orders in the
bid queue hits 0. Thus,
and gb1 is the inverse Laplace transform of ĝb1 , which is
given in (24).  B < A < B  B = t X B t = i W
A t = j

Proof. Because S = 1, T = minA  B , and the quantity =  j < i  (36)


(27) can be written as
Furthermore, the second probability on the right-hand side
 maxB  A  < minB  A  (32) of (35) can be written as

Construct X A , X B , W
A , and WB using Lemma 3. Let T  =  X B t = i W
A t = j  B = t
maxA  B  ∧ T denote the first time when either both
A and W B have hit 0, or the midprice =  X B t = i  B = t W
A t = j  B = t
of the processes W
has changed. Conditional on infinitely patient orders being =  X B t = i  B = t W
A t = j (37)
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
558 Operations Research 58(3), pp. 549–563, © 2010 INFORMS

Combining Equations (33)–(35) and using Tonelli’s theo- 4.1. Long-Term Behavior
rem to interchange the integral and the summation gives us Recent empirical studies on order books (Bouchaud et al.

 a  2002, 2008) have focused mainly on average properties
ha b =  j < i   X B t = i  B = t of the order book, which in our context correspond to
i=0 j=1 0
unconditional expectations of quantities under the station-
A t = jgb1 t dt
·  W ary measure of X: the steady-state shape of the book and
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

the volatility of the midprice. The ergodicity of the Markov


The quantity  X B t = i  B = t can be computed
chain X, shown in Proposition 2, implies that such expec-
using an analogy with the M/M/ queue. The number
tations E f X  can be computed in the model by simu-
of orders in the bid queue at the time when the bid order
placed at time 0 has executed is simply the number of cus- lating the order book over a large horizon T and averaging
tomers at time t in an initially empty M/M/ queue with f Xt over the simulated path:

1 T
arrival rate and service rate , which has a Poisson dis-
tribution with mean given by X t in (29). This leads to f Xt dt → E f X  a.s. as T → 
the expression for P0X i t in (29). T 0
The quantity  W A t = j is the probability that a pure 4.1.1. Steady-State Shape of the Book. We simulate
death process with death rate
+ k − 1 1 in state k  1 the order book over a long horizon (n = 106 events) and
is in state j at time t, given that it begins in state a. The observe the mean number of orders Qi at distances 1 
infinitesimal generator of this pure death process is given i  30 ticks from the opposite best quote. The results are
by (31). Thus, by Corollary II.3.5 of Asmussen (2003), displayed in Figure 2. The steady-state profile of the order
 WA t = j is given by (30). 
book describes the average market impact of trades (Farmer
Remark 1. We note here that the probabilities computed et al. 2004, Bouchaud et al. 2008). Figure 2 shows that
in this section can also be computed using transition matri- the average profile of the order book displays a hump (in
ces of appropriately defined transient discrete-time Markov this case, at two ticks from the bid/ask), as observed in
chains. In general, for a continuous-time Markov chain the empirical studies (Bouchaud et al. 2008). Note that this
probability of hitting state i before state j can be deter- hump feature does not result from any fine-tuning of model
mined by constructing a corresponding embedded discrete- parameters or additional ingredients such as correlation
time Markov chain with states i and j absorbing states between order flow and past price moves.
and computing the fundamental matrices of this Markov
chain (see, for example, §4.4 of Ross 1996). However, our 4.1.2. Volatility. Define the realized volatility of the
Laplace transform approach has the advantage of comput- asset over a day by
ing full distributions of random variables such as A , B ,    2
A , and B . This could be used, for example, to compute 
n
Pi+1
RVn = log  (38)
probabilities such as  A +  < B , for  > 0, which are i=1 Pi
useful when latency in order processing is an issue.
Figure 2. Simulation of the steady-state profile of the
4. Numerical Results
order book: Sky Perfect Communications.
Our stochastic model allows one to compute various quan-
tities of interest both by simulating the evolution of the 2.0

order book and by using the Laplace transform methods


presented in §3, based on parameters
, , and esti- 1.8
mated from the order flow. In this section we compute these
Average number of orders

quantities—for example, of Sky Perfect Communications— 1.6


and compare them to empirically observed values in order
to assess the precision of the description provided by our 1.4
model.
In §4.1, we compare empirically observed long-term
1.2
behavior (e.g., unconditional properties) of the order book
to simulations of the fitted model. Although these quantities
may not be particularly important for traders who are inter- 1.0
ested in trading in a short time scale, they indicate how well
the model reproduces the average properties of the order 0.8
book. In §4.2, we compare conditional probabilities of var-
ious events in our model to frequencies of the events in the
data. We also compare results using the Laplace transform 0 5 10 15 20 25 30

methods developed in §3 to our simulation results. Distance from opposite best quote in ticks
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
Operations Research 58(3), pp. 549–563, © 2010 INFORMS 559

where n is the number of quotes in the day and the prices Pi where
represent the midprice of the stock, for i = 1     n. In
the first day of the sample, we compute a realized volatil- Bup = m  Q iB Tm  = n Q iB Tm+1  > n
ity of 00219 after a total of 370 trades. After repeat-
Âup = m  Q iA Tm  = n Q iA Tm+1  > n
edly simulating our model for 370 trades, we obtained a
95% confidence interval for realized volatility of 00228 ± Bchange = m  Q iB Tm  = n Q iB Tm+1  = n and
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

00003. Interestingly, this estimator yields the correct order


of magnitude for realized volatility based solely on inten- Âchange = m  Q iA Tm  = n Q iA Tm+1  = n
sity parameters for the order flow  
 .
In Figure 3, Pi n and Pi n for 1  i  5 are shown for Sky
4.2. Conditional Distributions Perfect Communications. We see that these probabilities are
reasonably close in most cases, indicating that the transition
As discussed in the introduction, conditional distributions probabilities of the order book are well described by the
are the main quantities of interest for applications in high- model.
frequency trading. A good description of conditional dis-
tributions of variables characterizing the order book gives 4.2.2. Direction of Price Moves. This subsection and
one the ability to predict their behavior in the short term, the next two are devoted to the computation of condi-
which is of obvious interest in optimal trade execution and tional probabilities using the Laplace transform methods
the design of trading strategies. described in §3. These computations require the numerical
inversion of Laplace transforms. The inversions are per-
4.2.1. One-Step Transition Probabilities. In order to formed by shifting the random variable X under study by
assess the model’s usefulness for short-term prediction of a constant c such that  X + c  0 ≈ 1, then inverting
order book behavior, we compare one-step transition prob- the corresponding one-sided Laplace transform using the
abilities implied by our model to corresponding empirical methods proposed in Abate and Whitt (1992, 1995). When
frequencies. In particular, we consider the probability that computing the probability of an increase in midprice, one
the number of orders at a given price level increases given can find a good shift c by using the fact that when a = b
that it changes. the probability of an increase in midprice is 0.5. This shift
Define Tm as the time of the mth event in the order book: c should also serve well for cases where a = b.
Table 3 compares the empirical frequencies of an
T0 = 0 Tm+1 ≡ inft  Tm  Xt = XTm  (39) increase in midprice to model-implied probabilities, given
an initial configuration of b orders at the bid price, a
The probability that the number of orders at a distance i orders at the ask price, and a spread of 1, for various
from the opposite best quote moves from n to n + 1 at the values of a and b. We computed these quantities using
next change is given by Monte Carlo simulation (using 30,000 replications) and the
Laplace transform methods described in §3. The simula-
Pi n ≡  QiA Tm+1  = n + 1  QiA Tm  = n QiA Tm+1  = n tion results, reported as 95% confidence intervals, agree
⎧ with the Laplace transform computations and show that the


1
⎨ 1 +
+ n 1  i = 1
⎪ probability of an increase in the midprice is well captured
= (40) by the model.

⎪ i

⎩  i > 1 4.2.3. Executing an Order Before the Midprice
i + n i
Moves. Table 4 gives probabilities computed using both
To see how the above expression arises, consider the case simulation and our Laplace transform method for executing
i = 1. The next change in Q1A is an increase if an arrival a bid order before a change in midprice for various val-
of a limit order at price Q1A occurs before any of the limit ues of a and b and for S = 1. Because our data set does
orders at Q1A cancel or a market buy order occurs. However, not allow us to track specific orders, empirical values for
because an arrival of a limit order at price Q1A occurs with these quantities, as well as the quantities in §4.2.4, are not
rate 1 and a cancellation or market buy order occurs obtainable.
at rate
+ n 1, the probability that an arrival of a limit 4.2.4. Making the Spread. Table 5 gives probabilities
order occurs first is given by 1/ 1 +
+ n 1. computed using both simulation and our Laplace transform
Denoting empirical quantities with a hat, e.g., Q iB t is method for executing both a bid and an ask order at the best
the empirically observed number of bid orders at a distance quotes before the midprice changes. One interesting obser-
of i units from the ask price at time t, an estimator for the vation here is that for a fixed value of a, as b is increased,
above probability is given by the probability of making the spread is not monotone. Thus,
for a fixed number of orders at the ask price the probability
Bup + Âup of making the spread is maximized for a nontrivial optimal
Pi n ≡ 
Bchange + Âchange number of orders at the bid price.
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
560 Operations Research 58(3), pp. 549–563, © 2010 INFORMS

Figure 3. Probability of an increase in the number of orders at distance i from the opposite best quote in the next
change, for i = 1     5.
1 tick from opposite quote 2 ticks from opposite quote
1.0 1.0
Empirical
Probability of

Probability of
Model
increase

increase
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

0.5 0.5

0 0
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
Queue size Queue size

3 ticks from opposite quote 4 ticks from opposite quote


1.0 1.0
Probability of

Probability of
increase

increase
0.5 0.5

0 0
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
Queue size Queue size

5 ticks from opposite quote


1.0
Probability of
increase

0.5

0
0 1 2 3 4 5 6 7
Queue size

4.3. An Application to High-Frequency Trading and the spread will be S = 2. In this scenario, the
The conditional probabilities described in the above section probability of the midprice increasing is now 062, as
may be used as a building block to construct systematic stated above, and we have entered the position at the
trading strategies. Such strategies fall into the realm of sta- current midprice. Thus, we are in a good position to
tistical arbitrage because they do not guarantee a profit, but make a profit. In the case where XpA 0+1 0 = 0, the
lead to trades with positive expected returns and bounded order was bought at a price XA 0, which is strictly
losses. As a final exercise, we provide the reader with one lower than the new midprice XB 0+ + XA 0+/2 
such example based on our results in §3.2 on the proba- XA 0 − 1 + XA 0 + 2/2 = XA 0 + 21 . In order for the
bility that the midprice increases, conditional on the con- trade to be welldefined, we must define an exit strategy.
figuration of the book. In particular, using Equation (19), Exiting the position. We submit a market sell order at
we can compute the probability that the midprice increases the first time  such that either
given that the spread is S = 2, the number of orders at the 1. pB  > pA 0, in which case we are selling at a price
bid is XB 0 = b = 3, and the number of orders at the ask that is strictly greater than our buying price, or
XA 0 = a = 1. A simple application of our Laplace trans- 2. pB  = pB 0 and XB  = 1, which results in a loss
form results, with our estimated parameters for Sky Perfect of one tick.
Communications given in Table 2, yields a probability 062 The probability of success of this round-trip transaction
of the midprice increasing. We use this as the basis for the need not be recomputed in real time: if an “offline” com-
following strategy, which we test in simulation: putation (for example, using Laplace transform methods
Entering the position. If the spread is S = 1, the described in §3) indicates that the probability in (19) is
number of orders at the bid is XB 0  3, the num- large, this suggests that this strategy would perform well.
ber of orders at the ask is XA 0 = 1 and the num- Comparing this probability across different stocks may be
ber of orders at the second-best ask is XpA 0+1 0  1, a good indicator of the profitability of this strategy.
then submit a market buy order. Right after this trade, if After running our simulation for 15,788 trades, roughly
XpA 0+1 0 = 1, the new configuration of the order book the equivalent of 30 days of trading, our algorithm does a
will have XB 0+ = XB 0  3, XA 0+ = XpA 0+1 0 = 1, total of 2,376 round-trip trades, and we display the P&L
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
Operations Research 58(3), pp. 549–563, © 2010 INFORMS 561

Table 3. Probability of an increase in mid-price: empirical frequencies (top), sim-


ulation results (95% confidence intervals, middle), and Laplace transform
method results (bottom).
a
b 1 2 3 4 5
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

1 0512 0304 0263 0242 0226


2 0691 0502 0444 0376 0359
3 0757 0601 0533 0472 0409
4 0806 0672 0580 0529 0484
5 0822 0731 0640 0714 0606
a
b 1 2 3 4 5
1 0.499 ± 0.006 0.333 ± 0.005 0.258 ± 0.005 0.213 ± 0.005 0.187 ± 0.005
2 0.663 ± 0.005 0.495 ± 0.006 0.411 ± 0.006 0.346 ± 0.005 0.307 ± 0.005
3 0.743 ± 0.006 0.589 ± 0.006 0.506 ± 0.006 0.434 ± 0.006 0.389 ± 0.006
4 0.788 ± 0.005 0.652 ± 0.006 0.564 ± 0.006 0.503 ± 0.006 0.452 ± 0.006
5 0.811 ± 0.004 0.693 ± 0.005 0.615 ± 0.006 0.547 ± 0.006 0.504 ± 0.006
a
b 1 2 3 4 5
1 0500 0336 0259 0216 0188
2 0664 0500 0407 0348 0307
3 0741 0593 0500 0437 0391
4 0784 0652 0563 0500 0452
5 0812 0693 0609 0548 0500

distribution in Figure 4. Note that the computed proba- account transaction costs, but these can easily be included
bility of 0.62 is not directly linked to the probability of in the analysis.
the trade being successful, which may only be computed
through simulation. Indeed, the probability of success of 5. Conclusion
each round-trip transaction is less than 0.5, although the We have proposed a stylized stochastic model describ-
average profit of each trade was 0068 ticks, or 68 yen. ing the dynamics of a limit order book, where the
The analysis of the above trading strategy does not take into occurrences of market events—market orders, limit orders

Table 4. Probability of executing a bid order before a change in midprice: simulation


results (95% confidence intervals, top) and Laplace transform method results
(bottom).
a
b 1 2 3 4 5
1 0.498 ± 0.004 0.642 ± 0.004 0.709 ± 0.004 0.748 ± 0.004 0.779 ± 0.004
2 0.299 ± 0.004 0.451 ± 0.004 0.536 ± 0.004 0.592 ± 0.004 0.632 ± 0.004
3 0.204 ± 0.004 0.335 ± 0.004 0.422 ± 0.004 0.484 ± 0.004 0.532 ± 0.004
4 0.152 ± 0.003 0.264 ± 0.004 0.344 ± 0.004 0.403 ± 0.004 0.450 ± 0.004
5 0.117 ± 0.003 0.213 ± 0.004 0.291 ± 0.004 0.342 ± 0.004 0.394 ± 0.004
a
b 1 2 3 4 5
1 0497 0641 0709 0749 0776
2 0302 0449 0535 0591 0631
3 0206 0336 0422 0483 0528
4 0152 0263 0344 0404 0452
5 0118 0213 0287 0346 0393
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
562 Operations Research 58(3), pp. 549–563, © 2010 INFORMS

Table 5. Probability of making the spread: simulation results (95% confidence inter-
vals, top) and Laplace transform method results (bottom).
a
b 1 2 3 4 5
1 0.268 ± 0.004 0.306 ± 0.004 0.312 ± 0.004 0.301 ± 0.004 0.286 ± 0.004
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

2 0.306 ± 0.004 0.384 ± 0.004 0.406 ± 0.004 0.411 ± 0.004 0.401 ± 0.004
3 0.312 ± 0.004 0.406 ± 0.004 0.441 ± 0.004 0.455 ± 0.004 0.456 ± 0.004
4 0.301 ± 0.004 0.411 ± 0.004 0.455 ± 0.004 0.473 ± 0.004 0.485 ± 0.004
5 0.286 ± 0.004 0.401 ± 0.004 0.456 ± 0.004 0.485 ± 0.004 0.491 ± 0.004
a
b 1 2 3 4 5
1 0266 0308 0309 0300 0288
2 0308 0386 0406 0406 0400
3 0309 0406 0441 0452 0452
4 0300 0406 0452 0471 0479
5 0288 0400 0452 0479 0491

and cancellations—are governed by independent Poisson detailed behavioral assumptions about market participants
processes. or introducing unobservable parameters describing agent
The formulation of the model, which can be viewed as preferences, as in the market microstructure literature.
a queuing system, is entirely based on observable quan- This model can be extended in various ways to take
tities so that its parameters can be easily estimated from into account a richer set of empirically observed properties
observations of events in an actual order book. The model (Bouchaud et al. 2008). Correlation of the order flow with
is simple enough to allow semianalytical computation of recent price behavior can be modeled by introducing state-
various conditional probabilities of order book events via dependent intensities of order arrivals. The heterogeneity
Laplace transform methods, yet rich enough to adequately of order sizes, which appears to be an important ingredi-
capture the short-term behavior of the order book: condi- ent in actual order book dynamics, can be incorporated by
tional distributions of various quantities of interest show making order sizes independent and identically distributed
good agreement with the corresponding empirical distri- random variables. Both of these features would conserve
butions for parameters estimated from data sets from the the Markovian nature of the process. A more realistic distri-
Tokyo Stock Exchange. The ability of our model to com- bution of interevent times may also be introduced by mod-
pute conditional distributions is useful for short-term pre- elling the event arrivals via renewal processes. It remains
diction and design of automated trading strategies. Finally, to be seen whether the analytical tractability of the model
simulation results illustrate that our model also yields real- can be preserved when such generalities are introduced.
istic features for long-term (steady-state) average behavior We look forward to exploring some of these extensions in
of the order book profile and of price volatility. future work.
One by-product of this study is to show how far
a stochastic model can go in reproducing the dynamic Acknowledgments
properties of a limit order book without resorting to The authors thank Ning Cai, Alexander Cherny, Jim
Gatheral, Zongjian Liu, Peter Randolph, and Ward Whitt
Figure 4. Probability distribution of P&L per round- for useful discussions.
trip trade, in ticks.
0.6 References
Abate, J., W. Whitt. 1992. The Fourier-series method for inverting trans-
0.5
forms of probability distributions. Queueing Systems 10 5–88.
0.4
Abate, J., W. Whitt. 1995. Numerical inversion of Laplace transforms of
probability distributions. ORSA J. Comput. 7(1) 36–43.
0.3 Abate, J., W. Whitt. 1999. Computing Laplace transforms for numeri-
cal inversion via continued fractions. INFORMS J. Comput. 11(4)
0.2 394–405.
Alfonsi, A., A. Schied, A. Schulz. 2010. Optimal execution strategies in
0.1 limit order books with general shape functions. Quant. Finance 10(2)
143–157.
0 Asmussen, S. 2003. Applied Probability and Queues. Springer-
–1 0 1 2 3 4 5 6 Verlag, New York.
Cont, Stoikov, and Talreja: A Stochastic Model for Order Book Dynamics
Operations Research 58(3), pp. 549–563, © 2010 INFORMS 563

Bouchaud, J.-P., D. Farmer, F. Lillo. 2008. How markets slowly digest Luckock, H. 2003. A steady-state model of the continuous double auction.
changes in supply and demand. T. Hens, K. Schenk-Hoppe, eds. Quant. Finance 3 385–404.
Handbook of Financial Markets: Dynamics and Evolution. North- Maslov, S., M. Mills. 2001. Price fluctuations from the order book
Holland Publishers, Amsterdam, 57–160. perspective—Empirical facts and a simple model. PHYSICA A 299
234–246.
Bouchaud, J.-P., M. Mézard, M. Potters. 2002. Statistical properties of
Obizhaeva, A., J. Wang. 2006. Optimal trading strategy and sup-
stock order books: Empirical results and models. Quant. Finance 2 ply/demand dynamics. Working paper, Massachusetts Institute of
251–256.
Downloaded from informs.org by [128.119.168.112] on 06 November 2017, at 11:25 . For personal use only, all rights reserved.

Technology, Cambridge, MA.


Bovier, A., J. C̆erný, O. Hryniv. 2006. The opinion game: Stock price Parlour, Ch. A. 1998. Price dynamics in limit order markets. Rev. Finan-
evolution from microscopic market modelling. Internat. J. Theoret. cial Stud. 11(4) 789–816.
Appl. Finance 9 91–111. Ross, S. 1996. Stochastic Processes. John Wiley & Sons, New York.
Farmer, J. D., L. Gillemot, F. Lillo, S. Mike, A. Sen. 2004. What really Rosu, I. 2009. A dynamic model of the limit order book. Rev. Financial
Stud. 22 4601–4641.
causes large price changes? Quant. Finance 4 383–397.
Smith, E., J. D. Farmer, L. Gillemot, S. Krishnamurthy. 2003. Statisti-
Foucault, T., O. Kadan, E. Kandel. 2005. Limit order book as a market cal theory of the continuous double auction. Quant. Finance 3(6)
for liquidity. Rev. Financial Stud. 18(4) 1171–1217. 481–514.
Hollifield, B., R. A. Miller, P. Sandas. 2004. Empirical analysis of limit Zovko, I., J. D. Farmer. 2002. The power of patience; A behavioral regu-
order markets. Rev. Econom. Stud. 71(4) 1027–1063. larity in limit order placement. Quant. Finance 2 387–392.

You might also like