Quant Sandbox
DerivativesPortfolio & RiskFixed IncomeCorporate FinanceProbability & MeasureStochastic ModelsMarket MicrostructureGuide
Guide
Derivatives pricing0 / 17
01Forwards, calls and puts02Combining positions03Arbitrage and the forward price04Put–call parity05The one-step binomial model06Risk-neutral probabilities07Multi-step trees and backward induction08American options and early exercise09Delta and hedging10Geometric Brownian motion11The Black–Scholes formula12The Greeks: gamma, vega, theta and rho13Options on dividend-paying stocks, indices, currencies and futures14Implied volatility and the volatility smile15Stochastic volatility and the Heston model16Static replication: Breeden–Litzenberger and Carr–Madan17Exotic options: barriers, Asians and digitals
Portfolio & risk0 / 12
01Returns and volatility02Diversification and correlation03The efficient frontier and the capital market line04Risk aversion and the optimal complete portfolio05CAPM, beta and the security market line06Performance measures: Sharpe, Treynor, Jensen and information ratio07Factor models and systematic risk08The Fama–French factor models09Value at Risk and expected shortfall10Systemic risk and contagion11Portfolio constraints and the no-short-sales frontier12Estimating expected returns and covariances
Fixed income0 / 10
01Bond prices and yields02Duration and convexity03Immunization and duration matching04Spot rates, forward rates and the yield curve05Non-parallel curve moves and key-rate durations06Bond futures and the cheapest-to-deliver07Interest rate swaps08Callable bonds and negative convexity09Credit risk: default probabilities and credit spreads10Real rates, inflation and inflation-linked bonds
Corporate finance0 / 10
01Interest, compounding and discounting02Annuities, perpetuities and loan amortization03Net present value and internal rate of return04Project risk: sensitivity, scenarios and Monte Carlo NPV05The weighted average cost of capital06Capital structure and the Modigliani–Miller theorems07Dividends, payout policy and the dividend discount model08Discounted cash flow valuation09Relative valuation with multiples10Real options: the value of flexibility
Probability and measure0 / 13
01Measuring the size of sets02σ-algebras and Borel sets03Lebesgue measure and null sets04Measurable functions05The Lebesgue integral06Convergence theorems07Probability spaces and Kolmogorov's axioms08Random variables and their distributions09Expectation, variance and inequalities10Independence and product measures11Modes of convergence and the law of large numbers12Conditional probability and conditional expectation13Measure theory in option pricing
Stochastic models0 / 17
01Random walks and Brownian motion02The law of large numbers and the central limit theorem03Probability spaces, σ-algebras and random variables04Filtrations, adapted processes and stopping times05Conditional expectation and martingales06Properties of Brownian motion07The reflection principle and first passage times08The Brownian bridge09The Itô integral10Itô's lemma11Kolmogorov equations and the Feynman–Kac formula12Change of measure and Girsanov's theorem13Monte Carlo option pricing14Simulating SDEs: the Euler–Maruyama scheme15Correlated Brownian motions and multi-asset models16Mean reversion: Ornstein–Uhlenbeck and Vasicek17Jumps and the Merton jump-diffusion model
Market microstructure0 / 11
01Market makers and liquidity02The limit order book03Queue position and fill probability04Adverse selection and informed trading05The Glosten–Milgrom model06Measuring and decomposing the bid–ask spread07Informed trading and Kyle's lambda08Price impact and optimal execution09Inventory risk and quote skewing10Optimal quoting: the Avellaneda–Stoikov model11Market making profit and loss attribution
Knowledge graph

© 2026 Quant Sandbox · A study aid for quantitative finance

Privacy & dataNo cookies

This site does not use cookies and asks for no personal data. It keeps a few small settings in your browser's local storage — your chosen theme and language, the sidebar layout, and your progress and answers in the Guides — so it remembers them on your next visit. This data never leaves your device; clearing your browser storage removes it. Inputs you change can also be captured in the page URL, so you can share or bookmark a specific setup. The site uses Vercel Web Analytics, a privacy-friendly, cookieless service that records only anonymous, aggregated usage (such as page views) without identifying you or tracking you across other sites.

Guides/Market microstructure/06

Measuring and decomposing the bid–ask spread

Lesson 6 of 11 · 1 min read

