A Stochastic Model For Order Book Dynamics
A Stochastic Model For Order Book Dynamics
Operations Research
Publication details, including instructions for authors and subscription information:
http://pubsonline.informs.org
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.
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
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.
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.
Proof. Let N ≡ N t t 0, where N t ≡ np=1 Xp t, 2. Parameter Estimation
and let Nbe 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 T0k 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
T02 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
ƐT0k quantity of shares bid at these respective prices (qb1, qb2,
lim N t = 0 = (4) qb3, qb4, qb5).
t→ ƐT0k + Ɛ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 = ƐT0k = (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
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.
Define XA and XB such that Notice that XA and XB are independent of the mutually
• XA t = XA t and XB t = XB t for t T and independent arrival times Ai , Bi , for i = 1 S − 1. Also,
• XA t XB 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 XA tt0 (respec- is an increase if there is an arrival of a limit bid order
tively XB tt0 ) has the same law as a birth-death within S − 1 ticks of the best ask or XA hits zero, before
process with rates (16)–(17). To show that XA and there is an arrival of a limit ask order within S − 1 ticks of
XB are independent, we note that because the tran- the best bid or XB 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 XA and XB 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
+kS 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+
+kS+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 XA 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 − 11, for i =
A trader that submits a limit order at a given time obtains 1 b, and independent of XA . 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
+ i1
A t XA t and W
in state i 1, and W B t XB 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 XB 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 XB 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
· XB 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 XB t = i W
A t = j
Construct XA , XB , W
A , and WB using Lemma 3. Let T = XB 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 = XB t = i B = t W
A t = j B = t
of the processes W
has changed. Conditional on infinitely patient orders being = XB 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 XB 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.
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 → Ef 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 − 11 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
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.
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
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
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
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 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.