Module contents
Lesson 21 of 30Advanced 100 min

Market microstructure II: information, spreads and adverse selection

Explain spreads and the incorporation of private information through the Roll, Glosten-Milgrom and Kyle models; measure effective and realized spreads and examine adverse selection and other costs.

After this lesson you can

  • Derive Roll's estimator from bid-ask bounce and apply it to simulated series.
  • Solve Glosten-Milgrom using Bayesian updating and explain bid and ask dynamics after each order.
  • Derive Kyle's one-period linear equilibrium and λ, and interpret market depth.
  • Calculate quoted, effective and realized spreads and examine adverse selection and other costs.
  • Simulate the three models and compare predictions with the previous lesson's book simulator.

Before you start

The price of providing liquidity

Someone willing to buy or sell immediately can earn a spread, but also bears processing and inventory costs and the risk of trading with a better-informed counterparty. An impatient buyer accepts the ask for execution; the provider may lose if the buyer knows positive news not yet reflected in the quote. The models in this lesson isolate distinct mechanisms. None identifies the entire cause of an observed spread by itself.

Bounce and autocovariance

In Roll’s model, the efficient price mtm_t follows a walk with uncorrelated innovations and the transaction price is

pt=mt+s2qt,qt∈{−1,+1}.p_t=m_t+\frac{s}{2}q_t,\qquad q_t\in\{-1,+1\}.

The sign qtq_t indicates aggressive selling or buying, is independent and equally likely, and is independent of efficient-value innovations. The spread ss is constant. Therefore Δpt=Δmt+(s/2)(qt−qt−1)\Delta p_t=\Delta m_t+(s/2)(q_t-q_{t-1}). Terms with independent signs vanish except the shared qt−1q_{t-1}, which appears with opposite signs:

Cov⁡(Δpt,Δpt−1)=−s24,s^Roll=2−γ^1.\operatorname{Cov}(\Delta p_t,\Delta p_{t-1})=-\frac{s^2}{4}, \qquad \widehat{s}_{Roll}=2\sqrt{-\widehat{\gamma}_1}.

The Roll estimator gives a real root only when estimated autocovariance is negative. Positive sample covariance can result from noise, persistent signs, spread changes or dependence between efficient price and orders. Replacing it with zero is a convention, not a conclusion that cost is zero.

To see why independence matters, suppose stationary signs have autocovariance Ck=Cov⁡(qt,qt−k)C_k=\operatorname{Cov}(q_t,q_{t-k}) and efficient innovations are independent of them. The bounce component contributes (s2/4)(2C1−C0−C2)(s^2/4)(2C_1-C_0-C_2) to covariance of changes. Only when C1=C2=0C_1=C_2=0 and C0=1C_0=1 does the previous expression return. For example, orders split into a persistent sequence change the result even when the spread does not change. When estimating, also specify whether frequency is per transaction or per time interval and whether prices are nominal or logarithmic.

InteractiveBid-ask bounce

160 synthetic transactions. The line joins execution prices around a stochastic efficient price, with independent trade signs. Changing the seed yields another sample.

101.994.6Transactions 1 to 160

The formula requires negative covariance. Positive estimated covariance can reflect noise or violations of the model assumptions.

1.00
0.5
103
Sample autocovariance−0.2776
Roll spread1.054
Theoretical autocovariance−0.2500
Change the spread and efficient volatility; compare theoretical and sample autocovariance.

Quoting under private information

In the binary version of the Glosten-Milgrom model, final value is HH or LL with H>LH>L and the belief in high value is pp. A fraction μ\mu of orders comes from informed traders: they buy when value is high and sell when it is low. The rest are liquidity orders with equally likely signs. Thus,

P(C∣H)=1+μ2,P(C∣L)=1−μ2.P(C\mid H)=\frac{1+\mu}{2},\qquad P(C\mid L)=\frac{1-\mu}{2}.

