Frist of the gamma determines the risk aversion of the investor. $R(U) = -\frac{U^{\prime\prime}}{U^\prime}(W)$. The utility function is for the total wealth. When he is holding cash/bond vs stock. The stock has a distribution, the expected utility of the total wealth is being maximized.
Grossman, Miller (1998) is an interesting paper. The paper focusses on Market makers risk and cost of providing liquidity. This is not an inventory risk based model. The cost for the market maker to provide immediacy is based on maximizing utility over an expected evolution of price. The price evolves exogenously. There is no notion of a mid price or a fair value. The question is mostly of providing immediacy of execution and associated risk.
The Model:
The model is very straight forward. There are two kinds of participants,
- Market makers provide immediacy of execution at a price.
- Traders arrive asynchronously and cause imbalance that is addressed by the market maker.
The functioning of the market is modeled as a sequence of imbalance events that the market maker alleviates by taking the other side. In doing so, the market maker takes on risk till the next period. The risk is held for one period.
Traded Assets
The market facilitates trading a risky asset. The investor has the option of either trading the risky asset or holding cash. All strategies are self financing.
Trading Times
At the start of period one, an investor comes in and creates an imbalance due to his demand for the risky asset. The market maker steps in and facilitates the trade. At time period $2$ an investor comes in with an opposing net demand creating. The market maker facilitates the trade unwinding his accumulated inventory. There is a period $3$, whose purpose it is to determine the price of the asset. The price innovation is dictated by news arriving at periods $1$ and $2$. The prices are assumed to be normally distributed.
Optimization
Each participant is optimizing against the expected price evolution of at period $3$. The information of price evolution arrives prior to trading at $1$ and $2$. The optimization is against current available information set.
The Liquidity Conondrum
The investor trades a quantity to optimize his utility. The investor re-balances his position between cash and risk asset to maximize his utility. Let $\overline{x}_t$ be the quantities of the risky asset that the investor holds after the trade at time $t$, and $B_t$ be the cash holding at time $t$. The wealth at the different periods are as follows.
\begin{align}
W_3 &= B_3 + \overline{P}_3 \overline{x}_3 = B_2 + \overline{P}_3 \overline{x}_2\\
W_2 &= B_2 + \overline{P}_2 \overline{x}_2= B_1 + \overline{P}_2 \overline{x_1}\\
W_1 &= B_1 + \overline{P}_1 \overline{x}_1 = W_0 + \overline{P_1} i_1
\end{align}
Now things get bit interesting. We start with the investor endowment (initial position) of $i_1$. The investor has the option of waiting or trading immediately. We denote $x_t = \overline{x}_t - i_1$ as the excess demand at any given time $t$. This makes sense, if post trade his position is higher the demand is positive, else it is negative. Buy or sell is essentially the demand being positive or negative.
\begin{align}
W_3 &= B_1 + \overline{P}_2 \overline{x}_1 - \overline{P}_2 \overline{x}_2 + \overline{P}_3 \overline{x}_2 \\
W_3 &= W_0 + \overline{P}_1 i_1 - \overline{P}_1 \overline{x}_1 + \overline{P}_2 \overline{x}_1 - \overline{P}_2 \overline{x}_2 + \overline{P}_3 \overline{x}_2
\end{align}
A few comments are in order, note that $i =\overline{x}_1 - i_1$ is the imbalance at period $1$. The quantity, $\overline{x}_2 - \overline{x}_1$ is the imbalance at period 2. Our assumption is that these imbalances are the same. We will now look at optimization at time $3$. We will use backward induction to facilitate the optimization process.
\begin{align}
W_3 = B_2 + \overline{P}_3 \overline{x}_2 = W_2 - \overline{P}_2 \overline{x}_2 + \overline{P}_3 \overline{x}_2
\end{align}
We assume a utility function $U(W) = -a e^{-aW}$, If $W$ is assumed to have a Gaussian Distribution, $N(\mu, \sigma^2)$, then $E[-a e^{-aW}]= e^{a\left(\frac{a\sigma^2 - 2 \mu }{2}\right)}$. Assuming the conditional distribution of $\overline{P}_3$ is Gaussian $N(E[\overline{P}_3 | \mathcal{F_2}], var[\overline{P}_3 | \mathcal{F_2}])$, we have.
\begin{align}
W_3 = N(W_2 - \overline{P_2} \overline{x}_2 + \overline{x}_2 E[\overline{P}_3 | \mathcal{F_2}], \overline{x}_2^2 var[\overline{P}_3 | \mathcal{F_2}]) \\
E[-ae^{a W_3}] = e^{a \left( \frac{a \overline{x}_2^2 var[\overline{P}_3 | \mathcal{F_2}] - 2(W_2 - \overline{P_2} \overline{x}_2 + \overline{x}_2 E[\overline{P}_3 | \mathcal{F_2}])} {2}\right)} \\
\end{align}
Maximizing the expected value w.r.e $\overline{x}_2$ we have,
\begin{align}
&\frac{d E[W_3]}{d \overline{x}_2} = a E[-ae^{a W_3}] \left[ a \overline{x}_2 \ var[\overline{P}_3 | \mathcal{F_2}] + \overline{P}_2 - E[\overline{P}_3 | \mathcal{F_2}]\right] = 0 \\
&\overline{x}_2 = \frac{E[\overline{P}_3 | \mathcal{F_2}] - \overline{P}_2}{a \ var[\overline{P}_3 | \mathcal{F_2}]}
\end{align}
Now the question is whether in period $2$ the imbalance was a buy or a sell. In our case we have chosen the imbalance to be a buy, so we have $\overline{x}_2 = x_2 + i$. The position at time $2$ is therefore given by,
\begin{align}
x_2 = \frac{E[\overline{P}_3 | \mathcal{F_2}] - \overline{P}_2}{a \ var[\overline{P}_3 | \mathcal{F_2}]} - i
\end{align}
Similarly, we now optimize at time period $1$. The investor optimizes his wealth $W_2$.
\begin{align}
W_2 = W_0 + \overline{P}_1 ( i_1 - \overline{x}_1) + \overline{P}_2 \overline{x}_1
\end{align}
As before we assume a normal distribution for $\overline{P}_2 = N(E[\overline{P}_2|\mathcal{F}_1], \ var[\overline{P}_2|\mathcal{F}_1])$. In this case $x_1 = \overline{x}_1 - i$, As before, we see that,
\begin{align}
x_1 = \frac{E[P_2|\mathcal{F}_1] - \overline{P}_1}{a \ var[\overline{P}_2 | \mathcal{F}_1]} - i
\end{align}
The Market Maker
The market maker just facilitates the trades. He has no endowment to start with so his wealth eqations look identical to the investor. However, his initial endowment is zero. He does not start with any initial position. This is akin to a trader that liquidates his positions at the end of the day and starts afresh the following day. The optimized quantity therefore is the same as the investor except there is no $i$. Essentially the market makers quanity are,
\begin{align}
x_2^m = \frac{E[\overline{P}_3 | \mathcal{F_2}] - \overline{P}_2}{a \ var[\overline{P}_3 | \mathcal{F_2}]} \\
x_1^m = \frac{E[P_2|\mathcal{F}_1] - \overline{P}_1}{a \ var[\overline{P}_2 | \mathcal{F}_1]}
\end{align}
\section{To Wait or Not To Wait}
The question is whether to wait or go for immediacy. If we wait a period and match at time $2$. We have the following at time $2$. Since the demands in the two periods are opposite of each other we have,
\begin{align}
\frac{E[\overline{P}_3 | \mathcal{F_2}] - \overline{P}_2}{a \ var[\overline{P}_3 | \mathcal{F_2}]} - i + \frac{E[\overline{P}_3 | \mathcal{F_2}] - \overline{P}_2}{a \ var[\overline{P}_3 | \mathcal{F_2}]} + i + M \frac{E[\overline{P}_3 | \mathcal{F_2}] - \overline{P}_2}{a \ var[\overline{P}_3 | \mathcal{F_2}]} = 0 \label{period_2_equillibrium}
\end{align}
Where, $M$ is the number of market makers, and $\frac{E[\overline{P}_3 | \mathcal{F_2}] - \overline{P}_2}{a \ var[\overline{P}_3 | \mathcal{F_2}]} $ is the market maker optimized quantity.
\begin{align}
(M + 2) \frac{E[\overline{P}_3 | \mathcal{F_2}] - \overline{P}_2}{a \ var[\overline{P}_3 | \mathcal{F_2}]} = 0 \Rightarrow E[\overline{P}_3 | \mathcal{F_2}] - \overline{P}_2 = 0 \Rightarrow \\
E[\overline{P}_3 | \mathcal{F_2}] = \overline{P}_2
\end{align}
The above analysis tells that if the investor waits to execute then the market maker quantity is really $0$. The other interesting fact is that the \underline{price evolution is a martingale}.
\section{The cost of immediacy.}
If the investor wants immediate execution, his excess demand $x_t$ has to be compensated by the market maker. Hence we have the following.
\begin{align}
\frac{E[\overline{P}_2|\mathcal{F}_1] - P_1}{a \ var[\overline{P}_2 | \mathcal{F}_1]} - i + M \frac{E[P_2|\mathcal{F}_1] - P_1}{a \ var[\overline{P}_2 | \mathcal{F}_1]} = 0 \\
\frac{E[\overline{P}_2|\mathcal{F}_1] - P_1}{a \ var[\overline{P}_2 | \mathcal{F}_1]}= \frac{i}{M + 1}\\
E[P_2 | \mathcal{F}_1] = P_1 + a \frac{i}{M + 1} \ var[\overline{P}_2 | \mathcal{F}_1] \label{the_final_result}
\end{align}
The result \eqref{the_final_result} seems counter intuitive. The expected value of future price evolution is depends on the initial endowment of the investor. The price you pay for immediacy is $P_1 = E[\overline{P}_2 | \mathcal{F}] - a \frac{i}{M + 1} \ var[\overline{P}_2 | \mathcal{F}_1]$. \ul{Essentially, the equation is telling us that, if the market maker is selling his position to you, (you are buying $(i > 0)$) you pay a lower price.} \ul{If you are selling to the market maker, you pay a higher price relative to expected value in the next period. Essentially, buys increase the future expected price, sells reduce the future expected price}. What is bizzare is that one would think the market maker would charge a price for going either way on the trade. What we see here is mostly a constraint on the future price innovation as a result of market making. So if you want to sell, you will sell at a price higher than the expected evolution of the price, and if you want to buy you pay a lower price than the evolution. Essentially buys push the price higher and sells push the price lower.
\subsection{The Quantities Held}
The investor coming in to trade at time $1$, does not sell his entire quantity. The equillibrium relation between period $1$ and $2$ quantities is as follows,\footnote{The super script I and M indicate the investor and market maker.}
\begin{align}
q_1^I + q_1^M = q_2^I + q_2^M
\end{align}
The investor comes in at time $1$ with a quantity $i$, the market maker quantity is $0$. If we assume that they are all optimizing the same utility, we have them taking equal amounts of risk to the next stage. They will all hold the same quantity at time $2$. We will then have,
\begin{align}
i = q_2 + M q_2 \Rightarrow q_2 = \frac{i}{M + 1}
\end{align}
If our market participants had different risk aversions, we would have at time two the quantities held by the investor (the optimised value),
\begin{align}
q_2^I = \frac{E[\overline{P}_2|\mathcal{F}_1] - P_1}{a_I \ var[\overline{P}_2 | \mathcal{F}_1]} = \frac{q_0}{a_I}
\end{align}
Similarly, the individual market makers have the quantities,
\begin{align}
q_{2,i}^M = \frac{E[\overline{P}_2|\mathcal{F}_1] - P_1}{a^M_i \ var[\overline{P}_2 | \mathcal{F}_1]} = \frac{q_0}{a^M_i}
\end{align}
Substituting back into our equations we have,
$$q_0 = \frac{i}{ \frac{1}{a_I} + \sum_j \frac{1}{a_j^M} }.$$
\ul{Note that in the real market we observe the excess demand. We do not know the actual quantities held by the individual participants}.
\section{Market Maker Incentive to Participate}
The model assumes the presence of multiple market makers. Market makers will participate, if and only if the opportunity cost of investing elsewhere is similar to participating in the market. The market structure and fees will dictate the incentives for participation. If $c$ is the opportunity cost elsewhere. The market maker expects to make $(\overline{P}_2 - \overline{P}_1) x^1_m$. This because, if the investor waits to trade, the market maker quantity is $0$ in the second period. In this three period model, the market maker either participate or he does not. Depending on the fee structure and market structure, a market can only support a certain level of market maker participation and hence liquidity. \
\
The market maker starts with a wealth of $W_0$, and has an opportunity to make $(\overline{P}_2 - \overline{P}_1) x^1_m$, he has a sunk cost of $c$. He will participate if and only if the utility of participating is at least as much as not participating. Letting $i$ be a normally distributed random variable uncorrelated to the price evolution, we have.
\begin{align}
E[U(W_0 - c + (\overline{P}_2 - \overline{P}_1) x^1_m)] = E[U(W_0)]\\
e^{\frac{a \left( a (x^1_m)^2 \ var[\overline{P}_2|\mathcal{F}_1] - 2 (W_0 - c + x^1_m E[\overline{P}_2 | \mathbb{F}_1]) - \overline{P}_1 x^1_m\right)}{2}} &= e^{-a W_o} \\
e^{ac} e^{\frac{a \left( a (x^1_m)^2 \ var[\overline{P}_2|\mathcal{F}_1] - 2 x^1_m( E[\overline{P}_2 | \mathbb{F}_1] -\overline{P}_1 ) \right)}{2}} &=1 \\
e^{ac} e^{\frac{a \left( a (x^1_m)^2 \ var[\overline{P}_2|\mathcal{F}_1] - 2 x^1_m a x^1_m var[\overline{P}_2|\mathcal{F}_1] \right)}{2}} &=1 \\
e^{ac} e^{-\frac{a^2}{2} \left(\frac{i}{M+1}\right)^2 var[\overline{P}_2|\mathcal{F}_1]} &= 1
\end{align}
Note that in the above, we really cannot just take expectation. The reason is, $i$ is a random variable. The correct analysis is as below.
\begin{align}
E[U(W_0 - c + (\overline{P}_2 - \overline{P}_1) x^1_m)] &= E[U(W_0)]\\
E[e^{-a(W_0 - c + (\overline{P}_2 - \overline{P}_1) x^1_m)}] &= e^{-a W_0}
\end{align}
Since $W_0$ is non-random and $\overline{P}_2$ is independent of $i$ and $x^1_m$,
\begin{align}
E[e^{ac - a(\overline{P}_2 - \overline{P}_1) x^1_m }] = 1 \\
e^{ac} E[e^{- a(\overline{P}_2 - \overline{P}_1) x^1_m }]= 1
\end{align}
We observe that since the variable $i$ and $\overline{P}_2$ are independent, We take the expectation against the variable $\overline{P}_2$ first and then $i$. So essentially, what we should do is retain the expectation in the earlier derivation.
\begin{align}
e^{ac}E[ e^{\frac{a \left( a (x^1_m)^2 \ var[\overline{P}_2|\mathcal{F}_1] - 2 x^1_m( E[\overline{P}_2 | \mathbb{F}_1] -\overline{P}_1 ) \right)}{2}} ]&=1 \\
e^{ac} E[e^{\frac{a \left( a (x^1_m)^2 \ var[\overline{P}_2|\mathcal{F}_1] - 2 x^1_m a x^1_m var[\overline{P}_2|\mathcal{F}_1] \right)}{2}} ]&=1 \\
e^{ac} E[e^{-\frac{a^2}{2} \left(\frac{i}{M+1}\right)^2 var[\overline{P}_2|\mathcal{F}_1]} ] &= 1
\end{align}
Now here is where things get tricky, we have square of a Gaussian Random Variable. The distribution of the square is essentially a \textbf{Chi-Square} distribution. I really do not want to work through the calculations. The calculations are simpler than I thought. The moment generating function for a \textbf{Chi-Square} distribution is,
\begin{align}
M_f(t) = e^{\frac{\lambda t}{1-2t}}{(1- 2t)^{k/2}}
\end{align}
Where $\lambda= \sum_1^k E[x]^2$, $k$ is the number of degrees of freedom. In our case the number of degrees of freedom is $1$. That gives us $\lambda = E[i]$. Now it is a matter of transforming the value inside the expectation to something that looks like a moment generating function. Here is the trick, let
\begin{align}
&\frac{a^2}{(M+1)^2} \ var[\overline{P}_2 | \mathcal{F}_1] \ var[i] = t \\
&z^2 = \frac{i^2}{var[i]}
\end{align}
Substituting into our expectation we have,
\begin{align}
E[e^{-\frac{a^2}{2} \left(\frac{i}{M+1}\right)^2 var[\overline{P}_2|\mathcal{F}_1]} ] = e^{-ac} \\
E[e^{-\frac{t}{2}} z^2] = e^{-ac}
\end{align}
Comparing with the moment function we have,
\begin{align}
e^{-E[i]^2 \frac{t}{2 ( 1+ t)} }\frac{1} {\sqrt{1 + t}} = e^{-ac}
\end{align}
Given that $E[i] = 0$, we have.
\begin{align}
\frac{1}{\sqrt{1 + t}} = e^{-ac} \\
\frac{1}{\sqrt{1 + \frac{k}{(M+1)^2}}} = e^{-ac} \\
\frac{k}{(M+1)^2} = e^{2ac} - 1 \\
M = \sqrt{\frac{k}{e^{2ac} - 1}} - 1
\end{align}
The last relations establishes an inverse relation between number of market makers and cost. If the cost of participation is high then the number of market makers goes down.
\section{The Covariance of Price Changes}
We denote $\Delta P_t = P_t - P_{t-1}$, and $P_0 = E_0[P_1]$. We define the covariance as,
$\frac{cov(\Delta P_2,\Delta P_1)}{\sqrt{var(\Delta P_2) var(\Delta P_1)}}$.
\begin{align}
cov(\Delta P_2,\Delta P_1) = E(\Delta P_2 \Delta P_1) - E[\Delta P_2] E[\Delta P_1] \\
\end{align}
We use the following relationships, (note that overline implies a random value for prices) $P_2 = E[\overline{P}_3 | \mathcal{F}_2]$, $E[\overline{P}_1 | \mathcal{F}_0] = E[\overline{P}_2 | \mathcal{F}_0]$ and $E[\overline{P}_2 | \mathcal{F}_1] = E[\overline{P}_3 | \mathcal{F}_1]$. This conditioning essentially claims that, our future expected value of the stock price is the same from a given instant of time. Essentially, when we are at time zero, our expected value for the price at times $\{1,2,3\}$, is the same. These look more like constraints than out of some motivation of a specific stochastic process for price evolution.
\begin{align}
\Delta P_2 = P_2 - P_1 = P_2 - E[\overline{P}_2 | \mathcal{F}_1] + a \frac{i}{M+1} \ var[\overline{P}_2 | \mathcal{F}_1] \\
\Delta P_1 = P_1 - E_0[P_1] = E[\overline{P}_2| \mathcal{F}_1] - a \frac{i}{M+1} \ var[\overline{P}_2 | \mathcal{F}_1] - E[P_1 | \mathcal{F}_0]
\end{align}
The price evolution is due to news that cause independent shocks. This implies that shocks, $P_2 - E[\overline{P}_2 | \mathcal{F}_1]$ and $E[\overline{P}_2|\mathcal{F}_1] - E[P_1 | \mathcal{F}_0]$ are independent of each other. This follows from the fact that, the price at time $0$ is really not known, so $P_0 = E[\overline{P}_3 | \mathcal{F}_0]$, $P_1 = E[\overline{P}_3 | \mathcal{F}_1]$, $P_2 = E[\overline{P}_3 | \mathcal{F_2}]$ and $P_3 = \overline{P}_3$. The differences $\epsilon_2 = P_2 - E[\overline{P}_2 | \mathcal{F}_1]$ and $\epsilon_1 = E[\overline{P}_2 | \mathcal{F}_1] - E[\overline{P}_1 | \mathcal{F}_0]$ are independent. They are essentially Gaussian shocks $\epsilon_i = N(0, \sigma^2)$. The covariance essentially boils down to,
\begin{align}
cov(\Delta P_2, \Delta P_1) = &E[\Delta P_2, \Delta P_1] - E[\Delta P2] E[\Delta P_1] \\
=& E\left[ \left(\epsilon_2 + a \frac{i}{M+1} var[\overline{P}_2|\mathcal{F}_1] \right) \left(\epsilon_1 - a \frac{i}{M+1} var[\overline{P}_2|\mathcal{F}_1] \right) \right] - \\
& E\left[\left(\epsilon_2 + a \frac{i}{M+1} var[\overline{P}_2|\mathcal{F}_1] \right) \right]E\left[ \left(\epsilon_1 - a \frac{i}{M+1} var[\overline{P}_2|\mathcal{F}_1] \right) \right] \\
=&E\left[-a^2 \frac{var[P_2|\mathcal{F}_1]^2}{(M + 1)^2} i^2 \right] + E\left[a \frac{var[P_2|\mathcal{F}_1]}{M+1} i\right] E\left[a \frac{var[\overline{P_2}|\mathcal{F}_1]}{M+1} i\right] \\
=&-a^2 \frac{var[P_2|\mathcal{F}_1]^2}{(M + 1)^2} \left[E[i^2] - E^2[i]\right] \\
=&-a^2 \frac{var[P_2|\mathcal{F}_1]^2}{(M + 1)^2} \ var[i]
\end{align}
The derivations were a bit difficult, the main reason was the mis-understanding of the meaning of terms and how this entire process works. The main idea to be understood is that of shocks as random i.i.d variables. Careful look at what the derivation and the terms of derivation. Here it clearly was in terms of $var [i]$, it was not in terms of variance of the prices. The difference in prices across times are just random IID shocks. This latter idea needs to be understood clearly. The increments are independent. By increment it is the incremental change. This is true of Brownian Motion. Essentially this is where we get the Brownian motion model for stocks. Martingale, this is important to observe as well. The intraday prices are modeled as Martingales. The reason being, betting on it you do not expect to make money.
\section{Transaction Charges}
If a market venue imposes a cost on every participant in the form of fees. We can account for it as well.