"The limit order book" defined the spread as the gap between the best ask and the best bid, and "The Glosten–Milgrom model" explained why a market maker (a trader who keeps buy and sell quotes in the book) must set it wide enough to cover losses to better-informed traders. Researchers and regulators, however, often see only a list of trade prices, without the quotes behind them. This lesson shows how much of the spread can be recovered from trade prices alone, why that estimate is biased when trading is informed, and how the spread splits into what it pays for.

Throughout, prices are in cents, mtm_tmt​ is the efficient price (the value of the asset given everything the market has learned up to trade ttt), SSS is the full bid–ask spread and QtQ_tQt​ is the direction of trade ttt: Qt=+1Q_t = +1Qt​=+1 when a buyer initiated it at the ask and Qt=−1Q_t = -1Qt​=−1 when a seller initiated it at the bid.

Three spreads

The quoted spread is the difference between the best ask aaa and the best bid bbb at a moment in time. It says what a round trip would cost a trader who buys and sells one share at once.

The effective spread measures what one actual trade cost. If a trade at price ptp_tpt​ happens when the midpoint of the quotes is mmm, then

effective spread=2 ∣pt−m∣.\text{effective spread} = 2\,|p_t - m|.effective spread=2∣pt​−m∣.

A buy at the ask with a one-cent half-spread has an effective spread of two cents, the same as the quoted spread; a trade inside the quotes has a smaller one.

The realised spread asks how much of that the market maker keeps once the price has had time to react. With a horizon hhh (for example five minutes) it compares the trade price with the midpoint after the horizon:

realised spread=2 Qt (pt−mt+h).\text{realised spread} = 2\,Q_t\,(p_t - m_{t+h}).realised spread=2Qt​(pt​−mt+h​).

If the midpoint drifts towards the trade, as it does after informed buying, the realised spread is smaller than the effective spread. The difference is the price impact of the trade, the part of the spread lost to better-informed traders. This lesson leaves the horizon as a definition and works with the effective spread and with trade prices only.

Bid–ask bounce

Suppose first that trades carry no information. The efficient price follows a random walk, mt=mt−1+εtm_t = m_{t-1} + \varepsilon_tmt​=mt−1​+εt​ with independent shocks εt\varepsilon_tεt​ of variance σ2\sigma^2σ2, and each trade happens at the quote on its side of the price before it:

pt=mt−1+S2 Qt.p_t = m_{t-1} + \tfrac{S}{2}\,Q_t.pt​=mt−1​+2S​Qt​.

Directions are independent, with buys and sells equally likely. Even when mtm_tmt​ hardly moves, the trade price jumps between the bid and the ask: a buy prints high, the next trade is a sell half the time and prints low. This is the bid–ask bounce. A price rise therefore tends to be followed by a fall, and successive price changes are negatively correlated.

The Roll estimator

Write the price change between two trades by subtracting the expressions for ptp_tpt​ and pt−1p_{t-1}pt−1​:

Δpt=pt−pt−1=εt−1+S2 (Qt−Qt−1).\Delta p_t = p_t - p_{t-1} = \varepsilon_{t-1} + \tfrac{S}{2}\,(Q_t - Q_{t-1}).Δpt​=pt​−pt−1​=εt−1​+2S​(Qt​−Qt−1​).

Now take the covariance with the previous change Δpt−1=εt−2+S2(Qt−1−Qt−2)\Delta p_{t-1} = \varepsilon_{t-2} + \tfrac{S}{2}(Q_{t-1} - Q_{t-2})Δpt−1​=εt−2​+2S​(Qt−1​−Qt−2​). The shocks ε\varepsilonε are independent of everything else and of each other, and so are the directions. The only term the two changes share is Qt−1Q_{t-1}Qt−1​, which enters the first with a minus sign and the second with a plus sign. With Var(Q)=1\text{Var}(Q) = 1Var(Q)=1:

cov(Δpt,Δpt−1)=S2⋅S2⋅cov(−Qt−1,Qt−1)=−S24.\text{cov}(\Delta p_t, \Delta p_{t-1}) = \tfrac{S}{2} \cdot \tfrac{S}{2} \cdot \text{cov}(-Q_{t-1}, Q_{t-1}) = -\frac{S^2}{4}.cov(Δpt​,Δpt−1​)=2S​⋅2S​⋅cov(−Qt−1​,Qt−1​)=−4S2​.