A competitive risk-neutral provider charges a=E[V∣C]a=E[V\mid C] to the buyer and pays b=E[V∣venta]b=E[V\mid \text{venta}] to the seller. By Bayes, after a buy the probability of high value is pC=p(1+μ)/[p(1+μ)+(1−p)(1−μ)]p_C=p(1+\mu)/[p(1+\mu)+(1-p)(1-\mu)]; for a sale swap the signs of μ\mu and call the resulting probability pVp_V. Therefore a=L+(H−L)pCa=L+(H-L)p_C and b=L+(H−L)pVb=L+(H-L)p_V. In this model without additional costs, spread compensates expected adverse selection and competitive conditional profit is zero. Glosten and Milgrom study pricing and learning under heterogeneous information.

InteractiveBeliefs and quotes

The initial values 99 and 101 are equally likely. Informed traders buy at the high value and sell at the low value. Liquidity traders buy or sell at random. The value is hidden.

00.51Orders: 0 to 40

Observed sequence (B buy, S sell): none. Quotes are recalculated before the next order. They are conditional expectations and omit inventory and other costs.

0.30
0
P(high value)0.500
Bid99.700
Ask100.300
Advance the orders, change the informed proportion and reveal the hidden value.

A buy increases the belief if μ>0\mu>0; a sale reduces it. The spread can narrow as belief approaches zero or one because less uncertainty about value remains. A greater informed proportion means more information per order in distribution, but a single random path need not converge monotonically or faster in every comparison. Updating requires the provider to know the model and μ\mu.

With a balanced prior, H=101H=101 and L=99L=99, the initial ask is 100+μ100+\mu and bid 100−μ100-\mu. If μ=0.3\mu=0.3, the difference is 0.6. Conversely, if all customers are liquidity traders and μ=0\mu=0, sign carries no information and both quotes equal the prior expectation. This does not mean a real provider quotes without a spread: the example omits costs and inventory. At the extremes μ=1\mu=1 or degenerate beliefs, some orders have zero probability and the corresponding conditional update requires a convention outside the possible path.

Accumulated evidence can also be tracked with odds. If 0<μ<10<\mu<1, a buy multiplies p/(1−p)p/(1-p) by (1+μ)/(1−μ)(1+\mu)/(1-\mu) and a sale divides by that factor. Log odds rise or fall by the same amount for each order. The update observes only the sign, not the informed or liquidity label. In empirical applications, participants, sizes, price and timing of orders do not usually follow this fixed mixture; estimating μ\mu with the model formula requires justifying these restrictions and controlling regime changes.

Kyle equilibrium

In an auction, an insider observes value V∼N(m0,σv2)V\sim N(m_0,\sigma_v^2). Liquidity flow U∼N(0,σu2)U\sim N(0,\sigma_u^2) is independent. The market maker observes only Y=X+UY=X+U and sets P=m0+λYP=m_0+\lambda Y. The insider chooses XX to maximize E[(V−P)X∣V]E[(V-P)X\mid V]. The first-order condition, with λ>0\lambda>0, gives X=(V−m0)/(2λ)=β(V−m0)X=(V-m_0)/(2\lambda)=\beta(V-m_0).

The competitive provider imposes P=E[V∣Y]P=E[V\mid Y]. Joint normality gives λ=βσv2/(β2σv2+σu2)\lambda=\beta\sigma_v^2/(\beta^2\sigma_v^2+\sigma_u^2). Solving both conditions yields

β=σuσv,λ=σv2σu,Var⁡(V∣Y)=σv22.\beta=\frac{\sigma_u}{\sigma_v},\qquad \lambda=\frac{\sigma_v}{2\sigma_u},\qquad \operatorname{Var}(V\mid Y)=\frac{\sigma_v^2}{2}.

The Kyle model reveals half the initial variance in one auction under these assumptions. More noise lets the insider conceal a larger order and reduces the price slope. 1/λ1/\lambda measures depth in this model; λ\lambda is informational impact, not the generic coefficient for every time-dependent cost. The multiperiod version studies gradual revelation and an intertemporal strategy, not independent repetition of the one-auction formula. See Kyle.

