Weatherwax Hasbrouck Notes
Weatherwax Hasbrouck Notes
Weatherwax Hasbrouck Notes
John L. Weatherwax
Introduction
Here youll find some notes that I wrote up as I worked through this excellent book. Much of
my motivation for writing these notes was to develop a document where one could directly
read the mathematical derivations. Too often (I feel) textbooks make jumps between
equations and it can be difficult to understand the resulting flow without spending a sig-
nificant amount of time deriving the given statements. With this document, hopefully one
will be able to follow the more detailed and simple steps presented here to verify many of
the mathematical statements made in the book. If there is any problem with this approach
is that some people may find it onerous to read mathematical statement they deem to be
trivial. On this matter, I tried to error on the side of completeness rather than on the side
of brevity. The goal in mind was always to end with a document which could be read
without having to do any external calculations to obtain/verify the given expressions.
Ive worked hard to make these notes as good as I can, but I have no illusions that they
are perfect. If you feel that that there is a better way to accomplish or explain an exercise
or derivation presented in these notes; or that one or more of the explanations is unclear,
incomplete, or misleading, please tell me. If you find an error of any kind technical,
grammatical, typographical, whatever please tell me that, too. Ill gladly add to the
acknowledgments in later printings the name of the first person to bring each problem to my
attention.
[email protected]
1
All comments (no matter how small) are much appreciated. In fact, if you find these notes
useful I would appreciate a contribution in the form of a solution to a problem that I did
not work, a mathematical derivation of a statement or comment made in the book that was
unclear, a piece of code that implements one of the algorithms discussed, or a correction to
a typo (spelling, grammar, etc). Sort of a take a penny, leave a penny type of approach.
Remember: pay it forward.
2
Chapter 3 (The Roll Model of Trade Prices)
In the Roll model we assume that mt is our midquote price often considered to be the
individual stocks fair price which has an arithmetic random walk model for its dynamics
given by
mt = mt1 + ut . (1)
If we assume that the (half) bid-ask spread is constant then we define
2c = at bt , (2)
where at and bt are the time dependent ask and bid prices respectively. With this definition
c is the half spread and then if trades take place on the bid for a customer sell and on the
ask for a buy the trade prices pt are given by
pt = mt + cqt , (3)
where qt is +1 when a customer is buying (from the ask) and or 1 when a customer is
selling (from the bid). Assuming ut and qt are uncorrelated, independent, zero mean, and
identically distributed we can compute second order statistics of the change in trade prices
pt pt pt1 . Using the above we can compute
Note that in going from line 5 to line 6 we are using the assumption that E[ut qtk ] = 0 for
all k. In going from line 6 to line 7 we are using the assumption that E[qt qtk ] = 0 for all
3
k. In the last line we have used E[qt2 ] = 1. Next we compute the lag one covariance of the
change in price pt . We have
the same expression as in the book. Using these two equation via measuring 0 and 1 we
can estimate c and u2 . This is done with the following
c = 1 (12)
u2 = 0 + 21 . (13)
From the discussion in the book we can conclude that the given variables we have just
estimated are of value because
c is another measure of the bid ask spread or the uncertainty around the midquote.
We can think about this as representing the measurement noise of the fair price.
u2 is the variance of the midquote mt price dynamics. We can think about this as
representing the process noise of the fair price.
There are several problems (or directions for further modeling) with the above approach.
The trade direction indicator qt are correlated (buy tend to follow buys and sells tend
to follow sells). Thus E[qt qt1 ] 6= 0. See Page 7 for some of the mathematics in this
case.
The trade direction indicator qt and the movement in the midquote ut are also corre-
lated for much of the same reason as the previous comment. See Page 7 for some of
the mathematics in this case.
4
Chapter 4 (Univariate Time-Series Analysis)
We will estimate 0 E[p2t ] and 1 E[pt pt1 ] from a time series of trade data pt . If
we desire to fit a MA(1) model to pt we first recall that an MA(1) model for pt has the
following form
pt = t + t1 . (14)
Such a model has 0 and 1 related to its parameter and the variance of the noise term t
we have
0 = (1 + 2 )2 (15)
1 = 2 . (16)
Given that we know 0 and 1 by using our time series of trades we can solve for the
parameters and 2 . If we divide the second equation by the first we get
1
1 = = ,
0 1 + 2
where I have used the definition of the lag-one autocorrelation 1 . We can write this as
a quadratic equation in 1 in terms of 1 . Putting this equation in the standard form for
quadratic equation we get
1
2 + 1 = 0 .
1
Solving for in the above we get
q
1 1
1
1
4(1) p
1 1 421
p
0 02 412
= = = (17)
2 21 21
1
With this expression we compute 2 =
and find
p ! p
2 2 0 02 412 0 02 412
2 = p 1 p = , (18)
0 02 412 0 02 412 2
when we simplify.
Assuming a MA(1) model for pt given by Equation 14 we can write this as an AR(1) model
by first solving for t to get t = pt t1 and then using this expression to recursively
5
qt qt+1 qt+2 Unnormalized Probability vt+1 = qt+1 qt vt+2 = qt+2 qt+1
+1 +1 +1 2 1 1
+1 +1 -1 (1 ) 1 1
+1 -1 +1 (1 )2 1 1+
+1 -1 -1 (1 ) 1 1 +
-1 +1 +1 (1 ) 1+ 1
-1 +1 -1 (1 )2 1+ 1
-1 -1 +1 (1 ) 1 + 1+
-1 -1 -1 2 1 + 1 +
Table 1: The possible values for the variables: qt , qt+1 , and qt+2
When we take the limit N we get the AR(1) representation of our MA(1) model.
Part (a): First consider all of the possible values that the three samples qt , qt+1 , and qt+2
can take. These are tabulated in Table 1 along with the unnormalized probability of each
of these transitions and the value of expressions vt+1 = qt+1 qt . If we sum the values in
the unnormalized probabilty column above we get the numerical value of 2. Thus to convert
everything to a true normalized probability (all events sum to 1) we need to divide each
unormalized probability by 2. Using the above probabilities we can compute the expression
E[vt+1 vt+2 ]. Which when we simplify is given by
42 (1 + )2 + 2(1 + )2 .
See the Mathematical file chap 4 prob 1.nb. Since we must have this equal to 0 we can
solve for in terms of and get
1
= or = 1 + 2 .
1 2
Since 0 < < 1 we can write this as 1 < 1 + 2 < +1 which is the invertible region for
and thus we must take the second solution.
Part (b): Note that using the probabilities above we can show that E[vt+1 ] = E[vt+2 ] = 0.
2 2
Using the expression above we can calculate E[vt+1 ] and E[vt+2 ] which must both be equal
2
to v .
6
3
Part (c): In the above Mathematica file we can compute E[vt+1 vt+2 ] (note the 3 on the
expression for vt+2 my version of the book has a two) and get
32(1 + )2 2 (1 + 2) .
Part (a): To evaluate Var(pt ) when the trade indicators qt are correlated we start with
Equation 6 but then replace E[qt qt1 ] with
p p
E[qt qt1 ] = Var(qt ) Var(qt )Corr(qt , qt1 ) = Corr(qt , qt1 ) = .
When we do this we get
Var(pt ) = u2 + 2c2 2c2 = u2 + 2c2 (1 ) ,
as we were to show. To evaluate Cov(pt , pt1 ) we can start with Equation 10 from which
we get
1 = c2 E[qt qt1 qt qt2 qt1
2
+ qt1 qt2 ]
2 2
= c ( 0 1 + ) = c (1 2) ,
as we were to show. To evaluate Cov(pt , pt2 ) we have
Cov(pt , pt2 ) = E[pt pt2 ]
= E[(ut + c(qt qt1 ))(ut1 + c(qt2 qt3 ))]
= E[uut2 ] + 0 + 0 + c2 E[(qt qt1 )(qt2 qt3 )]
= 0 c2 E[qt1 qt2 ] = c2 .
We have Cov(pt , ptk ) = 0 for k 3.
Part (b): If our true process had autocorrelated trades and we used the default Roll model
to estimate the half spread c via Equation 12 we would say
p p
c = 1 = c2 (1 2) = c 1 2 .
Since we are assuming that 0 < < 1 we can manipulate this to show that |1 2| < 1 and
thus from the definition of c above we have
c2 | = |c2 (1 2)| |c2 | ,
|
showing that c underestimates the true value of c.
Part (a): To evaluate Var(pt ) when the trade indicators qt are correlated with the fair
noise nt we start with Equation 5 but then replace E[ut qt ] = u . When we do that we get
Var(pt ) = u2 + 2cu + c2 (1 + 1 2E[qt qt1 ]) = 2c2 + 2cu + u2 .
7
To evaluate Cov(pt , pt1 ) we can start with Equation 9 and get
Part (b): If our true process had correlated price movement and trades and we incorrectly
used the default Roll model to estimate the half spread c via Equation 12 we would think
p
c = 1 = c2 + cu > c ,
showing that in this case we would over estimate our half spread.
8
Chapter 5 (Sequential Trade Models)
From the diagram given in the book we have that the probability of a buy is given by
1 1
Pr(Buy) = 0 + (1 ) + (1 ) + (1 )(1 )
2 2
1
= (1 + (1 2)) , (19)
2
when we simplify. In the same way for sells we have
1 1
Pr(Sell) = + (1 ) + (1 )(1 )
2 2
1
= (1 (1 2)) , (20)
2
when we simplify. Note from the above expressions that Pr(Buy) + Pr(Sell) = 1 as they
should. If we are in the case where Pr(Buy) = Pr(Sell) then we must have (after canceling
the common 12 on both sides)
1 + (1 2) = 1 (1 2) ,
or
2(1 2) = 0 .
This means that = 0 (no informed traders) or 1 2 = 0 or = 21 (no directional
movement of the price V ). We will now estimate our changes in belief in the fair value of the
tradable given that a trade (buy/sell) has taken place. Note that to do this we only need to
compute the probability that the fair price is less than V given the trade direction. That is,
we only need to evaluate the expressions Pr(V |Buy) and Pr(V |Sell). The reason for this is
that once we have these two expressions, to calculate the probability that the fair is greater
than V given the trade direction we simply use
Pr(V |Buy) = 1 Pr(V |Buy)
Pr(V |Sell) = 1 Pr(V |Sell) .
We now compute the dealers updated belief that the true price is V (less than the current
midquote V ) based on the observation that the last trade was a buy. Using the diagram in
the book we have
1
Pr(V , Buy) (1 ) (1 )
Pr(V |Buy) 1 (Buy) = = 1 2 = . (21)
Pr(Buy) 2
(1 + (1 2)) 1 + (1 2)
9
Note that is the a prior probability that the stock moves down. The notation 1 (Buy)
is the new probability that the stock moves down given that one buy trade has occurred.
Given the above expression we can compute Pr(V |Buy) using
(1 )
Pr(V |Buy) = 1 1 (Buy) = 1
1 + (1 2)
1 + (1 )(1 + )
= = . (22)
1 + (1 2) 1 + (1 2)
We can show that as increases (we have more informed traders) we expect that 1 (Buy) to
decrease since for each buy the dealer observes is less likely to have come from an uninformed
trader. Each buy that comes from an informed trader is expected to indicate that the price
will move up. Taking the needed derivatives we have
1 (Buy) (1 )(1 2)
=
1 + (1 2) (1 + (1 2))2
2(1 )
= ,
(1 + (1 2))2
when we simplify. As 0 < < 1 we also have 0 < 1 < 1 and the numerator above is
positive which means that the entire expression for the derivative is negative. If the market
maker sells at the ask A, then his profit is = A V since originally the security he held
was worth V . His expected profit when he sells for A and someone buys is given by
E[|Buy] = A E[V |Buy]
= A [Pr(V |Buy)V + (1 Pr(V |Buy))V ]
= A [1 (Buy)V + (1 1 (Buy))V ] .
If we assume that competition drives the expected profit E[|Buy] to zero (otherwise every-
one would sell at the ask) then we have from our expressions for 1 (Buy) via Equation 21
and 22 that
(1 ) (1 )(1 + )
A = E[V |Buy] = V + V
1 + (1 2) 1 + (1 2)
V (1 ) + V (1 )(1 + )
= . (23)
1 + (1 2)
In words, the equation A = E[V |Buy] states that the dealers ask is the expected value given
that someone is going to buy at that price. In other words, the expected price at which
when one buys at V there is no more edge in the trade. We now consider the case where a
sell trade occurs.
10
In the same way as before we compute
1 (1 2)
Pr(V |Sell) = 1 1 (Sell) =
1 (1 2)
(1 )(1 )
= . (25)
1 (1 2)
when we simplify. Since we expect that V is more likely when a sell occurs relative to when
a buy occurs we expect that our model should show that Pr(V |Sell) > Pr(V |Buy). We will
now show this fact which involves some inequality manipulations. From the expressions just
computed we can evaluate the ratio
Pr(V |Sell) 1+ 1 + (1 2)
= .
Pr(V |Buy) 1 1 (1 2)
Since 0 < < 1 we have that 2 < 2 < 0 and 1 < 1 2 < +1 or that the variable
1 2 is such that |1 2| < 1. Since is positive we can write this as
|1 2| < ,
or
< (1 2) < + and < (1 2) < + .
when we multiply by a negative one. Adding one to each of these inequalities we get
1 < 1 + (1 2) < 1 + and 1 < 1 (1 2) < 1 + .
Using these expressions we find a lower bound on the ratio given by
1 + (1 2) 1
> .
1 (1 2) 1+
This means that
Pr(V |Sell) 1+ 1
> = 1,
Pr(V |Buy) 1 1+
as we were to show. We expect the more informed traders there are (i.e. the larger the value
of is) that more from each person that sells to us is an indication that the stock is going
to go down and that its value is more likely V . We find
1 (Sell) (1 + )(1 2)
= +
1 (1 2) (1 (1 2))2
2(1 )
= ,
(1 (1 2))
when we simplify. Since this expression is positive we have the requested expression. By
considering the profit to the dealer when he buys (the market buys at the bid B) we can
show that
B = E[V |Sell] = Pr(V |Sell)V + (1 Pr(V |Sell))V
(1 + ) (1 )(1 )
= V + V
1 (1 2) 1 (1 2)
V (1 + ) + V (1 )(1 )
= . (26)
1 (1 2)
11
0 Buy
I
1 Sell
V
1
2 Buy
1
V U
1 Sell
2
1 1
2 Buy
V
1 Sell
2
Table 2: The possible outcomes when informed trading happens only in the low state V
We diagram the possible transitions in the case specified in Figure 2. From the figure we see
that the unconditional probabilities of a buy and a sell order are
1 1 1
Pr(Buy) = (1 ) + (1 ) = (1 )
2 2 2
1 1 1
Pr(Sell) = (1 ) + (1 ) + = (1 + ) .
2 2 2
Note that Pr(Buy) + Pr(Sell) = 1 as it should. We can now compute the probability of V
conditional on a buy or sell order arriving. We find
Pr(V , Buy) 0 + 1 (1 ) (1 )
1 (Buy) = Pr(V |Buy) = = 1 2 = .
Pr(Buy) 2
(1 ) 1
12
1 Buy
1 S
0 Sell
I 0
Buy
S
1 Sell
V
1
1 2
Sell
U
1 Buy
2
V 1
Buy
S
0 Sell
I 0
1 Buy
S
1 1 Sell
V
1
1 2 Sell
U
1 Buy
2
Table 3: The possible outcomes when informed traders have a signal to enter a trade.
Pr(V , Sell) + 21 (1 ) (1 + )
1 (Sell) = Pr(V |Sell) = = 1 = .
Pr(Sell) 2
(1 + ) 1 +
Using these expressions we find for the ask A
13
Exercise 5.3 (informed traders with a signal)
We diagram the possible transitions in the case specified in Figure 3. From the figure we see
that the unconditional probabilities of a buy and a sell order are given by
1 1
Pr(Buy) = (1 ) + (1 ) + (1 ) + (1 )(1 )
2 2
1 1
= + 2
2 2
1 1
Pr(Sell) = + (1 ) + (1 )(1 ) + (1 )(1 )
2 2
1 1
= + (1 2)(1 2) .
2 2
Now that Pr(Buy) + Pr(Sell) = 1 as it should. Given these and from the diagram in Figure 3
we get
Pr(V , Buy) (1 ) + 21 (1 )
(Buy) = =
Pr(Buy) Pr(Buy)
(1 (2 1))
= ,
1 (2 1)(2 1)
when we simplify.
1 (Sell1 )(1 )
.
1 + (1 21 (Sell1 ))
14
Chapter 6 (Order Flow and the Probability
of Informed Trading)
This is a relatively short chapter with no problems but one thing that seemed confusing
to me on the first reading was the diagram given to represent event uncertainty coupled
with the Poisson arrival rate for trades (buy/sells). We can reason about this diagram by
understanding that depending on what external event happens to our stock the intensities
of buying and selling will change. For example, with probability 1 nothing informative
has happened and there is no trade for informative traders to take. In that case the Poisson
intensity of buyers and sellers is equal and denoted by . On the other hand, with a proba-
bility of , an information event has taken place. In that case, with another probability ,
this is a down event or V V and all informed traders will be selling. Thus we expect
the intensity distribution of buyers vs. sellers to be have more sellers than buyers. This
is denoted using Poisson intensities as the distribution (, + ). If the event is such that
V V then the informed traders are buying and Poisson intensity distribution is given by
( + , ).
15
Chapter 7 (Strategic Trade Models)
Assume the world is divided up into informed and uniformed traders who will submit their
orders and then all trades take place at a common price p which is set by the market maker
(MM). The market maker has to absorb the excess liquidity when very large orders come in.
We assume that the final fair stock price (denoted by a v) is a random variable given by a
N (p0 , 0 ) distribution. The difference between informed and uninformed traders are based
on the fact that the informed traders will know this final price v. Since the informed traders
know v they desire to trade as much stock as possible at a price that is advantageous to
that final price. The informed trader will submit market orders to try to make these trades.
There is a trade off between the total quantity (size) of market orders that the informed
trader will submit and his impact on the price the market maker will set. For example, if
the informed trader thinks that the price will go up he will submit his buy markets orders.
These orders then cause the market maker increase the auction price. If the price increase
too much the trade may not end up profitable.
It is in the equilibrium between the final fair price v, the sized of the order the informed
trader will submit, and how the market maker adjusts his price based on that demand that
determines the solution.
The informed trader submits his demand for x shares/dollars and the noise traders submits
a random demand u for the stock given by u N (0, u2 ). The total demand the market
marker then sees is denoted by y is the sum y = x + u. The variables u and x are positive if
traders want to buy and negative if they want to sell. The market marker seeing this total
demand will set the auction price in a linear manner related to the demand as
p = y + . (28)
Here is a liquidity scaling parameter that specifies how the market maker will change the
fill price p depending on the liquidity y observed. If there is no demand y = 0 then p = so
is the zero demand price which would be close to the midquote of any market that traded
before the trades the market maker must participate in.
Now if informed trader does not know the value of used by the market maker (one will
be derived below) one can estimate this parameter by observing the total demand y by
computing a linear regression between the response of p or the difference between the
open/auction price and the midquote just prior to the auction and y the total incoming
imbalance messages. That is we fit the model
p = y + ,
using linear regression or other such method. Here is a error term. Using this model one
could predict the open price given the total demand y.
16
As informed traders know the final security price v and they get filled for x against the market
marker (MM) at the price p. The profit from this strategy is then known at = (v p)x.
Using what we know since the market makers price setting function is assumed to be
p = y + we can write the profit as
= (v y )x = (v y)x .
Note that v is the price difference between the current midmarket and the known final
price v. In terms of our informed traders demand x we have y = x + u so our profit is given
by
= (v (x + u))x .
Since u is a random variable we will evaluate the expectation of this expression under the
assumption that as an informed trader we know the final price v. In this case, the noise
traders demand u is independent of everything else so using E[u|v] = 0 the expected profit
is
E[|v] = (v x)x .
In general, for models of this type we will compute the expected profit of the informed trader
given the information the informative trader has which in this case is the final price v. To
maximize E[|v] as a function of x the informed trader would compute dE[|v]dx
= 0 and solve
for x. He would find
v
v 2x = 0 or x = . (29)
2
The second order criterion (that we have found a maximum and not a minimum) is given by
d2
E[|v] = 2 < 0 .
dx2
This requires that > 0. If the market maker assumes that the informed trader acts
rationally and follow the above strategy the informed trader has a submitted demand x that
is linear in v (i.e. x = + v for some and ) since we can write the expression in
Equation 29 for x as
1
x = + v.
2 2
Thus in the linear form x = + v we have
1
= and = . (30)
2 2
The market maker will not loose money or suffer from selection bias if he can set the auc-
tion/trade price p exactly at the fair or final price v. The market maker might not know v
but if he can try to compute E[v|y] where y is the total order flow from the informed and the
noise traders. The fact that the variable y can tell us something about v follows from the
fact that y depends on x (the informed traders orders) and x depends on v (via the linear
relationship above). Thus the variables y and v are linked and knowledge of one should help
in determining the other. We will use the result on the expectation of a conditioned random
variable given in the book. Writing y in terms of the final price v we have
y = u + + v .
17
Since u and v are random u N (0, u2 ) and v N (p0 , ) we have that
E[y] = + p0 (31)
var[y] = u2 + 2 0 (32)
cov(y, v) = cov(u + + v, v) = 0 + cov(v, v) = 0 . (33)
Then using these expressions and the theorem in the book we find
vy
E[v|y] = v + (y y ) (the definition) which in this case becomes (34)
y2
0
= p0 + 2 (y p0 ) . (35)
u + 2 0
and
2
vy
var(v|y) = v2 (the definition) which in this case becomes (36)
y2
(0 )2 u2 0
= 0 = . (37)
u2 + 2 0 u2 + 2 0
Again for the market market to not loose money he must set his price p at E[v|y]. Thus we re-
quire that E[v|y] computed above equal match the market makers liquidity price adjustment
relationship p = y + for all y. This gives
0 0
E[v|y] = p0 ( + p0 ) + y = y + .
u2 + 2 0 u2 + 2 0
Equating these two expressions when we group terms by powers of y we have that
p0 u2 0
0
= p0 ( + p 0 ) = , (38)
u2 + 2 0 u2 + 2 0
and
0
= . (39)
u2 + 2 0
Adding the expressions for the linear form of the informed traders demand x = + v of
1
= 2 and = 2 with the equations 38 and 39 we have four equations for the four
unknowns: , , , and . When we solve these four equations simultaneously in terms of
the variables p0 , 0 and u2 we get
s
u2
= p0
0
= p0
s
1 0
=
2 u2
s
u2
= .
0
18
The book selects the first solution (the one with a positive value for since from Equation 28
we would expect that when y > 0 that p > ). Note this gives a negative value for ). See
the Mathematica file chapter 7 algebra.nb. For the expected profit under all of these
assumptions we have
v v
E[] = x(v x) = vx
2 2
s
(v )2 (v p0 )2 u2
= = . (40)
4 2 0
q
2
u
The variance in the fair price v given the incoming interest y, where we use = 0
is then
given by
u2 0
var[v|y] = 2 = 0 .
2 + u 2
u 0 0
For this problem we will assume that Cov(u, v) = uv > 0. In this case the expression
for the informative traders profit does not change. Namely when we use the expression
Equation 28 for p we get
= (v p)x = (v (x + u))x .
As the informed trader knows the final price v the expected profit is given by
E[|v] = (v (x + E[u|v]))x .
Since now u and v are correlated, we no longer have that E[u|v] = 0 as we did before. Using
the expression for conditional expectations given in the book (namely Equation 34) we have
that
uv uv
E[u|v] = E[u] + 2 (v E[v]) = (v p0 ) .
v 0
Note that this is independent of x, contains all known expressions, and will not change the
form of the optimal x (except to shift it). Thus we get for the optimal order size for the
informed trader
v E[u|v] (v )0 uv (v p0 )
x= = .
2 20
Writing this as x = + v we can compute and , that involve only known quantities.
We now need to evaluate E[v|y] given that the informed trader acts under his optimal
strategy. With y = u + + v (as before) we need to compute the variance of y computed
in Equation 32 and the covariance computed in Equation 33. To compute the variance we
will use " n #
X Xn XX
var Xi = var[Xi ] + 2 cov[Xi , Xj ] . (41)
i=1 i=1 i<j
19
Using this expression we find
cov(y, v) = cov(u + + v, v) = uv + 0 .
With these two expressions we can use Equation 34 to compute E[v|y] and set the resulting
expression equal to y + . We find that
vy
E[v|y] = E[v] + 2 (y E[y])
y
0 + uv
= p0 + (y p0 ) .
u2 + 2 0 + 2uv
Setting E[v|y] equal to y + we get can solve for , and in terms of known parameters
of the problem. This is done in the Mathematica notebook chapter 7 algebra.nb in the
variable wSol.
For this section of the book we assume that the market marker sets his trade/auction price
at p which has a linear impact with the total order flow y as p = y + in the same way as
before. The total order flow y is a random variable that is the sum of the informed trading
request x and a random uniformed trader amount u. That is y = x + u where u N (0, u2 ).
The final fair price of the security or v is a random variable with a distribution N (p0, 0 ).
In this problem the informed trader does not know v but instead s which is derived from
v as s = v + with N (0, 2 ). Under these conditions the informed traders profits are
given as before
= x(v (x + u) ) .
To compute the expected profit we condition on the information the informed trader knows
i.e. the proxy to the true price v or s. Thus we need to evaluate
E[|s] = x(E[v|s] x ) .
The informed trader wants to optimize the expected profit and loss so he solves
d 0
E[|s] = p0 x + x() + 2 (s p0 ) = 0 ,
dx + 0
20
for x to get
s0 + 2 p0 (0 + 2 )
1 0
x= p0 + 2
(s p0 ) = .
2 + 0 2(0 + 2 )
2 p0 (2 + 0 )
= (42)
2(2 + 0 )
0
= . (43)
2(2 + 0 )
Note that these expressions have and in them. The market market must compute E[v|y]
again using the expression for conditional expectation
vy
E[v|y] = E[v] + (y E[y]) .
y2
0
E[v|y] = p0 + (y p0 ) .
u2 + 2 0
Solving Equation 42, 43, 44, and 45 in chapter 7 algebra.nb for , , , and we get
(when we take the root such that > 0)
p0 u
= p
0 + 22
u
=p
0 + 22
= p0
= p 0 .
2u 0 + 22
21
Exercise 7.3 (a piggy backing broker)
From the problem statement, the total demand ordered would be x + x = (1 + )x, so the
observed demand by the market market is y = u + (1 + )x. The informed trader makes a
profit given by
= (v p)x = (v y )x = (v (1 + )x u )x .
The expected profit, given that the informed trader knows the final price v, is
E[|v] = (v (1 + )x )x .
This is the same objective function we have maximized before but now with (1 + ).
Thus the optimal x to order is
v
x= .
2(1 + )
Setting this equal to + v we get
= (46)
2(1 + )
1
= . (47)
2(1 + )
The market maker needs to compute E[v|y] = E[v] + vy2 (y E[y]). As y can be expressed
y
as
y = u + (1 + )x = u + (1 + )( + v) ,
the pieces we need to evaluate E[v|y] are given by
vy = cov(v, y) = cov(v, u + (1 + )( + v)) = (1 + )0
y2 = var(u + (1 + )( + v)) = u2 + (1 + )2 2 0
E[y] = (1 + )( + p0 ) .
Thus we get for E[v|y] we get
(1 + )0
E[v|y] = p0 + (y (1 + )( + p0 )) .
u2 + (1 + )2 2 0
Setting this expression equal to + y we get for and the following
(1 + )0
= 2
u + (1 + )2 2 0
(1 + )2 0 ( + p0 )
= p0 .
u2 + (1 + )2 2 0
Using these two equations with and given by Equations 46 and 47 in chapter 7 algebra.nb
we solve for the four values , , , and under the condition that > 0 to get
p0 u
=
(1 + ) 0
u
=
(1 + ) 0
= p0
0
= .
2u
22
Chapter 8 (A Generalized Roll Model)
mt = mt1 + wt (48)
wt = qt + ut .
When we write it as
mt = mt1 + qt + ut , (49)
we can more easily see the two contributions that affect the fair price mt . The public
information comes from ut and the information from the informed traders come from the
term qt . If we assume that a buy trade takes place (lift ones offer) then the trace price is
pt = mt + c = mt1 + wt + c = mt1 + + c + ut .
pt = mt c = mt1 + wt c = mt1 c + ut .
Subtracting these two expressions gives that the bid-ask spread is given by
2(c + ) .
When the trade price pt is written as pt = mt + cqt and using the model given by Equation 49
for mt we have that the change in the trade price is given by
Now E[pt ] = 0 since everything on the right-hand-side of the expression for pt has zero
mean. Squaring pt we find
To evaluate E[p2t ] using the above expression we will need the facts that
23
and facts like E[qt qt1 ] = E[qt ut ] = 0 etc. Then taking the expectation of p2t then gives
E[p2t ] = c2 (2) + c + c + 2 + u2
= c2 + (c + )2 + u2 , (51)
when we simplify. The above is the definition of 0 . Now to evaluate 1 E[pt pt1 ] we
first compute
All later autocorrelations are zero. From the Wold theorem the model for pt must be
represented as a MA(1) model. In other words it can be written in the form
pt = t + t1 . (53)
If we wish to apply the generalized Roll model to the changes in trade prices we could
empirically measure pt and then fit a MA(1) model to these prices changes. Fitting this
MA(1) model will determine and 2 empirically. Thus these two parameters and 2 will
be used below when needed.
Var(wt ) = 2 (1) + u2 .
0 = 2c2 + +2c + 2 + u2
1 = c2 c .
ft = pt + t . (54)
24
way is a better estimate of mt than the last trade price pt is. We can use the form of the
model for pt to estimate t as time progress, using the model written as t = pt t1 .
That is given the measurable sequence of trade price changes
p1 , p2 , p3 , p4
We start our measurements of t by assuming that 0 = 0 and then form the estimates of t
from
1 = p1 (0) = p1
2 = p2
1
3 = p3
2
..
.
Thus at each instant of time t we observe the most recent trade price pt , compute the change
in trade price pt = pt pt1 , and then compute t = pt t1 . Using this estimate
we can use Equation 54 to compute the filtered estimate of fair. In any application where
one needs accurate estimates of fair prices we could use the filtered estimate ft . In the next
section we will discuss how well ft estimates mt by computing estimates to Var(pt mt ).
This later estimate can be used any place an the uncertainty in ones fair price is needed.
pt = c(qt qt1 ) + qt + ut ,
and Wolds theorem since j = 0 for j 2 we know that pt must be expressible as a MA(1)
model. That is it has a representation given by pt = t + t1 with some values (numbers)
for the constants (, 2 ). Thus from Equation 50 and this moving average representation we
have
t + t1 = (c + )qt cqt1 + ut . (55)
or solving for t we get
t = (c + )qt cqt1 + ut t1 .
Using this we see that Cov(qt , t ) = c + and Cov(qt , t1 ) = 0 for all k 1. With
these expectations E [qt |t , t1 , t2 , . . . ] can be calculated via our conditional expectation
equation 34. We have for the expectation of qt we find
E [qt |t , t1 , t2 , . . . ] = E [qt |t ]
Cov(qt , t )
= E[qt ] + (t E[t ])
2
(c + ) (c + )
=0+ 2
(t 0) = t .
2
c(c + )
ft = E [mt |pt , pt1 , pt2 , . . . ] = pt cE[qt |t , t1 , t2 , . . . ] = pt t .
2
25
fair price given all trades and the roll model general structure is given by Note that from
Equation 52 we have
1 = E(pt , pt1 ) = c(c + ) ,
while from the Wold representation of pt i.e. pt = t + t1 we can write the expectation
in the definition of 1 as
c(c + )
= .
2
so
ft = E [mt |pt , pt1 , pt2 , . . . ] = pt + t . (56)
is the expected fair price (filtered price) after observing the trade pt . See notes earlier about
how one would use these MA(1) representations to compute a better estimate of mt .
In this section we want to study how well ft estimate mt in that we will consider the
expression Var(pt mt ). We can derive an expression for Var(pt mt ) as
The book states that we cannot compute c from the given time series data pt . In that case
we can try to compute a lower bound on this variance. We do this by writing
We can use Equation 54 to compute the first term. To get a lower bound we will compute
Var(mt ft ) under a smaller amount of randomness i.e. we will take ut = 0. This means that
all information that changes our efficient fair price must be due to the trade qt information.
In the original Roll model there is no trade information into mt and we have = 0 so
mt = mt1 + ut only where as here we are considering the case with no ut and only trade
information influencing the value of mt . Using Equation 55 with ut = 0 gives
t + t1 = (c + )qt cqt1 .
If we take t = (c + )qt (by equating the expressions at time t) the remaining parts of the
expression would need to be t1 = cqt1 . Incrementing t in this expression by one and
using the previous relationship
26
The filtered estimate of mt is then
c
ft = pt + t = pt (c + )qt = pt cqt = mt .
c+
This means that when u2 = 0 the filtered estimate is exactly the same as the fair price so
that Var(mt ft ) = 0. Using this we have
Var(pt mt ) = Var(pt ft ) + Var(mt ft )
Var(pt ft ) = 2 2 2s ,
and we have our lower bound on Var(pt mt ) and have defined the expression 2s . Recall
that and 2 were fit to the pt time series i.e. from the autocovariance of pt
0 = E(p2t ) = c2 + (c + )2 + u2 = (1 + 2 )2
1 = E(pt pt1 ) = c(c + ) = 2 .
Using the MA(1) representation given via Equations 15 and 16. Solving for the above for
and 2 we get Equations 17 (with the minus sign) and 18 (with the positive sign). When we
multiply these expressions to compute 2s = 2 2 we get
1
q
2 2
= (0 02 412 ) ,
2
when we put in the expressions for 0 and 1 in terms of c and in the generalized Roll
model we get
2 1h 2 2 2
p
2 2 2 2
i
s = c + (c + ) + u ( + u )[(2c + ) + u ] , (57)
2
the same expression as in the book. This is done in the Mathematica file generalized roll model.nb.
These two expressions can be subtracted when we line up terms containing that have the
same time index
ft = pt
!
!
!
X X X X X
+ j+1 t + j+2 j+1 t1 + j+3 j+2 t2 +
j=0 j=0 j=0 j=0 j=0
!
X
= pt + j+1 t 1 t1 2 t2 3 t3 .
j=0
27
With the moving average representation for pt of pt = (L)t =
P
j=0 j tj and the
above, we can write ft as
!
X X
ft = j tj + j+1 t 1 t1 2 t2 3 t3 (59)
j=0 j=0
!
!
X X
= 0 t + j+1 t = j t = (1)t . (60)
j=0 j=0
mt = ft = wt = (1)t , (61)
where the last equality used follows from Equation 60. Taking variance of both sides we get
the structural requirement
w2 = (1)2 2 . (62)
Using Equation 58 we get for the discrepancy between the trade prices and the efficient price
mt or st = pt mt the following
st = pt mt
!
!
!
X X X
= ft j+1 t j+2 t1 j+3 t2 + mt .
j=0 j=0 j=0
If ft = mt the first and last terms cancel and the above becomes
!
!
!
X X X
st = j+1 t j+2 t1 j+3 t2 +
j=0 j=0 j=0
= Co t + C1 t1 + C2 t2 + , (63)
where Ci is given by
X
Ci j . (64)
j=i+1
Since we know that (1)t = wt we can write st which is expressed in terms of t in terms of
the equivalent wt (up to a scaling by (1)1 ) as
X X Ci
st = Ci ti = wti .
i=0 i=0
(1)
28
Exercise 8.1 (the Roll model with stale prices)
Here we assume that our trade prices are based on old efficient prices with the model pt =
mt1 + cqt . In this case we find for pt the following
and
When the trade prices satisfy pt = pt1 + (mt pt1 ) we find that
(1 (1 )L)pt = wt .
Solving for pt in terms of its MA representation give pt = (L)1 t . We can then use
Equation 61 as wt = (1)t . Given what (1) is in this case i.e. (1) = (1)1 we would get
wt = (1)1t . Taking the variance of both sides of this expression gives
w2 = (1)2 2 ,
as expected.
The given model for pt is a MA(2) model. Here the MA(2) operator (L) is given by
(L) = 1 0.3L + 0.1L2 .
29
Part (a): We want to evaluate w which we can do via Equation 62 which in this case is
Thus w = 0.0025.
Note the are two sources of noise in the above representation of pt one from wt and one
from t . If we can write pt in a MA representation as pt = (L)t with only one source
of noise t . We would have an autocovariance generating function given by
30
Chapter 9 (Multivariate Linear Microstructure Models)
qt = vt + vt1 , (69)
Using this expression with the dynamics for qt gives for the variables pt and qt the system
These expressions show how pt and qt can be written in terms of current and lagged
innovations ut and vt . In vector form the above can be written as
pt 1 +c ut 0 c( 1) ut1 0 c ut2
= + + . (72)
qt 0 1 vt 0 vt1 0 0 vt2
1 +c ut
Let the vector t be defined as t so that
0 1 vt
1
ut 1 +c 1 ( + c)
= t = t .
vt 0 1 0 1
Then to write our model for pt qt in terms of t rather than ut vt we need to
compute the matrix products
0 c( 1) 1 c 0 c( 1)
= 1
0 0 1 0
0 c 1 c 0 c
= 2 .
0 0 0 1 0 0
31
In the above I have
defined the two matrices 1 and 2 that are found in the VMA(2)
representation of pt qt as
pt
= t + 1 t1 + 2 t2 .
qt
ut
Using the above transformational definition of t = B we have
vt
ut ut
= Var(t ) = Var B = BVar B
vt vt
2
u2
1 c+ u 0 1 0 1 c+ 0
= =
0 1 0 v2 c+ 1 0 1 v2 (c + ) v2
2
u + v2 (c + )2 v2 (c + )
= . (73)
v2 (c + ) v2
To compute the vector autoregressive (VAR) representation or (L) in terms of the vector
moving average representation (VMA) (L) we need invert the polynomial (L) = I + 1 L +
2 L2 above as
(L)1 = (I + 1 L + 2 L2 )1 = I 1 L 2 L2 3 L3 4 L4 .
If we multiply by I + 1 L + 2 L2 on the right-hand-side we get the polynomial expression
I = (I 1 L 2 L2 3 L3 4 L4 )(I + 1 L + 2 L2 ) .
Expanding the right-hand-side of this expression and carefully aligning each term
I= I 1 L 2 L2 3 L3 4 L4
+ 1 L 1 1 L2 2 1 L3 3 1 L4
+ +2 L2 1 2 L3 2 2 L4
Equating the coefficients of the powers of L1 between each side we get
0 c( 1)
0 = 1 + 1 1 = 1 = .
0
For the coefficients of L2 we get 2 1 1 + 2 = 0 so
2 = 1 1 + 2
0 c( 1) 0 c( 1) 0 c
= +
0 0 0 0
0 c 2
0 c( 1) 0 c
= + = .
0 2 0 0 0 2
For the coefficients of L3 we get 3 2 1 1 2 = 0 so
3 = 2 1 1 2
0 c 2
0 c( 1) 0 c( 1) 0 c
=
0 2 0 0 0 0
0 c 3 0 c 3
0 0
= 3 = .
0 0 0 0 3
In general the equation for the coefficients of Lk is k k1 1 k22 = 0 or
k = k1 1 k2 2 .
32
Notes on forecasts and impulse response functions
E [t+l |t , t1 , t2 , ] = 0 forall l 1 .
pt
The structural VMA model of the stacked vector yt where yt = where pt is the
xt
first component is given by Eq. 9.2 from the book
yt = t + 1 t1 + 2 t2 + 3 t3 + = (I + 1 L + 2 L2 + 3 L3 + )t . (75)
When we increment t in Equation 75 by k to get yt+k and take the first component i.e. the
first row to get pt+k then using Equation 74 we find
The notation []1 means to take the first component (row) of its argument.
s (0 ) = E [ys |0 , 1 = 2 = 3 = = 0] , (77)
33
for s 0. Thus we consider the expected response at s when our system is started with the
initial value of 0 . This is that only the first innovation is nonzero and all other innovations
are zero. For the VMA model given by Equation 75 written for ys we have
ys = s + 1 s1 + 2 s2 + 3 s3 + + s1 1 + s 0 + s+1 1 + s+2 2 +
If we assume that 1 = 2 = 3 = = 0 then all terms after s 0 are zero and all terms
after s 0 are not observed (and have expectation 0). Thus the impulse response function
for a VMA model is
s (0 ) = E [ys |0 , 1 = 2 = 3 = = 0] = s 0 .
12 12
does in fact give the Cholesky factorization of the matrix . We find the product
12 22
of F F given by
1 0 1 p 12 /1
FF = p
2 2
12 /1 2 12 /12 0 2 12
2
/12
22
12
12 1 12
= 2 = ,
12 12 /12 + 22 12
2
/12 12 22
which is what we wanted to show. In the two-dimensional case the Cholesky factorization
provides a way to generate the vector x from the vector v. For example, x1 and x2 are
generated from z1 and z2 using the transformation
x1 = 1 z1
s
2
12 12
x2 = z1 + 22 z2 .
1 12
Thus in the above factorization the randomness in z1 first is used to generate x1 and then
that randomness is feed into the how the value of x2 is computed. Thus information about x1
is used in the computation of x2 and information flows from x1 to x2 . From this very simple
argument, if we desire to study causal effects i.e. the variable x causes the variable y then the
ordering of variables matters since the Cholesky factorization introduces an information flow.
T
In the order of the variables developed thus far or pt qt as pt is the first variable,
the Cholesky factorization states that the change in price is informative in determining the
trade direction. We would expect information to flow in the other order. Thus we might
reconsider the developments performed thus far in the other order or qt pt . This
34
would affect the steps around Equation 72. In fact Equation 72 in this new variable ordering
becomes
qt 0 1 ut 0 ut1 0 0 ut2
= + + .
pt 1 +c vt 0 c( 1) vt1 0 c vt2
(c + )v2 /v
v p v (c + )v
F = = . (81)
0 u2 + (c + )2 v2 (c + )2 v4 /v2 0 u
Warning: I had trouble deriving the matrix F that is a type of Cholesky factor of (it is
not upper triangular like a Cholesky factor should be). Ill present what I attempted here
which did not give the same results as in the book. If anyone sees anything wrong with what
I attempted here, please contact me.
T
To return to the starting order for the variable pt qt means that we need to exchange
the order of the elements in t so
p,t 0 1 q,t 0 1
t = = = t .
q,t 1 0 p,t 1 0
This to me means that the variance of t should be given by (when we use the Cholesky
factorization of )
0 1 0 1 0 1 0 1
Var(t ) = Var(t ) =
1 0 1 0 1 0 1 0
0 1 0 1 0 1 0 1
= F F = F F
1 0 1 0 1 0 1 0
Thus to set = F F we see from the above that we can take F given by
0 1 v (c + )v 0 1 (c + )v v
F =F = = .
1 0 0 u 1 0 u 0
The product of the above matrix F in the form F F does in fact equal given via Equation 73
as it must but the matrix F computed above is not upper triangular as it should be to be a
35
Cholesky factor (as given by the definition) and it does not match the result for F given in
the book. The F matrix that is given in the book (with the errata transpose from the web)
is
u 0
F = .
(c + )v v
The product of the above matrix F in the form F F again does equal given via Equation 73
as it must but this F is also not upper triangular either (it is lower triangular). At this point
I gave up as not able to derive the result in the book. As always, if anyone sees an error in
what have done please contact me.
u2 + v2 (c + )2 v2 (c + )
2
1
w = 1 c
v2 (c + ) v2 c
u + (c + )2 v2 (c2 + c)v2
2
u2 + (c + 2 )v2
= 1 c = 1 c
(c + )v2 cv2 v2
= u2 + (c + 2 )v2 cv2 = u2 + 2 v2 . (83)
In this section we want to estimate the variance of the pricing error st where st is defined as
st = pt ft . From Equation 76 the formula for ft we have that
!
!
!
X X X
st = pt ft = [j+1 ]1 t [j+2 ]1 t1 [j+3 ]1 t2 + .
j=0 j=0 j=0
36
Lets
P evaluate one of the terms in the above sum, say the first term. Since the expression
j=0 [j+1 ]1 is just a vector multiple of t we find
!
!
!
!
!
X X X X X
Var [j+1 ]1 t = [j+1 ]1 Var(t ) [j+1 ]1 = [j+1 ]1 [j+1 ]1 .
j=0 j=0 j=0 j=0 j=0
Define
X
Ck [j ]1 , (84)
j=k+1
(the negative sign but that does not matter in the evaluation of s2 ) and we get
X
s2 = Ck Ck . (85)
k=0
In the example structural model considered in this chapter a direct calculation of s2 would
give (if we assume ft = mt (so as to compute a lower bound on s2 )
st = pt ft = mt + cqt mt = cqt .
st = c(vt + vt1 ) .
Thus
s2 = c2 (v2 + 2 v2 ) = c2 (1 + 2 )v2 .
We can check this result against the general multidimensional results derived above. We
first need to compute C0 , C1 , C2 etc. We find
X 2
X
C0 = [j ]1 = [j ]1 = 0 c( 1) + 0 c
j=1 j=1
= 0 c = 0 c
X
C1 = [j ]1 = 0 c = 0 c
j=2
Cj = 0 for j 2 .
37
Thus using the above method we have
s 2 = 0 c 0 c + 0 c 0 c
u2 + v2 (c + )2 v2 (c + )
0
= 0 c
v2 (c + ) v2 c
u + v2 (c + )2 v2 (c + )
2
0
+ 0 c
v2 (c + ) v2 c
c(c + )v2 c(c + )v2
= 0 c + 0 c
cv2 cv2
= c2 v2 + c2 2 v2 = c2 (1 + 2 )v2 . (86)
The same as earlier.
Now the noise in this model comes from three sources. The to apply to the midpoint (aka the
efficient price) come from ut , qt , and Qt (which is assumed
to be a normal random variable
ut
2
Qt N (0, Q )). Thus the disturbance vector t is t = qt .
Qt
pt
Part (a): For this part we want to write yt qt = (L)t . We compute pt as
Qt
Thus our model becomes (in matrix form) using t defined earlier
pt 1 0 + c0 1 + c1 ut 0 c0 c1 ut1
qt = 0 1 0 qt + 0 0 0 qt1 ,
Qt 0 0 1 Qt 0 0 0 Qt1
1 0 + c0 1 + c1 0 c0 c1
Thus 0 = 0 1 0 and 1 = 0 0 0 . We find for the requested
0 0 1 0 0 0
38
covariance given by
s
2
2Q
Cov(qt , Qt ) = E[(qt E[qt ])(Qt E[Qt ]) ] = E[qt Qt ] = E[|Qt |] = ,
using the identity given in the book. Next we compute
ut
= Var(t ) = E[t t ] = E qt ut qt Qt
Qt
2
2 u 0 q0
ut ut qt ut Qt
2
0 1
= E qt ut qt2 qt Qt = Q
2
q
Qt ut Qt qt Qt 0 2
2
Q
Q
Part (c): How much of the total efficient price variation is due to qt ? This depends on the
ordering of the variables. If they are ordered as Qt , qt , ut then
q
2 2
0
Qt qQ Q
1 = Var qt = 2
1 0 .
Q
ut
0 0 u2
39
We want to perform Cholesky
decomposition
q of this matrix. The Cholesky decomposition
2 2
Q
Q
of the 2 2 sub-block q is
2
Q 1
" # q
2
Q q 0 Q
F F = q
2 2
q .
1 0 1 2
Thus we can write w2 using Equation 82 in this new ordering (the same output ordering of
pt
qt we get that (L) given by
Qt
1 + c1 0 + c0 1 c1 c0 0
(L) = 0 1 0 + 0 0 0 L so [(1)]1 = 1 0 1 .
1 0 0 0 0 0
qt
When the order of the the variables is Qt we follow the same steps as earlier.
ut
qt
Write = Var Qt .
ut
Compute its Cholesky factorization.
Determine what (L) and (1) are in this new coordinate ordering.
40
Step one and two are
q
2
1 0
qt q Q
h iT = Var Qt = 2
Q2
0
qt Qt ut
ut
0 0 u2
q
2
q1 q 0 0 1
Q
0
2 2 2 2 q
= Q Q 0 1 2 Q 0 .
0
Q
0 0 u 0 0 u
For step three, the expression for (L) with this variable ordering is
0 + c0 1 + c1 1 c0 c1 0
(L) = 1 0 0 + 0 0 0 L so [(1)]1 = 0 1 1 .
0 1 0 0 0 0
Again under this ordering Equation 82 finally give for w2 the following
q
2
q 1 q 0 0 1
Q
0
0
w2 = 0 1 1
2
1 2 Q 0
q
1 2 Q 0 1
0
Q
0 0 u 1
0 0 u
r !2
2 2 2 2
= 0 + Q 1 + 1 Q 1 + u2 .
Thus the contribution to the total variance of w2 provided by the variable qt (which is the
q 2
2
first variable in this ordering) is given by 0 + Q 1 as claimed.
pt
For the yt = we have
qt
For qt we have qt = qt1 + vt i.e. it is already in AR form. Thus our vector model is
pt 1 +c ut 0 c( 1) pt1 ut pt1
= + 0 + 1 ,
qt 0 1 vt 0 qt1 vt qt1
41
where we have defined 0 and 0 . Notice there are not other coefficient thus 1 = 2 = 0.
This is a first order VAR process in the form (L)yt = (L)t . We can write this expression
in the form
1 0 0 c( 1) pt 1 +c ut
L = .
0 1 0 qt 0 1 vt
For the given VAR model (L)yt = (L)t we have w2 = AA with A the first row of
the
1 c( 1)
matrix product ((L))1 (1). For this problem the expression (1) = so
0 1
1 1 1 c( 1) 1 +c 1 1 (1 )
(1) (1) = = .
1 0 1 0 1 1 0 1
The first row is 1 so
u2 0
2 1
= u2 + 2 v2 .
w = 1 2
0 v
We can compute this directly using the expression wt = ut + vt since ut and vt are inde-
pendent and we get
w2 = u2 + 2 v2 ,
the same result.
42
Chapter 10 (Multiple Securities and Multiple Prices)
This gives
u2 + 2c2 2c2
0 = 2 . (87)
2c 2
u + 2c2
We can compute 1 in the same way
p1,t1 p1,t p1,t1 p1,t p2,t1
1 = Cov(pt , pt1 ) = E p1,t p2,t =E .
p2,t1 p2,t p1,t1 p2,t p2,t1 ]
We can evaluate each element in in this matrix in tern
E[p1,t p1,t1 ] = E[(u1,t + c(q1,t q1,t1 ))(u1,t1 + c(q1,t1 q1,t2 ))] = c2 E[q1,t1
2
] = c2
E[p1,t p2,t1 ] = E[(u1,t + c(q1,t q1,t1 ))(u2,t1 + c(q2,t1 q2,t2 ))] = c2 E[q1,t1 q2,t1 ] = c2
E[p2,t p1,t1 ] = E[(u2,t + c(q2,t q2,t1 ))(u1,t1 + c(q1,t1 q1,t2 ))] = c2 E[q2,t1 q1,t1 ] = c2 .
mt = mt1 + ut
p1,t = mt + cqt
p2,t = mt1 .
43
For the vector pt and this structural model we compute
p1,t mt + cqt mt1 cqt1 ut + cqt cqt1
pt = = =
p2,t mt1 mt2 ut1
1 c ut 0 c ut1
= + .
0 0 qt 1 0 qt1
This last expression defines the matrices 0 and 1 and the vector t . This is one VMA
representation of the vector p but one which cannot be transformed into a VAR model.
To compute a VMA model that can be converted into a VAR model, we first compute 0
and 1 from the vector pt . From the definition of 0 we find
2
2c + u2 0
ut + c(qt qt1 )
0 = E ut + c(qt qt1 ) ut1 = , (89)
ut1 0 u2
using earlier results to evaluate the expectations. From the definition of 1 we find
c2 0
ut + c(qt qt1 )
1 = E ut1 + c(qt1 qt2 ) ut2 = . (90)
ut1 u2 0
As a second step, for a general VMA(1) process written in the form
pt = t + 1 t1 ,
we can compute 0 and 1 (which will be functions of the unknown matrix ) and then
match these results to the explicit expressions for 0 and 1 computed above for the specific
structural model we are considering here. These relationships will form a set of equations
that we can solve to determine the elements of the matrix . For the VMA(1) model pt =
t + 1 t1 for 0 we find
Since we know 0 and 1 from our structural model via Equations 89 and 90 we can attempt
to find a matrix of in the general VMA model such that the general model has the same
values of 0 and 1 . Using Equation 91 and 92 this means that
+ 1 1 = 0 (93)
1 = 1 . (94)
These are two equations for the two variables 1 and . In general we dont know that the
matrix 1 is invertible and in fact for the structural model here it is not invertible. We would
expect that is invertible however. Thus from Equation 94 we would have 1 = 1 1 ,
which when we put this into Equation 93 we would get
+ 1 (1 ) 1 = 0 .
44
or one equation for . Using the Mathematica script chap 10 the VMA representation.nb
we can evaluate each side of this expression and then solve for the elements of the matrix .
We find 4
c + 3c2 u2 + u4 c2 u2
1
= 2 (95)
c + u2 c2 u2 c2 u2
Once we have we can compute 1 = 1 1 where we get
c2 c2
1
1 = 2 . (96)
c + u2 u2 u2
Note that the above expression for and 1 are equivalent to those presented in the book
when we simplify some.
With the filtered estimate of ft given by ft = pt + 1 t we have that the first difference of ft
given by
If the ordering of the prices is p1,t p2,t then from earlier results in this chapter to explain
the decomposition of u2 we would first need to compute 1 and . In the python code
chap 10 structural model.py using the numbers given we first compute
0.8 0.8 5.8 0.8
1 = and = .
0.2 0.2 0.8 0.8
2.408 0.
The Cholesky factor of = F F has F = and we then compute
0.3321 0.83045
2
0.74740932
u = ([(1)]1 F )([(1)]1 F ) = 0.74740932 0.66436384
0.66436384
= 0.55862069 + 0.44137931 = 1.0 .
Thus under this model the innovation from the first price explains 55.9% of u2 while the
innovation from the second price explains 44.1% of u2 .
In the alternative ordering for the prices our model for the vector price change
pt is
pt,2 ut1
pt = = .
pt,1 ut + c(qt qt1 )
From this we find the autocovariance of
pt are
2
0 = u 0
,
0 2c2 + u2
45
and
0 u2
1 = E ut1
ut2 ut1 + c(qt1 qt2 ) = .
ut + c(qt qt1 ) 0 c2
Now we have to compute a VMA(1) representative for this ordering of prices of the form
pt = t + 1 t1 that has the same
0 and 1 as we computed above. This means solving
Equations 93 and 94 for 1 and . Following the same steps from before we have that
2 2
c2 u2
1 c u
= 2 ,
c + u2 c2 u2 c4 + 3c2 u2 + u4
and
u2 u2
1
1 = .
c + u2
2 c2 c2
Following the same steps as before this then gives
Remembering that the second term in the above sum is the contribution to u2 from the first
price we see that it is 20% as expected.
(I + 1 L)1 = I 1 L + 12 L2 13 L3 + 14 L4
c2 c2
2
c2
1 1 c
=I 2 L+ 2 L2
c + u2 u2 u2 c + u2 u2 u2
c2 c2
2
c2
1 3 1 c
2 L + 2 L4 +
c + u2 u2 u2 c + u2 u2 u2
46
3.0
2.8
2.6
p(lambda)
2.4
2.2
2.0
1.8
lambda
Figure 1: The arrival intensity for Exercise 11.1. The red curve is the function Buy (p) and
the blue curve is the function Sell (p).
This problem is worked in the R code ex 11 1.R. The equilibrium price and rate are the
price and rate where the two arrival rate curves Buy (p) and Sell (p) intersect. The dealers
average profit (or trading revenue) per unit time is given by the function or
Since in this problem we are given the prices as a function of the arrival rate we should
write the above as
= (pBuy () pSell ()) .
We then seek to find the value of that maximizes this function. Doing this numerically we
find
[1] "max profit= 0.208264; lambda= 0.424242; p_bid = 2.12; p_ask= 2.61"
47
Notes on risk aversion and dealer behavior)
In this section the book introduces a utility function given by U(W ) = eW where W is a
2
random variable with a normal distribution W N (W , W ). Given this setup we can find
the expectation of U(W ) using the definition of expectation as
!
Z (W W )2
W 1 21 2
E[U(W )] = (e ) e
W dW
2W
Z
1 1 2 2
= exp W 2 (W 2W W + W ) dW
2W 2W
2W
2 2
e 1 W
Z
W
= exp W 2
W2 + 2 W dW
2W 2W W
2W
2 2
e 1
Z
W
2 2
= exp 2 W 2(W W )W dW
2W 2W
2W
2 2
e 1
Z
W
2 2 2 2
= exp 2 (W (W W )) (W W ) dW
2W 2W
2
W (W W2 )2
+
2 2 2 2
e
Z 1
W W 2 W2
= e 2W dW
2W
2W 2
)2
(W W 1 2 2
= exp 2 + 2
= exp W + W , (99)
2W 2W 2
when we simplify the argument. Thus to maximize the functional form for E[U(W )] we can
minimize the argument of the exponential or maximize its negative value which is
1
W 2 W
2
.
2
Since is a positive constant we could divide by it and the resulting expression is called
certainty equivalent or CE given by
2 1 2
CE(W , W ) W W . (100)
2
Note that for a general portfolio the CE is a function of its two arguments the portfolios
2
mean W and variance W .
To the dealer to be indifferent as to whether his bid gets hit we must have CE equal in each
of these cases. This gives
CE(nX , n2 X
2
) = CE((n + 1)X B, (n + 1)2 X
2
).
If our portfolio initially starts out as W = n(X P ) then via Equation 100 the certainty
equivalent of this portfolio (P is constant) is given by
2 2 2
CE(W , W ) = CE(n(X P ), n2X
2
) = n(X P ) n X .
2
To maximize the CE as a function of n we take the first derivative and set the result equal
to zero, and solve for n. We need to solve
2 X P
X P nX = 0 or n = 2
.
X
49
When we equate these two expressions for the certainty equivalent and solve for B1 we find
B1 = 1 0 X 2 1 0 n1 n2 + 1 0 1 0 .
2
12
1 2
If is given by then the inner products in the above expression are
1 2 22
computed as
2 n1
= 12 n1 + 1 2 n2
1 0 n1 n2 = 1 1 2
n2
1 0 1 0 = 12 .
If we next consider the case where the dealer can trade some amount
of the
first security at
a prices P (here a vector) then the portfolio is given by W = n1 n2 (X P ) and we
have a certainty equivalent given by
n1 n2 (X P ) n1 n2 n1 n2 .
2
To minimize this with respect to the vector n1 n2 we take the derivative to get
n1
X P .
n2
If we put the expressions for n1 and n2 just computed into Equation 102 (in the Mathematical
file simplify dealer starting at optimum.nb) we find
2
B1 = 2P1 1 .
2 1
Note that this is different than the expression that the book has. If anyone sees anything
wrong with what I have done please contact me.
50
0
1
neg_log_neg_EU_n_0
2
3
4
limit_prices
Figure 2: A duplication of Figure 12.1 from Chapter 12 in the book for n = 0, 1, 2. The
maximization of the expected utility depends on the number of shares currently held n.
With the definitions given and assumed in this chapter for a limit order placed at L an
exponential utility of U(W ) = eW , and the normal distribution approximation for wealth
distribution W we can derive the expected utility given that the limit order might or might
(hit) not get executed (not hit or the base case) to get
For the the specific numbers given in the book = 1, X = 1, etc. we get for EULimit (L)
the following expression
1 2 1 2
EULimit (L) = (1 eL )(e(n+1L)+ 2 (n+1) ) + eL (en+ 2 n ) .
We can take the negative of this expression, the logarithm, and the negative again and plot
this for n = 0, n = 1, and n = 2. When we do that in chap 12 plot EU.R we get the
plot given in Figure 2. This plot matches well with the one given in the book.
51
If the customer enters a market order to buy then his expected utility is given by
1 2
EUMarket = e(n+1A)+ 2 (n+1) .
1 2
We set this equal to EUBase = en+ 2 n or the expected utility of doing nothing and solve
for A to determine when the market order is preferred. We find that there is no preference
between a market order and doing nothing when A = n + 12 . Thus if n = 1 we get A = 23 .
If A < 23 the customer would prefer a market order and if A > 23 the customer would prefer
to do nothing.
52
Chapter 13 (Depth)
Recall that R(q) is the required capital expenditure to purchase q shares of our stock. The
reason it is a function of q is that the customer might have to trade into the book at poorer
prices to get all the desired shares. If the customer takes these trades his terminal wealth is
given by
W = (n + q)X R(q) ,
since he ends the transaction with q more share of stock (with terminal value X) and pays
R(q) to get them. For the customer to act optimally he must seek to maximize his expected
utility of his final wealth W or
EU(W ) = E[eW ] .
2
For an expected utility of this form we must maximize the certainty equivalent CE(W , W ),
where using Equation 100 is given by
2 1 2 1
CE(W , W ) W W = ((n + q)X R(q)) (n + q)2 X
2
.
2 2
The optimal customer will want to maximize this with respect to q. To do this, we take the
derivative with respect to q and set the result equal to zero to get
X R (q) (n + q)X
2
= 0. (103)
If the customer has a noisy signal that indicates his belief in the final price say S = X +
with N (0, 2). Then using Equation 34 since S2 = X2
+ 2 and XS = X 2
we have that
2
XS X X 2 + SX 2
X|S = X + (S X ) = X + (S X ) = . (104)
S2 2
X + 2 X2
+ 2
2
Using Equation 36 we have that X|S is given by
2 4 2 2
2 2 XS 2 X X
X|S = X 2 = X 2 2
= 2 2. (105)
S X + X +
By moving terms across the equal sign we can write Equation 103 with M R (q) as
2 2
M + qX = X nX .
In the case that the customer thinks they have information on the final stock price X (from
their signal S) we replace the above mean and variances with the conditional expressions to
get
2 2
M + qX|S = X|S nX|S . (106)
53
2
Denote the right-hand-side of this as . Then replacing X|S and X|S with what they are
given by from Equations 104 and 105 we get
X 2 + SX 2
2 X
2
= 2
n 2
2 + X 2 + X
X 2 + X2
(S n2 ) X 2 + X
2
(X + n2 )
= 2
= 2
. (107)
2 + X 2 + X
In the above expression X, , and n are random variables. Thus the measurement of
should give us information on the value of the variables and in particular on X. To use
Equations 34 and 36 we take expectation of both sides to get
2 X + X
2
(X 2 E[n])
= E[] = 2
= X ,
2 + X
,X = E[( )(X X )]
X 2 + X
2
(X + n2 ) X (2 + X
2
)
=E 2
(X X )
2 + X
4
1 2 2 2 2
X
= 2 2
E (X (X X ) + X n
X )(X X ) = 2
. (109)
+ X 2 + X
Using these two expressions we can now compute the expected value of X given from
Equations 34 as
,X
E[X|] = X + 2 ( X ) .
54
and
2
,X 2
X|S ,X 2 2
X
k1 = 2 (2k1 + + X|S ) k1 = = 2
, (112)
2 2,X 2 2 4
n X 2
For the price schedule P (q) to be upward sloping i.e. P (q) > 0 we must have k1 > 0 or the
denominator of Equation 112 nonnegative. Thus
2 n2 2 X
2
2 > 0 .
Using this inequality (if needed) and Equation 112 we can derive other relationships on k1
by taking the derivatives suggested in the book. We find
2
k1 increases with X since
k1 2 X2 2
2
= 2
+ 2
> 0,
X 2 n2 4 X 2 (2 n2 4 X 2 )2
when we simplify.
k1 3 X
2 6
2
= 2 2 4 2
< 0.
n ( n X 2 )2
k1 2 2 2 2
X (2n2 2 )
= 2 2 4 X 2 2
n X 2 (2 n2 4 X 2 )2
2 X2 2 4 4 2
n X X2 4
= 2 2 4 2 2 2
< 0,
( n X )
55
Chapter 14 (Trading Costs: Retrospective and Compar-
ative)
In the definition of the implementation shortfall we assume that we currently hold an existing
portfolio (this could be all cash) and desire to obtain a different portfolio for some reason.
The desired portfolio is then expressed to a broker who will attempt to obtain that portfolio
in a certain manner. The person or company tasked with this job may or may not succeed
in getting all of the shares desired because the order was so large that it exhausted all of
the shares available. In fact, they may get the desired shares but due to significant market
impact have poor execution prices. The implementation shortfall is designed to measure the
loss associated with not getting the complete desired portfolio and how poor the price paid
was in terms of some standard prices. As such, we define several variables
n0 a vector of the initial portfolio holdings (in shares). The first component of which
is the cash dollar amount.
0 is a vector of initial benchmark prices of each of the stocks in our universe.
v is a vector of the desired position (in shares). Again the first component of this
vector represents cash.
1 is a vector of final benchmark prices. Notionally, these are prices that we hope
we can execute our trades at. Executions at prices worse than these prices will be
considered poor performance. Candidates for this price, might be the closing price or
the volume weighted average price (VWAP).
As discussed above and in the book the trades that actually get executed can be different
than what was desired. To define what in fact was executed (and at what price) we introduce
the variables
n1 the portfolio we actually end with where n1 6= v normally due to possibly failed
limit orders or missing liquidity.
p are the actual trading prices where trades were executed at. This price will include
market impact due to large trading orders.
Based on these variables we will have several constraints. We assume that the initial portfolio
value equals the end desired portfolio value at the initial prices or
n0 0 = v 0 .
56
Since all trading takes place at the prices p and we dont put any cash into the transactions
the portfolio we start with (at price p) must equal the one we end with (at price p) or
n0 p = n1 p .
In the case where v = n0 or that the agent already has his desired position then from
Equation 113 the implementation shortfall is given by
since n1 p = n0 p.
57
Chapter 15 (Prospective Trading Costs and Execution
Strategies)
In this section, we assume that the model of midquote (fair price) dynamics, when we trade
st shares, is given by
mt = mt1 + + st + t . (115)
Here is the drift of the security. The variable > 0 is the market impact coefficient which
affects how the market adjusts the fair price mt due to our trading. When we submit an
order for st shares, the trade price is assumed to follow (for the models in this section)
pt = mt + st . (116)
At the timestep t we will submit orders to trade st shares and desire to trade a total of s
shares.
PTThe constraint between each order of st and the total desired order s is then that
s = t=1 st . The problem we attempt to solve is to find an optimal way to split our total
order up into pieces under the constraint above. Optimal in this case means that we want
to pay the smallest expected cost for our total of s shares. That is our problem is to find
the order sizes s1 , s2 , sT 1 , sT to
" T #
X
min Et pt st . (117)
s1 ,s2 , ,sT 1 ,sT
t=1
If we assume that st can be determined before the period of trading and is predetermined
we can pass the expectation into the summation to get
T
X
min st Et [pt ] .
s1 ,s2 , ,sT 1 ,sT
t=1
From our trade price assumption given in Equation 116 we have that E[pt ] = E[mt ] + st ,
thus we now need to evaluate E[mt ]. To do this note that we can write mt using Equation 115
over and over as
m1 = m0 + + s1 + 1 so
2
X 2
X
m2 = m1 + + s2 + 2 = m0 + 2 + si + i
i=1 i=1
3
X 3
X
m3 = m0 + 3 + si + i
i=1 i=1
..
.
t
X t
X
mt = m0 + t + si + i .
i=1 i=1
58
Using this last expression we compute that
t
X
E[mt ] = m0 + t + si .
i=1
Define the objective function in the above optimization problem as S (for summation). If
T = 3 then the summation expression above becomes
S = s1 ( + s1 + s1 ) + s2 (2 + (s1 + s2 ) + s2 ) + s3 (3 + (s1 + s2 + s3 ) + s3 )
= (s1 + 2s2 + 3s3 ) + (s21 + s22 + s23 ) + (s21 + s22 + s23 + s1 s2 + s1 s3 + s2 s3 ) .
If = 0 then each of the unknowns s1 , s2 , and s3 appear in the same manner i.e. no sj has
any stronger influence over the value of the objective function than any other and we expect
sj to be the same for each value of j. Note that this is not true if 6= 0. For example when
T = 3 when 6= 0 our optimization objective has the term
(s1 + 2s2 + 3s3 ) ,
which gives more weight to s3 relative to s1 and s2 (due to the coefficient
PTof 3). Under the
assumption that s1 = s2 = s3 = = sT 1 = sT = s then to make s = t=1 st with st = s
means that our optimal solution is st = Ts .
In the case of the problem describe we need to find s1 , s2 , s3 to solve the optimization problem
given by Equation 117. Under the assumed midquote dynamics of mt = mt1 + t st + t and
trade price pt = mt this simplifies to
" 3 #
X
min Et p t st = min Et [m1 s1 + m2 s2 + m3 s3 ]
s1 ,s2 ,s3 s1 ,s2 ,s3
t=1
= min Et [(m0 + 1 s1 + 1 )s1 + (m1 + 2 s2 + 2 )s2 + (m2 + 3 s3 + 3 )s3 ]
s1 ,s2 ,s3
59
Since s1 +s2 +s3 = 1 the terms with m0 dont affect the optimization (as they are independent
of si ) and using the fact that Et i = 0 for i = 1, 2, 3 we find we want to minimize an expression
like
1 s21 + 1 s1 s2 + 2 s22 + 1 s1 s3 + 2 s2 s3 + 3 s23 ,
still subject to the constraint that s1 + s2 + s3 = 1. To solve this problem we will introduce
Lagrange multipliers by first forming our Lagrangian L
The introduced Lagrangian multiplier parameter, , is not related to the market impact
parameters i for i = 1, 2, 3. Then with this definition of L to optimize we require solving
the partial derivatives of L with respect to s1 , s2 , s3 , and all set equal to zero or the
equations
L
= 21 s1 + 1 s2 + 1 s3 = 0
s1
L
= 1 s1 + 22 s2 + 2 s3 = 0
s2
L
= 1 s1 + 2 s2 + 23 s3 = 0
s3
L
= (s1 + s2 + s3 1) = 0 .
Solving these four equations for s1 , s2 , s3 , and gives the expressions quoted.
60