One unit · two possible values · no fee anywhere
The Gap Between Bid and Ask
In a competitive binary market model, a dealer with no fees, inventory cost, or expected profit still quotes a positive gap when some traders know more. Move the informed fraction, send real orders through Bayes' rule, audit 960,000 trades, and test the elastic-liquidity case where one side loses its break-even quote. Every model result is computed live, with the model's boundaries kept visible.
The dealer does not know whether this asset will finish at 0 or 1. The next trader might know. A buy is therefore not only a request. It is evidence.
Sequential Bayesian market
Preparing the market…
| trade | order | trader | price | public value |
|---|---|---|---|---|
| No orders yet. | ||||
The first quote begins from equal odds. An informed trader buys only when the value is 1 and sells only when it is 0. A liquidity trader flips a fair coin. If the informed fraction is π, Bayes' rule makes the first ask (1 + π) / 2 and the first bid (1 - π) / 2. Their difference is exactly π. No fee term appears.
Depth I · the rent objectionA gap that is not profit
If a spread survives, perhaps the dealer is simply collecting it. The model gives a harder answer. Competition sets each quote to the asset's expected value conditional on the order that reaches it. The dealer loses to informed traders and gains from liquidity traders. Before knowing which arrives, those terms cancel.
Zero-profit audit
Exact at the current quote, then realised across a seeded ensemble.
…
ask minus E[value | buy]
…
E[value | sell] minus bid
…
compare with current public value
…
…
…
…
…
starts at an absolute error of one half
Computing the audit…
The realised total on one path can finish positive or negative. Zero expected profit is an ensemble statement, not a promise that every dealer ledger closes at zero. It is also a model assumption motivated by competition, not a measurement of real market makers' earnings.
Depth II · price discoveryThe order speaks before the news
Return to the first instrument and send 24 orders. The public value moves even though no public announcement occurs. Each transaction price is the posterior after its order: the ask after a buy, the bid after a sell. Glosten and Milgrom prove that this transaction price sequence is a martingale relative to public and dealer information. In the instrument, the exact one-step audit reads P(buy) × ask + P(sell) × bid = current value.
A martingale need not sit still. Conditional on the hidden truth, informed orders bias the path toward that truth. Across both possible truths before either is known, the expected next move is zero. That is how the quote can discover information without offering a predictable profit.
Depth III · when the quote disappearsPush until one side closes
The always-trade binary toy above cannot honestly demonstrate a market shutdown for any informed fraction below one. Its liquidity traders trade regardless of price. For breakdown, the paper adds price-sensitive liquidity demand. This separate lab reconstructs its ask-side break-even equation.
Solving the dealer's break-even equation…
Here the asset is 1 or 11, the high-value prior is 0.20, and a liquidity buyer's preference multiplier is uniform from 0 to 2. Those are model inputs, not measurements. As α rises, the quote needed to cover informed losses drives away liquidity buyers. Past the live discriminant threshold, no ask makes expected profit zero. This is a partial, buy-side closure in this parameterisation. It is not the same mechanism as the first instrument's shrinking spread.
The check
The live page and the dependency-free Node verifier derive their results from the same conditional probabilities. At the initial 35% setting, the browser recomputes:
Run node research/the-gap-between-bid-and-ask/verify-the-gap-between-bid-and-ask.mjs. It checks the quote identity over six informed fractions, the zero-profit and martingale equations across 30 non-symmetric states, an exact 80-trade probability tree, a seeded 960,000-trade simulation, and the breakdown quadratic. Any failed assertion exits non-zero.
- Verified inside the model. Conditional-expectation quotes produce a positive information spread at the half prior, zero conditional expected dealer profit, a martingale transaction price, Bayesian learning from order flow, and a possible ask-side breakdown once liquidity demand is elastic.
- Free model choices. Binary values, equal prior in the first lab, perfect information, random liquidity orders, unit size, unlimited inventory, no order refusal, the 35% starting setting, path seed, ensemble size, and every parameter in the breakdown lab.
- Not claimed. Real spreads are not entirely adverse selection. Order processing, inventory risk, market power, tick size, latency, order size, and market design can matter. The page does not estimate any real security's spread and does not claim real dealers earn zero profit.
- Measured constants. None. Every numerical quantity in the instruments is a model input or a result computed from one.
Model ledger: exactly what each trader does
- The first lab's terminal value is either zero or one. Before any order, each has probability one half.
- An informed trader knows the terminal value and buys at one or sells at zero. A liquidity trader buys or sells with equal probability, independent of value.
- The dealer sees only the order sign. The ask is E[value | next order is buy]; the bid is E[value | next order is sell].
- Trades are one unit. There are no fees, processing costs, inventory limits, risk aversion, discounting, strategic order sizes, limit orders, or public news.
- The chart's “public value” is the posterior probability of terminal value one. After a trade it equals that transaction price. The midpoint is shown separately in the audit because away from the half prior it need not equal the posterior exactly.
Primary sources. Lawrence R. Glosten and Paul R. Milgrom, “Bid, Ask and Transaction Prices in a Specialist Market with Heterogeneously Informed Traders,” Journal of Financial Economics 14 (1985), 71–100. Proposition 1 supplies the conditional-expectation quotes; Proposition 2 supplies the transaction-price martingale; section 3 supplies the elastic-liquidity breakdown equation. Lawrence R. Glosten and Lawrence E. Harris, “Estimating the Components of the Bid/Ask Spread,” Journal of Financial Economics 21 (1988), 123–142, empirically separates an asymmetric-information component from a component containing inventory, monopoly, and clearing costs.