The equilibrium intuition is a tradeoff: if the insider increases their order, they obtain more exposure to the known value but move price against themselves. In equilibrium β2σv2=σu2\beta^2\sigma_v^2=\sigma_u^2, so informed-flow and noise variances match. Gaussian conditional variance subtracts Cov⁡(V,Y)2/Var⁡(Y)\operatorname{Cov}(V,Y)^2/\operatorname{Var}(Y) from σv2\sigma_v^2, leaving half. The result does not state that half of each individual piece of news enters the price or that informed flow is separately observable.

In the one-period version, the insider’s expected profit is σvσu/2\sigma_v\sigma_u/2 before costs, under the same unit normalization. More noise provides more capacity to hide orders, even as providers set prices efficient conditional on observed flow. Across auctions, the insider also considers how the current order changes beliefs and future opportunities. Independently repeating a one-date equilibrium is insufficient. An empirical regression of price changes on flow mixes information, liquidity and strategic response and must specify units, window and simultaneity issues.

InteractiveValue and flow in Kyle

One auction with 100 fixed synthetic normal pairs. Value and noise flow are independent. The points are fundamental values and the line is the price conditional on total order flow.

−4.44.43.2−3.2Total order flowValue and price

The slope represents permanent informational impact in the Kyle model. The chart scales adjust to the range of each sample.

1.00
1.00
Intensity β1.000
Impact λ0.500
Residual / initial variance0.5
Change value and noise standard deviations and observe the conditional price.

Spreads and adverse selection

For execution at price ptp_t, aggressor sign qt=+1q_t=+1 for a buy and −1-1 for a sale, prior midpoint mtm_t and later midpoint mt+hm_{t+h}, define in monetary units

Scot=at−bt,Sef=2qt(pt−mt),Sreal(h)=2qt(pt−mt+h),I(h)=2qt(mt+h−mt).S_{cot}=a_t-b_t,\quad S_{ef}=2q_t(p_t-m_t),\quad S_{real}(h)=2q_t(p_t-m_{t+h}),\quad I(h)=2q_t(m_{t+h}-m_t).

The identity Sef=Sreal(h)+I(h)S_{ef}=S_{real}(h)+I(h) is algebraic for each execution. The effective and realized spread measure different distances: the former uses the prior midpoint, the latter a future one. Signed impact I(h)I(h) is often used as an indicator of adverse selection, but can also reflect public information, trends, inventory, trade effects and other factors. A negative realized spread means the future midpoint moved beyond the execution price in the aggressor’s direction; it does not by itself prove that each counterparty had private information.

Horizon, clock and reference matter. Quotes must precede execution on the same clock and event ordering; simultaneous messages, latency and stale states can bias the measure. The SEC describes these measures and their relationship to impact. A structural Huang-Stoll decomposition requires additional assumptions and estimation; this identity does not automatically identify each cost component.

For example, a buy at 100.01 with prior midpoint 100.00 has an effective spread of 0.02. If the later midpoint is 100.03, realized spread is −0.04 and signed impact is 0.06: their sum remains 0.02. When aggregating trades, document whether they are weighted by trade count or volume, how horizons are chosen and how partial fills are treated. For a provider, negative realized spread does not necessarily include the full outcome of inventory, fees or hedging.

Lab: three mechanisms

We use NumPy and a fixed seed. Parameters are known because the data are simulated. In Roll, efficient price may fluctuate greatly relative to spread: bounce is then hidden in noise and a finite sample may not yield negative covariance. Sample covariance uses denominator nn, appropriate for this comparison; other conventions change the value slightly.

[ ]Simulate and estimate RollBrowser
import numpy as np
rng=np.random.default_rng(282101)
n=20000; spread=0.4; sigma=.2
q=rng.choice([-1,1],size=n); valor=100+np.cumsum(rng.normal(0,sigma,n))
precio=valor+spread*q/2; cambios=np.diff(precio)
gamma=np.mean((cambios[1:]-cambios[1:].mean())*(cambios[:-1]-cambios[:-1].mean()))
estimado=2*np.sqrt(-gamma) if gamma<0 else np.nan
print('Spread verdadero:',spread,'| Roll:',estimado,'| covarianza:',gamma,'| teórica:',-spread**2/4)

