High Frequency Trading in A Limit Order Book
High Frequency Trading in A Limit Order Book
Introduction
a single stock. In their model, the authors specify a true price for the asset, and
derive optimal bid and ask quotes around this price, to account for the effect of the
inventory. This inventory effect was found to be significant in an empirical study of
AMEX Options by Ho and Macris [5]. In another paper by Ho and Stoll [7], the problem of dealers under competition is analyzed and the bid and ask prices are shown to
be related to the reservation (or indifference) prices of the agents. In our framework,
we will assume that our agent is but one player in the market and the true price is
given by the market mid-price.
Of crucial importance to us will be the arrival rate of buy and sell orders that
will reach our agent. In order to model these arrival rates, we will draw on recent
results in econophysics. One of the important achievements of this literature has
been to explain the statistical properties of the limit order book (see Bouchaud et al.
[2], Potters and Bouchaud [11], Smith et al. [12], Luckock [8]). The focus of these
studies has been to reproduce the observed patterns in the markets by introducing
zero intelligence agents, rather than modeling optimal strategies of rational agents.
One possible exception is the work of Luckock [8], who defines a notion of optimal
strategies, without resorting to utility functions. Though our objective is different to
that of the econophysics literature, we will draw on their results to infer reasonable
arrival rates of buy and sell orders. In particular, the results that will be most useful
to us are the size distribution of market orders (Gabaix et al. [3], Maslow and Mills
[9]) and the temporary price impact of market orders (Weber and Rosenow [14],
Bouchaud et al. [2]).
Our approach, therefore, is to combine the utility framework of the Ho and Stoll
approach with the microstructure of actual limit order books as described in the
econophysics literature. The main result is that the optimal bid and ask quotes are
derived in an intuitive two-step procedure. First, the dealer computes a personal
indifference valuation for the stock, given his current inventory. Second, he calibrates
his bid and ask quotes to the limit order book, by considering the probability with
which his quotes will be executed as a function of their distance from the mid-price.
In the balancing act between the dealers personal risk considerations and the market
environment lies the essence of our solution.
The paper is organized as follows. In section 2, we describe the main building
blocks for the model: the dynamics of the mid-market price, the agents utility objective and the arrival rate of orders as a function of the distance to the mid-price. In
section 3, we solve for the optimal bid and ask quotes, and relate them to the reservation price of the agent, given his current inventory. We then present an approximate
solution, numerically simulate the performance of our agents strategy and compare
its Profit and Loss (P&L) profile to that of some benchmark strategies.
2
2.1
The model
The mid-price of the stock
For simplicity, we assume that money market pays no interest. The mid-market price,
or mid-price, of the stock is modeled as a Brownian motion
St = s + Wt .
(2.1)
We choose this model over the standard geometric Brownian motion because it yields
simpler solutions and ensures that the utility functionals introduced in the sequel
remain bounded.
This mid-price will be used solely to value the agents assets at the end of the
investment period. He may not trade costlessly at this price, but this source of
randomness will allow us to measure the risk of his inventory in stock. In section 2.4
we will introduce the possibility to trade through limit orders.
2.2
The agents objective is to maximize the expected exponential utility of his P&L
profile at a terminal time T . This choice of convex risk measure is particularly
convenient, since it will allow us to define reservation (or indifference) prices which
are independent of the agents wealth.
We first model an inactive trader who does not have any limit orders in the market
and simply holds an inventory of q stocks until the terminal time T . This passive
strategy will later prove to be useful in the case when limit orders are allowed. The
agents value function is
v(x, s, q, t) = Et [ exp((x + qST )]
where x is the initial wealth in dollars. This value function can be written as
2 2 2
q (T t)
v(x, s, q, t) = exp(x) exp(qs) exp
2
(2.2)
(2.3)
(2.4)
A simple computation involving equations (2.2), (2.3) and (2.4) yields a closedform expression for the two prices
r a (s, q, t) = s + (1 2q)
2 (T t)
2
and
2 (T t)
2
in the setting where no trading is allowed. We will refer to the average of these two
prices as the reservation or indifference price
r b (s, q, t) = s + (1 2q)
r(s, q, t) = s q 2 (T t),
given that the agent is holding q stocks. This price is an adjustment to the midprice, which accounts for the inventory held by the agent. If the agent is long stock
(q > 0), the reservation price is below the mid-price, indicating a desire to liquidate
the inventory by selling stock. On the other hand, if the agent is short stock (q < 0),
the reservation price is above the mid-price, since the agent is willing to buy stock at
a higher price.
2.3
The stationary reservation prices (defined in the same way as in Definition 1) are
given by
1
(2q + 1) 2 2
a
r (s, q) = s + ln 1
2 2 q 2 2
and
(2q 1) 2 2
1
b
,
r (s, q) = s + ln 1
2 2 q 2 2
where > 12 2 2 q 2 .
The parameter may therefore be interpreted as an upper bound on the inventory
position our agent is allowed to take. The natural choice of = 12 2 2 (qmax + 1)2
would ensure that the prices defined above are bounded.
4
2.4
Limit orders
We now turn to an agent who can trade in the stock through limit orders that he sets
around the mid-price given by (2.1). The agent quotes the bid price pb and the ask
price pa , and is committed to respectively buy and sell one share of stock at these
prices, should he be hit or lifted by a market order. These limit orders pb and pa
can be continuously updated at no cost. The distances
b = s pb
and
a = pa s
and the current shape of the limit order book determine the priority of execution
when large market orders get executed.
For example, when a large market order to buy Q stocks arrives, the Q limit
orders with the lowest ask prices will automatically execute. This causes a temporary
market impact, since transactions occur at a price that is higher than the mid-price.
If pQ is the price of the highest limit order executed in this trade, we define
p = pQ s
to be the temporary market impact of the trade of size Q. If our agents limit order
is within range of this market order, i.e. if a < p, his limit order will be executed.
We assume that market buy orders will lift our agents sell limit orders at
Poisson rate a ( a ), a decreasing function of a . Likewise, orders to sell stock will
hit the agents buy limit order at Poisson rate b ( b ), a decreasing function of b .
Intuitively, the further away from the mid-price the agent positions his quotes, the
less often he will receive buy and sell orders.
The wealth and inventory are now stochastic and depend on the arrival of market
sell and buy orders. Indeed, the wealth in cash jumps every time there is a buy or
sell order
dXt = pa dNta pb dNtb
where Ntb is the amount of stocks bought by the agent and Nta is the amount of stocks
sold. Ntb and Nta are Poisson processes with intensities b and a . The number of
stocks held at time t is
qt = Ntb Nta .
The objective of the agent who can set limit orders is
u(s, x, q, t) = max Et [ exp((XT + qT ST )))].
a ,b
Notice that, unlike the setting described in the previous subsection, the agent controls
the bid and ask prices and therefore indirectly influences the flow of orders he receives.
Before turning to the solution of this problem, we consider some realistic functional
forms for the intensities a ( a ) and b ( b ) inspired by recent results in the econophysics
literature.
5
2.5
One of the main focuses of the econophysics community has been to describe the laws
governing the microstructure of financial markets. Here, we will be focussing on the
results which address the Poisson intensity with which a limit order will be executed
as a function of its distance to the mid-price. In order to quantify this, we need to
know statistics on (i) the overall frequency of market orders (ii) the distribution of
their size and (iii) the temporary impact of a large market order. Aggregating these
results suggests that should decay as an exponential or a power law function.
For simplicity, we assume a constant frequency of market buy or sell orders.
This could be estimated by dividing the total volume traded over a day by the average
size of market orders on that day.
The distribution of the size of market orders has been found by several studies to
obey a power law. In other word, the density of market order size is
f Q (x) x1
(2.5)
with = 1.53 in Gopikrishnan et al. [4] for U.S. stocks, = 1.4 in Maslow and Mills
[9] for shares on the NASDAQ and = 1.5 in Gabaix et al. [3] for the Paris Bourse.
There is less consensus on the statistics of the market impact in the econophysics
literature. This is due to a general disagreement over how to define it and how to
measure it. Some authors find that the change in price p following a market order
of size Q is given by
p Q
(2.6)
where = 0.5 in Gabaix et al. [3] and = 0.76 in Weber and Rosenow [14]. Potters
and Bouchaud [11] find a better fit to the function
p ln(Q).
(2.7)
Aggregating this information, we may derive the Poisson intensity at which our
agents orders are executed. This intensity will depend only on the distance of his
quotes to the mid-price, i.e. b ( b ) for the arrival of sell orders and a ( a ) for the
arrival of buy orders. For instance, using (2.5) and (2.7), we derive
() = P (p > )
= P (ln(Q) > K)
= PR (Q > exp(K))
= exp(K) x1 dx
= A exp(k)
(2.8)
() = B() .
6
Alternatively, since we are interested in short term liquidity, the market impact
function could be derived directly by integrating the density of the limit order book.
This procedure is described in Smith et al. [12] and Weber and Rosenow [14] and
yields what is sometimes called the virtual price impact.
3
3.1
The solution
Optimal bid and ask quotes
(3.1)
This type of optimal dealer problem was first studied by Ho and Stoll [6]. One of the
key steps in their analysis is to use the dynamic programming principle to show that
the function u solves the following Hamilton-Jacobi-Bellman equation
ut + 12 2 uss + maxb b ( b ) u(s, x s + b , q + 1, t) u(s, x, q, t)
The solution to this nonlinear PDE is continuous in the variables s, x and t and
depends on the discrete values of the inventory q. Due to our choice of exponential
utility, we are able to simplify the problem with the ansatz
u(s, x, q, T ) = exp(x) exp((s, q, t)).
Direct substitution yields the following equation for
t + 21 2 hSS 21 2 S2
i
i
h a a
a r a )
b (b )
( )
(sb r b )
(s+
+ maxb
[1 e
] + maxa
[1 e
] =0
(s, q, T ) = qs.
(3.2)
(3.3)
Applying the definition of reservation bid and ask prices (given in Section 2.2) to the
ansatz (3.2), we find that r b and r a depend directly on this function . Indeed,
r b (s, q, t) = (s, q + 1, t) (s, q, t)
(3.4)
is the reservation bid price of the stock, when the inventory is q and
r a (s, q, t) = (s, q, t) (s, q 1, t)
7
(3.5)
is the reservation ask price,when the inventory is q. From the first order optimality
condition in (3.3), we obtain the optimal distances b and a . They are given by the
implicit relations
!
b b
1
(
)
s r b (s, q, t) = b ln 1 b
(3.6)
b)
and
a ( a )
1
r a (s, q, t) s = a ln 1 a a
( )
(3.7)
In summary, the optimal bid and ask quotes are obtained through an intuitive,
two step procedure. First, we solve the PDE (3.3) in order to obtain the reservation
bid and ask prices r b (s, q, t) and r a (s, q, t). Second, we solve the implicit equations
(3.6) and (3.7) and obtain the optimal distances b (s, q, t) and a (s, q, t) between the
mid-price and optimal bid and ask quotes. This second step can be interpreted as a
calibration of our indifference prices to the current market supply b and demand a .
3.2
We now test the effectiveness of our strategy by running simulations focussing primarily on the shape of the P&L profile and the final inventory qT . We will refer to
our strategy as the inventory strategy, and compare it to some benchmark strategies that are symmetric around the mid-price, regardless of the inventory. One such
strategy, the best bid/best ask strategy, consists in quoting bid and ask prices equal
to s M2 and s + M2 respectively, where M is the market spread (i.e. the difference
between the best bid and best ask prices in the limit order book). Another such
strategy, which we refer to as the symmetric strategy, uses the same spread as the
inventory strategy, but centers it around the mid-price, rather than the reservation
price.
In order to simplify computations, we assume exponential arrival rates
() = Aek
(3.8)
which are consistent with the results of Potters and Bouchaud [11], as described in
Section 2.5. Once we have chosen our time step dt, we we obtain the value for A
through the relation
M
M
dt = Aek 2 dt = 1.
(3.9)
2
Equation (3.9) says that if we post a limit order at a distance = M2 from the
mid-price, this limit order is essentially a market order that will get executed with
probability one in a dt time interval.
In the first step of our algorithm, rather than solving (3.3) numerically to obtain
the indifference bid and ask prices given by (3.4) and (3.5), we use the average of
8
the suboptimal bid and ask prices derived in section 2.2 for the static version of the
problem. In other words we will be using the proxy
r(s, q, t) = s q 2 (T t)
(3.10)
for both r b and r a . For the second step of our algorithm, we substitute the exponential
order arrival function (3.8) into (3.6) and (3.7) and use the reservation price in (3.10)
to obtain
1
b = q 2 (T t) + ln(1 + )
(3.11)
k
and
a = q 2 (T t) +
1
ln(1 + ).
(3.12)
2
ln(1 + )
Stock
Price
Midmarket price
Price asked
Price bid
Indifference Price
102.5
102
101.5
101
100.5
100
99.5
99
98.5
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Time
Figure 1. The mid-price, indifference price and the optimal bid and ask quotes
9
Note that when the indifference price is lower than the mid-price, the relation
(3.10) indicates that the inventory position qt must be positive. This can be observed
at time t = 0.5 for example. Since our agent is anxious to sell due to a positive
inventory, the bid and ask quotes are low relative to the mid-price. This, in turn,
encourages a higher intensity of market buy orders, until time t = 0.55, where the
inventory is back to zero and the mid-price and indifference prices overlap.
On the other hand, at time t = 0.25, the indifference price is higher than the
mid-price, indicating that the inventory position must be negative (or short stock).
Since the bid price is aggressively placed near the mid-price, the inventory quickly
returns to zero at time t = 0.3. Notice that as we approach the terminal time, the
indifference price gets closer to the mid-price, and our agents bid/ask quotes look
more like a symmetric strategy. Indeed, when we are close to the terminal time, our
inventory position is considered less risky, since the mid-price is less likely to move
drastically.
We then run 1000 simulations to compare our inventory strategy to the best
bid/best ask strategy. The average and standard deviations of the profit and final
inventory are indicated in Table 1. The standard deviation of qT for our inventory
Strategy
Spread
Inventory
1.29
Best bid/best ask
0.5
Symmetric
1.29
Profit std(Profit)
62.94
5.89
48.43
14.57
67.21
13.43
Final q std(Final q)
0.10
2.80
0.72
9.56
-0.018
8.66
obtains a slightly higher return since it is centered around the mid-price, and therefore receives a higher volume of orders than the inventory strategy. However, the
inventory strategy obtains a P&L profile with a much smaller variance, as illustrated
in the histogram in Figure 3.
Figure 2. = 0.1
Figure 3. = 0.1
The results of the simulations comparing the inventory strategy for = 0.01
with the corresponding symmetric strategy are displayed in Table 2. This small
value for represents an investor who is close to risk neutral. The inventory effect is
therefore much smaller and the P&L profiles of the two strategies are very similar, as
illustrated in Figure 4. In fact, in the limit as 0 the two strategies are identical.
Strategy
Inventory
Symmetric
Spread
1.33
1.33
Profit
66.78
67.36
std(Profit)
8.76
13.40
Final q std(Final q)
-0.02
4.70
-0.31
8.65
Spread
1.15
1.15
Profit
33.92
66.20
std(Profit)
4.72
14.53
Final q std(Final q)
-0.02
1.88
0.25
9.06
Figure 4. = 0.01
Figure 5. = 0.5
References
[1] B. Biais, L. Glosten and C. Spatt, The Microstructure of Stock Markets, Working
paper (2004).
[2] J.-P. Bouchaud, M. Mezard and M. Potters, Statistical Properties of Stock Order
Books: Empirical Results and Models, Quantitative Finance, 2 (2002) 251-256.
[3] X. Gabaix, P. Gopikrishnan, V. Plerou, H.E. Stanley, A Theory of Large Fluctuations in Stock Market Activity, MIT Department of Economics Working Paper
No. 03-30.
[4] P. Gopikrishnan, V. Plerou, X. Gabaix and H.E. Stanley, Statistical Properties
of Share Volume Traded in Financial Markets, Physical Review E, 62 (2000)
R4493-R4496.
[5] T. Ho and R. Macris, Dealer Bid-Ask Quotes and Transaction Prices: An Empirical Study of Some AMEX Options, Journal of Finance, 39, (1984) 23-45.
[6] T. Ho and H. Stoll, Optimal Dealer Pricing under Transactions and Return
Uncertainty, Journal of Financial Economics, 9 (1981) 47-73.
[7] T. Ho and H. Stoll, On Dealer Markets under Competition, Journal of Finance,
35 (1980) 259-267.
[8] H. Luckock, A Steady-State Model of the Continuous Double Auction, Quantitative Finance, 3 (2003) 385-404.
[9] S. Maslow and M. Mills, Price Fluctuations from the Order Book Perspective:
Empirical Facts and a Simple Model, Physica A, 299 (2001) 234-246.
12
13