Market MicrostructureMarket MakingAdverse SelectionStochastic ControlAvellaneda-Stoikov

Adverse Selection and Inventory Models

Module 2 of 428 min readLevel: Hard

Setup

The Market Making Problem

A market maker simultaneously posts a bid and an ask, collecting the spread on each round-trip trade. The business model is simple in principle: buy low (bid), sell high (ask), pocket the half-spread on each side. In practice, the market maker faces two fundamental risks:

  1. Adverse selection: informed counterparties trade against the market maker only when the posted price is wrong. The market maker buys at the bid just before the price falls, or sells at the ask just before the price rises.

  2. Inventory risk: continuous order flow is unbalanced. The market maker accumulates net directional positions that must be unwound at cost, and that generate P&L variance proportional to the position squared times the volatility.

This module covers two foundational models: the Glosten-Milgrom (1985) model of the bid-ask spread from adverse selection, and the Avellaneda-Stoikov (2008) stochastic control model of optimal market making under inventory risk.

Conventions and Assumptions

  • Mid-price: StS_t, modelled as a Brownian motion: dSt=σdWtdS_t = \sigma\, dW_t (zero drift under the market maker's view).
  • Inventory: qtZq_t \in \mathbb{Z}, the signed position in shares (positive = long, negative = short).
  • Bid and ask quotes: Ptb=StδbP_t^b = S_t - \delta^b and Pta=St+δaP_t^a = S_t + \delta^a, where δb,δa>0\delta^b, \delta^a > 0 are the half-spreads on each side.
  • Order arrivals: Poisson processes with intensity depending on the posted spread: λb(δb)\lambda^b(\delta^b) for buy orders hitting the bid, λa(δa)\lambda^a(\delta^a) for sell orders lifting the ask.
  • Finite horizon: the market maker operates over [0,T][0, T] and liquidates at t=Tt = T at the mid-price with a terminal inventory penalty.
  • Volatility σ\sigma and time horizon TT: annualised; σ=0.010.30\sigma = 0.01\text{–}0.30 for typical equities.

Glosten-Milgrom Model

Setup

Glosten and Milgrom (1985) model a competitive dealer who sets bid and ask quotes to break even in expectation against a mixture of informed and uninformed traders.

Assumptions:

  • True asset value: V{VL,VH}V \in \{V_L, V_H\} with prior probability Pr[V=VH]=μ0\Pr[V = V_H] = \mu_0.
  • Fraction π(0,1)\pi \in (0,1) of traders are informed: they know VV and trade to profit.
  • Fraction 1π1 - \pi are uninformed (liquidity) traders: they buy or sell with equal probability 1/21/2, independently of VV.
  • Trades arrive one at a time. The dealer observes the trade direction (buy or sell) but not the trader type.

Bayesian Updating

After observing a buy order, the dealer updates their belief μt=Pr[V=VHhistory]\mu_t = \Pr[V = V_H \mid \text{history}]:

μt+=Pr[V=VHbuy]=μtPr[buyVH]Pr[buy],\mu_t^+ = \Pr[V = V_H \mid \text{buy}] = \frac{\mu_t \cdot \Pr[\text{buy} \mid V_H]}{\Pr[\text{buy}]},

where:

  • Pr[buyVH]=π1+(1π)12=1+π2\Pr[\text{buy} \mid V_H] = \pi \cdot 1 + (1-\pi) \cdot \frac{1}{2} = \frac{1 + \pi}{2} (informed always buys when V=VHV = V_H; uninformed buys with prob 1/2).
  • Pr[buy]=μt1+π2+(1μt)1π2\Pr[\text{buy}] = \mu_t \cdot \frac{1+\pi}{2} + (1-\mu_t) \cdot \frac{1-\pi}{2}.

The posterior after a buy is μt+>μt\mu_t^+ > \mu_t — a buy order provides positive evidence that V=VHV = V_H. After a sell, μt<μt\mu_t^- < \mu_t.

Equilibrium Quotes

The dealer sets quotes to break even against the mixture of trader types. At each step, the competitive equilibrium requires:

Pta=E[Vbuy at t]=μt+VH+(1μt+)VL,P_t^a = \mathbb{E}[V \mid \text{buy at } t] = \mu_t^+ V_H + (1 - \mu_t^+) V_L,

Ptb=E[Vsell at t]=μtVH+(1μt)VL.P_t^b = \mathbb{E}[V \mid \text{sell at } t] = \mu_t^- V_H + (1 - \mu_t^-) V_L.

The bid-ask spread at time tt:

st=PtaPtb=(μt+μt)(VHVL).s_t = P_t^a - P_t^b = (\mu_t^+ - \mu_t^-)(V_H - V_L).

Key result: The spread is proportional to π(VHVL)\pi(V_H - V_L) — the product of the probability of informed trading and the magnitude of the information asymmetry. As trades occur and the dealer updates beliefs, the spread narrows: the posterior μt\mu_t converges to the true state, reducing uncertainty.

Price impact: Each trade causes the mid-quote to move. After a buy: the mid moves from μtVH+(1μt)VL\mu_t V_H + (1-\mu_t)V_L to μt+VH+(1μt+)VL\mu_t^+ V_H + (1-\mu_t^+)V_L. This is the permanent price impact — the dealer revises their fair value estimate upward.


Avellaneda-Stoikov Model

Problem Formulation

Avellaneda and Stoikov (2008) model the market maker's optimal quoting problem as a stochastic control problem. The state is (t,St,qt)(t, S_t, q_t) and the controls are the bid and ask half-spreads (δtb,δta)(\delta^b_t, \delta^a_t).

Mid-price dynamics: dSt=σdWt.dS_t = \sigma\, dW_t.

Inventory dynamics: the market maker's inventory changes when orders arrive. With Poisson order flow, the intensity of bid fills at spread δb\delta^b is λb(δb)=Aekδb\lambda^b(\delta^b) = A e^{-k\delta^b} and similarly for ask fills. The exponential demand curve is the simplest decreasing function in δ\delta: large spread → low fill rate. Parameter k>0k > 0 controls the elasticity of order arrival to spread.

Wealth dynamics: on each fill, wealth changes by the fill price. The market maker's cash process: dXt=PtadNtaPtbdNtb,dX_t = P_t^a\, dN_t^a - P_t^b\, dN_t^b, where NtaN_t^a and NtbN_t^b are counting processes of ask fills and bid fills, with intensities λa\lambda^a and λb\lambda^b.

Objective: maximise expected terminal wealth adjusted for inventory risk at t=Tt = T:

maxδb,δaE ⁣[XT+qTSTγ2qT2σ2(Tt)],\max_{\delta^b, \delta^a} \mathbb{E}\!\left[X_T + q_T S_T - \frac{\gamma}{2} q_T^2 \sigma^2 (T-t)\right],

where the terminal penalty γ2qT2σ2(Tt)\frac{\gamma}{2}q_T^2\sigma^2(T-t) is an approximation to the expected variance of the terminal inventory, with γ>0\gamma > 0 the risk aversion parameter. Equivalently, this is the CARA expected utility E[eγWT]-\mathbb{E}[e^{-\gamma W_T}] linearised near zero.

HJB Equation

The value function u(t,s,q)=maxδb,δaE[WTSt=s,qt=q]u(t, s, q) = \max_{\delta^b,\delta^a} \mathbb{E}[W_T \mid S_t = s, q_t = q] satisfies the Hamilton-Jacobi-Bellman equation:

The full lesson requires Premium

The complete derivation, the C++ / Python implementation, the validation tables, the quiz, and the interview-angle notes are part of Premium. Start a Premium plan to unlock every module in this track.