Solving for the spread gives Roll's estimator, which needs nothing but a series of trade prices:

S=2−cov(Δpt,Δpt−1).S = 2\sqrt{-\text{cov}(\Delta p_t, \Delta p_{t-1})}.S=2−cov(Δpt​,Δpt−1​)​.

In a sample the covariance is estimated, and noise can make it positive. Then the square root has no real value: Roll's estimator is not defined for that sample, which happens most often in short or volatile samples and is itself a sign that the estimate cannot be trusted.

Informed trading biases Roll

Now let a share α\alphaα of each half-spread be information. After a buy the market learns that the asset is probably worth more and the efficient price moves up by α S/2\alpha\,S/2αS/2; after a sell it moves down:

mt=mt−1+α S2 Qt+εt.m_t = m_{t-1} + \alpha\,\tfrac{S}{2}\,Q_t + \varepsilon_t.mt​=mt−1​+α2S​Qt​+εt​.

Trades still print at mt−1±S/2m_{t-1} \pm S/2mt−1​±S/2, so the effective spread is still exactly SSS. The price change now becomes

Δpt=S2 Qt−(1−α) S2 Qt−1+εt−1,\Delta p_t = \tfrac{S}{2}\,Q_t - (1-\alpha)\,\tfrac{S}{2}\,Q_{t-1} + \varepsilon_{t-1},Δpt​=2S​Qt​−(1−α)2S​Qt−1​+εt−1​,

because only the part (1−α)S/2(1-\alpha)S/2(1−α)S/2 of the previous trade's jump reverses; the part αS/2\alpha S/2αS/2 stays in the price. Repeating the covariance calculation, the shared term is Qt−1Q_{t-1}Qt−1​ with coefficients −(1−α)S/2-(1-\alpha)S/2−(1−α)S/2 and S/2S/2S/2:

cov(Δpt,Δpt−1)=−(1−α) S24,2−cov=S1−α.\text{cov}(\Delta p_t, \Delta p_{t-1}) = -(1-\alpha)\,\frac{S^2}{4}, \qquad 2\sqrt{-\text{cov}} = S\sqrt{1-\alpha}.cov(Δpt​,Δpt−1​)=−(1−α)4S2​,2−cov​=S1−α​.

Roll's estimator therefore converges to S1−αS\sqrt{1-\alpha}S1−α​, below the true spread, while the effective spread does not move. The more informed the flow, the more of the spread is permanent price change rather than bounce, and the less of it Roll can see.

Worked example

Roll's estimate from a covariance, and its bias

  1. Price changes have a sample covariance of −0.0004 USD². Take the square root of minus the covariance.

    0.0004\displaystyle \sqrt{0.0004}0.0004​=0.02
  2. Roll's spread is twice that, in USD.

    S=2⋅0.02\displaystyle S = 2 \cdot 0.02S=2⋅0.02=0.04
  3. Now a market with a true spread of 10¢ where α=0.35\alpha = 0.35α=0.35 of it is informed. The transitory share is 1−α=0.651 - \alpha = 0.651−α=0.65; its square root:

    0.65\displaystyle \sqrt{0.65}0.65​=0.80623
  4. Roll's estimator converges to this many cents.

    100.65\displaystyle 10\sqrt{0.65}100.65​=8.0623
  5. The effective spread is still 10¢, so Roll misses this many cents: the informed share at work.

    10−8.0623\displaystyle 10 - 8.062310−8.0623=1.9377

Decomposing the spread

If the direction of each trade is known (from quotes, or by classifying trades as buys and sells), the two parts can be separated. Rewrite the price change with ΔQt=Qt−Qt−1\Delta Q_t = Q_t - Q_{t-1}ΔQt​=Qt​−Qt−1​:

Δpt=S2 ΔQt+α S2 Qt−1+εt−1.\Delta p_t = \tfrac{S}{2}\,\Delta Q_t + \alpha\,\tfrac{S}{2}\,Q_{t-1} + \varepsilon_{t-1}.Δpt​=2S​ΔQt​+α2S​Qt−1​+εt−1​.