In Glosten-Milgrom the sequence of signs allows μ\mu to be estimated if true value is known in independent simulations with a balanced prior. In a single real market, final value is not a perfect label of private information and the parameter is not identified by this formula without the model assumptions.

[ ]Glosten-Milgrom and estimationBrowser
rng=np.random.default_rng(282102); N=50000; mu=.3
alto=rng.random(N)<.5; informado=rng.random(N)<mu
compra=np.where(informado,alto,rng.random(N)<.5)
ph=compra[alto].mean(); pl=compra[~alto].mean(); mu_hat=ph-pl
se=np.sqrt(ph*(1-ph)/alto.sum()+pl*(1-pl)/(~alto).sum())
ask=(101*alto[compra].mean()+99*(1-alto[compra].mean()))
bid=(101*alto[~compra].mean()+99*(1-alto[~compra].mean()))
print('μ verdadero y estimado:',mu,mu_hat,'| ask y bid:',ask,bid)
print('Intervalo normal aproximado para μ:',mu_hat-1.96*se,mu_hat+1.96*se)

The interval treats episodes as independent and the value label as observed, as in this simulation. With this seed the approximate interval does not contain the true value 0.3: 95% coverage refers to the proportion of intervals covering the parameter on repeated use of the procedure, not a guarantee for each sample. A real series of same-day orders can exhibit dependence, and neither effective sample size nor informed trader identity is supplied by the model. Reusing this interval without addressing those differences would imply excessive apparent precision.

In Kyle, a sample of independent auctions is observed. Regressing value on flow estimates the market maker’s slope because final value is known in this simulation. The slope of a regression of real prices on flow may incorporate other causes and does not automatically identify the structural parameter.

[ ]Kyle by Monte CarloBrowser
rng=np.random.default_rng(282103); N=50000; sv=2.; su=3.
v=rng.normal(0,sv,N); u=rng.normal(0,su,N)
beta=su/sv; lam=sv/(2*su); x=beta*v; flujo=x+u; p=lam*flujo
lam_hat=np.cov(v,flujo,ddof=1)[0,1]/np.var(flujo,ddof=1)
beta_hat=np.cov(x,v,ddof=1)[0,1]/np.var(v,ddof=1)
print('β verdad / estimación:',beta,beta_hat,'| λ verdad / estimación:',lam,lam_hat)
print('Varianza residual / inicial:',np.var(v-p,ddof=1)/np.var(v,ddof=1))

The estimate of β\beta recovers its value exactly because in this experiment x=βvx=\beta v without measurement error; this is not statistical validation of a real strategy. The estimate of λ\lambda and residual variance have Monte Carlo noise. Repeat with other seeds and sample sizes before interpreting a small difference.

Lab: informed order and realized spread

We construct independent episodes with a persistent book within each episode. There are two levels per side, with two FIFO orders of two units at the best and 20 at the second. Each event brings a unit market order. Each episode’s final efficient value is 102 or 98 ticks with equal probability; informed traders know it and buy or sell accordingly. Liquidity orders choose a random sign. Final value is a latent hypothesis, not the observed future midpoint. This variant omits new limit arrivals, cancellations, latency and Poisson flow; there is sufficient depth for the 11 events in each episode.

[ ]FIFO matching in each snapshotBrowser
from collections import deque
class LibroSimple:
    def __init__(self,medio):
        self.niv={'B':{medio-1:deque([['b1',2],['b2',2]]),medio-2:deque([['b3',20]])},
                  'S':{medio+1:deque([['a1',2],['a2',2]]),medio+2:deque([['a3',20]])}}
    def mejor(self,lado):
        precios=[p for p,cola in self.niv[lado].items() if cola]
        return (max(precios) if lado=='B' else min(precios)) if precios else None
    def medio(self):
        b,a=self.mejor('B'),self.mejor('S')
        return (b+a)/2 if b is not None and a is not None else None
    def mercado(self,lado,cantidad):
        lado_reposo='S' if lado=='B' else 'B'; ejec=[]; resto=cantidad
        while resto and self.mejor(lado_reposo) is not None:
            p=self.mejor(lado_reposo); cola=self.niv[lado_reposo][p]
            orden=cola[0]; q=min(resto,orden[1]); resto-=q; orden[1]-=q
            ejec.append((orden[0],p,q))
            if orden[1]==0: cola.popleft()
        return ejec,resto
demo=LibroSimple(100); print('FIFO:',demo.mercado('B',7))

We save the midpoint before the first order and measure it again after hh additional orders. The future midpoint comes from the simulated book; it is not replaced by latent value. Because informed orders share a signal within an episode, they affect future queues and can move the best price. Comparison pairs use the same values, liquidity signals and uniform draws. This model imposes the mechanism it illustrates; it does not show how a book with strategic replenishment or changing information would behave.

[ ]Measure spreads at different horizonsBrowser
rng=np.random.default_rng(282104); N=2000; H=10
valor_final=rng.choice([98,102],N); uniforme=rng.random((N,H+1)); ruido=rng.choice([-1,1],(N,H+1))
def medir(mu,h):
    assert 1<=h<=H
    efectivo=[]; realizado=[]; impacto=[]
    for i in range(N):
        libro=LibroSimple(100); medio=libro.medio()
        signos=np.where(uniforme[i,:h+1]<mu,1 if valor_final[i]>100 else -1,ruido[i,:h+1])
        q=int(signos[0]); operaciones,resto=libro.mercado('B' if q==1 else 'S',1)
        assert resto==0; p=operaciones[0][1]
        for signo in signos[1:]:
            _,resto=libro.mercado('B' if signo==1 else 'S',1)
            assert resto==0
        posterior=libro.medio(); assert posterior is not None
        e=2*q*(p-medio); r=2*q*(p-posterior); imp=2*q*(posterior-medio)
        assert abs(e-r-imp)<1e-10
        efectivo.append(e); realizado.append(r); impacto.append(imp)
    return np.mean(efectivo),np.mean(realizado),np.mean(impacto)
for mu in (0.,.3,.6): print('h, μ:',1,mu,'| efectivo, realizado, impacto:',medir(mu,1))
[ ]Five- and ten-event horizonsBrowser
for h in (5,10):
    for mu in (0.,.3,.6): print('h, μ:',h,mu,'| efectivo, realizado, impacto:',medir(mu,h))

By construction, episodes share the same information within each path and are compared with paired random numbers. One additional event does not deplete the first level, so measured impact is zero. At longer horizons queue consumption itself can produce signed impact even with μ=0\mu=0: this mechanical baseline shows why impact alone does not identify adverse selection. For this seed, mean impact increases as the informed fraction increases at horizons 5 and 10; this is a property of this experiment. The assumed final efficient value is known to informed traders, a deliberately artificial advantage. Impact is measured from subsequent book quotes. Do not extrapolate these results to real markets or a profitable strategy without replenishment, costs, cancellations and a legitimate source of information.

Exercises

ProofThe shared term
Prove: Derive first-order autocovariance in the Roll model, with constant spread, independent equally likely signs and independent efficient innovations.
The proof will appear here as you work.

Step 1 of 3. What is the observed price change?

ProofTwo equilibrium conditions
Prove: In one-auction Kyle, value and noise are independent normal variables with positive standard deviations σᵥ and σᵤ. Derive β, λ and residual variance.
The proof will appear here as you work.

Step 1 of 3. What does the insider choose if price is m₀+λ(x+u)?

NumericInformed buy
High value 101 or low 99, equally likely prior and μ=0.3. What is the initial competitive ask?
NumericInvert the covariance
Estimated autocovariance is −0.0004. What is the Roll spread?
QuizAfter execution
Why can a buy's realized spread be negative despite a positive effective spread?

Key takeaways

Key idea
The spread and subsequent movement are observable; their causes must be identified through additional assumptions and tests.

Roll links bounce and autocovariance under independence. Glosten-Milgrom shows how an order changes beliefs and quotes. Kyle describes an equilibrium between a strategic informed order and a competitive provider. Effective spread, realized spread and signed impact satisfy an identity, but adverse selection is not the only possible explanation of a future move.