This is the two-way Huang–Stoll regression Δpt=β1 ΔQt+β2 Qt−1+et\Delta p_t = \beta_1\,\Delta Q_t + \beta_2\,Q_{t-1} + e_tΔpt​=β1​ΔQt​+β2​Qt−1​+et​. Least squares estimates β1=S/2\beta_1 = S/2β1​=S/2, the half-spread, and β2=αS/2\beta_2 = \alpha S/2β2​=αS/2, the part of each half-spread that becomes permanent. Their ratio is the adverse-selection share

α^=β2β1.\hat\alpha = \frac{\beta_2}{\beta_1}.α^=β1​β2​​.

The remaining share 1−α1 - \alpha1−α pays for order processing and for the risk of carrying inventory. This model does not separate those two; richer three-way versions add a term for how the maker's inventory changes the quotes.

Sample size

Every estimate above is a sample average, so the law of large numbers makes it converge and "The law of large numbers and the central limit theorem" says how fast: its error shrinks like 1/n1/\sqrt{n}1/n​ in the number of trades. Efficient-price volatility adds noise without adding information about the spread, in the same way that volatility makes mean returns hard to pin down in "Returns and volatility". A day of 120 trades gives a rough answer; thousands of trades give a stable one.

The figure simulates this market with 120, 1,000 or 10,000 trades, draws the first 120 trades with the efficient price hidden, and plots each price change against the previous one with its least-squares line. Start at the defaults: a 10¢ spread, α=0.35\alpha = 0.35α=0.35 and 2.5¢ of efficient-price volatility per trade. With 120 trades Roll's estimate is 9.66¢, close to 10¢ by luck rather than by design, and Huang–Stoll's α^\hat\alphaα^ is 27.9%. Switch to 10,000 trades: Roll settles at 8.28¢, near its limit of 8.06¢ and 17.2% below the true spread, α^\hat\alphaα^ moves to 34.6%, and the effective spread stays at 10¢ throughout. Then set α\alphaα to 0 and watch the gap close, and raise the volatility to see the 120-trade estimate jump around.

Bid–ask bounce and the Roll estimatorOpen in Spread Estimation
10¢
220
35%
00.9
2.5¢
010
Trade prices
Successive price changesLeast-squares line
Roll estimate
9.66¢
Limit S·√(1 − α)
8.06¢
Effective spread
10.00¢
Huang–Stoll α̂
27.9%
Roll error
−3.4%

Slope of the cloud -0.505; the estimates use the whole sample, the charts show part of it.

Roll needs only prices but sees only the transitory part of the spread. The effective spread needs the quotes and sees all of it. The gap between them is a measure of informed trading.

Summary

  • The quoted spread is a−ba - ba−b, the effective spread of a trade is 2∣pt−m∣2|p_t - m|2∣pt​−m∣, and the realised spread 2Qt(pt−mt+h)2Q_t(p_t - m_{t+h})2Qt​(pt​−mt+h​) is what the maker keeps after a horizon hhh.
  • Trades bounce between bid and ask, so successive price changes have covariance −S2/4-S^2/4−S2/4 and Roll's estimator is S=2−covS = 2\sqrt{-\text{cov}}S=2−cov​; it is not defined when the sample covariance is positive.
  • When a share α\alphaα of each half-spread is information, the covariance shrinks to −(1−α)S2/4-(1-\alpha)S^2/4−(1−α)S2/4 and Roll converges to S1−αS\sqrt{1-\alpha}S1−α​, while the effective spread stays SSS.
  • With known trade directions, the Huang–Stoll regression estimates the half-spread β1\beta_1β1​ and the adverse-selection share β2/β1\beta_2/\beta_1β2​/β1​.
  • Estimates from a few hundred trades are noisy; their error shrinks like 1/n1/\sqrt{n}1/n​.
Try itOpen the Spread Estimation lab
2 questions on this lesson at the end of the series
Previous · 05The Glosten–Milgrom modelNext · 07Informed trading and Kyle's lambda
Connections

Measuring and decomposing the bid–ask spread

Open the full graph
Builds on
07.05The Glosten–Milgrom model07.02The limit order book06.02The law of large numbers and the central limit theorem02.01Returns and volatility
Leads to
07.07Informed trading and Kyle's lambda
See it in the knowledge graph
Labs for this lesson
Spread Estimation