Lecture 2: Measuring Liquidity
Lecture 1 established that liquidity is what separates real markets from the frictionless textbook version. This lecture is about a harder problem: liquidity isn't one number, it's a family of measures that each answer a slightly different question — and most of the lecture is spent on what to do when the data you need to compute any of them is missing.
- Source
- Real transcript, verified via yt-dlp captions
- Textbook chapter
- Foucault/Pagano/Röell, Ch. 2 — same title, "Measuring Liquidity"
- Worked dataset
- First 30 transactions of one trading day in Krispy Kreme stock (textbook's companion dataset)
Three kinds of liquidity, not one
The course's working definition, repeated from Lecture 1: market liquidity is a market's ability to let an asset be sold quickly without reducing its price much. But the lecture distinguishes two more:
Monetary liquidity — a property of the asset, not the market: how easily it converts to goods. Cars are less liquid than ice cream in general; and the same asset (a car) is more liquid in one market (Chicago) than another (rural Nebraska) — market and monetary liquidity interact but aren't the same thing.
Funding liquidity — a property of the economic agent: their ability to get cash or credit on acceptable terms without big losses. A bank's loans are real wealth, but not cash on hand — if depositors all withdraw at once, the bank has a funding liquidity crisis despite being "wealthy" on paper. Same idea at personal scale: if your wage arrives in two days but rent is due today, you're liquidity-constrained even though you technically have the money.
Why illiquidity is inefficiency, not just inconvenience
The lecture derives this from the standard supply/demand picture: in a liquid market, one equilibrium price clears the market, and the assets end up with whoever values them most — the efficient allocation. In an illiquid market, there are two prices (buyers pay more, sellers get less), so some trades that would have been efficient don't happen — the item stays with someone who values it less than a willing buyer would have. Illiquidity is a direct barrier to efficiency, not a separate problem.
Three groups care about this for different reasons: traders because it's literally their trading cost; regulators because true "efficiency" is hard to measure directly, but liquidity is a workable proxy for it — and because illiquid markets are more prone to price deviations from fundamentals, and more volatile ones; and because illiquidity can itself be a signal of structural problems worth investigating.
Depth, and liquidity drying up in a crisis
Market depth, again: how much harder it is to trade a large amount versus a small one — the lecture's own example is one ice-cream cone versus a full shipload. Liquidity isn't constant — it dries up specifically when things go bad, which is exactly the wrong time. The lecture uses real 2008 data: after the Lehman Brothers bankruptcy, US sovereign bond bid-ask spreads spiked sharply, average transaction size dropped, and price-impact coefficients rose (i.e. depth fell) — all three liquidity signals moving the wrong way at once, right when assets most needed to change hands quickly as valuations shifted.
The dataset, and a puzzle it immediately raises
The course's worked dataset: one trading day of Krispy Kreme (KKD) transactions — bid, ask, transaction price, and trade direction at each print. The first 30 transactions (of roughly 1,000 in the full day) are used throughout the lecture. One immediate puzzle: some trade prices sit inside the quoted spread, and one sits outside it.
Inside the spread happens for two reasons: a hidden limit order offering a better price than the visible quotes, or a dealer giving an individual client a price improvement (a long-standing relationship gets a better-than-quoted price). Outside the spread is simpler — the best quote is only valid up to a limited size; a trader who wants more than that has to walk deeper into the book, exactly as Lecture 1 covered.
Quoted spread — and why it can mislead
The simplest measure: S = ask − bid. Normalized by the midquote m = (ask+bid)/2, the relative quoted spread is s = S/m — necessary because a $1 spread means something very different on a $100 stock (1%) than a $10 stock (10%). Applied to the Krispy Kreme data, the normalized quoted spread looks huge for the first few transactions — but the lecture immediately flags this as misleading: those trades got price improvements, so the market wasn't actually as illiquid as the quoted spread implies. That gap is exactly what the next measure fixes.
Effective spread — what actually happened, not what was quoted
The effective spread is backward-looking: it compares the actual transaction price to the midquote the instant before, using the trade direction to keep the sign consistent. It captures price improvements the quoted spread misses — in the Krispy Kreme graph, the effective spread doesn't show that misleading spike for the first three transactions, because it's built from what actually happened, not the posted quote. It also captures the flip side: a genuinely large trade that moves the price a lot will show up as a wide effective spread, correctly reflecting real price impact rather than a data artifact.
- Context
- The lecture's own numbers: a market buy for 1,000 shares executes at an average of 75.50, midquote just before was 75.45.
- Algo-relevant?
- Yes — this is exactly how a backtest measures whether a strategy's fills were actually good, after the fact.
- What's applied
- Effective half-spread = d × (p − m), where d is +1 for buyer-initiated, −1 for seller-initiated.
- Action
- A backtest or live TCA (transaction cost analysis) system logs the midquote at the moment before every fill and computes this number per trade, then averages across many trades — a single trade's number is too noisy to act on.
- Why
- It's the only spread measure that reflects what the algorithm actually paid, including any price improvement it received — the quoted spread alone would overstate the real cost.
| Quantity | Value |
|---|---|
| Execution price (p) | 75.50 |
| Midquote just before (m) | 75.45 |
| Effective half-spread (d=+1) | 0.05 (0.067% of midquote) |
What this means: the order cost 5 cents/share above the fair mid-price at the moment it was sent — a real, small cost, distinct from whatever the stock does afterward. This is the number a broker's TCA report would show for this fill; a broker averaging 0.067% across thousands of fills is directly comparable to another broker's number, which is exactly why this measure is used for broker performance evaluation.
Realized spread — the dealer's actual profit, not the trader's cost
Same construction as the effective spread, but the benchmark midquote is taken after a delay Δ (the lecture uses 5 transactions, arbitrarily) instead of before. The reasoning: a dealer who sells at the ask doesn't get to keep the whole effective spread as profit, because the trade itself moves the market. If someone buys because they have information the price is too low, that pressure pushes future quotes up — so the dealer, who's now short, has to buy back the position at a worse price later. The realized spread nets that out, and in the Krispy Kreme data it's sometimes even negative — the dealer loses money on some trades, which is the whole reason dealers exist as compensated risk-bearers rather than free lunches.
- Context
- Realized spread ≈ effective spread minus the post-trade price drift in the direction of the trade — the lecture frames this as the dealer/market-maker's real economics.
- Algo-relevant?
- Yes, directly — this is the correct P&L metric for a market-making algorithm, not the effective spread.
- What's applied
- Realized spread = effective spread − adverse post-trade price movement, measured Δ periods later.
- Action
- A market-making bot should track realized spread, not effective spread, when deciding whether its quoting strategy is actually profitable — effective spread alone overstates its edge.
- Why
- Because the dealer's counterparty is sometimes informed — someone who knew the price was about to move. The realized spread is what's left after that adverse selection cost is paid.
| Scenario | Unwind price | Profit per share |
|---|---|---|
| Quotes unchanged (naive case) | at the original ask | + full effective spread |
| Quotes drifted against the dealer | lower ask, lower bid | much smaller, or negative |
What this means: the effective spread the dealer "earned" at the moment of the trade is not the same as what they keep — if the market moves against their new position before they can unwind it, part or all of that spread is given back. A market maker who only tracks effective spread will consistently overestimate how profitable their strategy actually is.
Missing the trade-direction data? The Lee-Ready algorithm
Effective and realized spread both need to know whether each trade was buyer- or seller-initiated — data that isn't always available. Lee and Ready's 1991 rule: if the trade price is closer to the ask, call it buyer-initiated; closer to the bid, seller-initiated; exactly at the midquote, use the "tick test" — compare to the previous transaction price (an uptick means buy, a downtick means sell). Applied to the Krispy Kreme data, this correctly classified all but one of the 30 trades. A far larger test — Odders-White (2000), over 400,000 NYSE transactions — found the algorithm gets it right about 85% of the time. Better than the 50% you'd get guessing randomly, but not perfect — it struggles most exactly at the midpoint, on small trades, and on very liquid, large-cap stocks (all cases where trades cluster close to the midquote to begin with).
No quote data at all? Roll's measure
If you can't observe bid/ask quotes at all — only a series of transaction prices — Roll (1984) shows you can still back out an estimate of the spread. The model assumes the midquote follows a random walk, orders are a random 50/50 mix of buys and sells that carry no information, and the spread is constant. Under those assumptions, buy and sell orders bounce the price between ask and bid ("bid-ask bounce"), which creates negative serial correlation in price changes — a buy today tends to be followed by a relatively lower price tomorrow, on average. That negative covariance is measurable from price data alone, and Roll's formula converts it directly into a spread estimate. Applied to the Krispy Kreme data, it gives about 0.01 (one basis point) — close to the roughly 0-1 basis point range the other spread measures showed, though it can't see the outlier price-improved trades the quoted spread wrongly flagged.
Price impact, Hasbrouck, and Amihud — depth as a number
The price impact coefficient asks: how much does the midquote move per unit of net order imbalance (buy value minus sell value)? In the Krispy Kreme data, it comes out around 0.15 — a €100,000 imbalance moves the next period's price by about 15 cents, which only makes sense once you know the stock trades around €3, i.e. roughly a 5% move for a fairly large imbalance. The Hasbrouck measure is nearly the same idea but uses unsigned trading volume instead of signed imbalance — useful precisely when you don't have (or don't trust) direction data, and popular in practice for that reason. It's also sensitive to the level of data aggregation, since volume, unlike imbalance, keeps growing as you aggregate over longer windows. The Amihud measure is a close cousin: a ratio (|return| / volume) instead of a regression slope, same interpretation, more volatile transaction-by-transaction but more useful averaged over longer periods.
VWAP — judging your broker, not the market
Volume-weighted average price shifts the question from "how liquid is this market" to "how well did my broker execute my order." VWAP is just the average transaction price over a period, weighted by size. If your broker bought your shares at $50 but the day's VWAP was $43, that's a red flag. Institutional investors — pension funds especially — lean on VWAP because their trades are large enough that price impact is a real concern. But VWAP is gameable: if a single large order makes up most of the day's volume, its own execution price is mechanically close to VWAP almost by construction, which makes the benchmark nearly meaningless for exactly the trades that matter most.
This is the direct link to VWAP execution algorithms — a whole category of trading algo whose explicit goal is to track the VWAP benchmark by shaping its own participation to match historical intraday volume patterns. The gaming problem the lecture describes cuts both ways: a VWAP algo that dominates the day's volume is being graded against a benchmark it's largely creating itself, which is exactly why institutional trading desks also track implementation shortfall (next section) as a check VWAP alone can't provide.
Implementation shortfall — the measure that actually matters for algo execution
Every measure so far is static — it prices one trade at one instant. Implementation shortfall adds the dimension that matters most for a real trading strategy: time, and the risk of not finishing at all. Perold's (1988) framework: you decide at time 0 to buy q shares (midquote m0). By time t, only a fraction κ is filled, at average price p̄, and the stock is now at mt. The full decomposition:
IS = q(mt − m0) − κq(mt − p̄)
= κq(p̄ − m0) + (1 − κ)q(mt − m0)
execution cost opportunity costExecution cost: what you actually paid vs. the price when you decided to trade — the familiar cost of illiquidity. Opportunity cost: what the unfilled portion cost you, in whichever direction the price moved while you were waiting. This is a real, structural trade-off: trading patiently (limit orders) lowers execution cost but raises the risk — and cost — of not finishing; trading aggressively does the opposite.
- Context
- The lecture's own worked case: intend to buy 3,500 shares; broker fills 3,400 across the first ~28 of 30 transactions.
- Algo-relevant?
- Yes — this is literally the objective function most execution algorithms are built to minimize.
- What's applied
- κ = 3,400/3,500 ≈ 0.971 — almost the whole order got filled, so almost all of the shortfall has to come from execution cost, not opportunity cost.
- Action
- An algorithm can see this in real time: as κ climbs toward 1, the opportunity-cost term shrinks toward zero automatically (its weight is 1−κ) — the remaining risk is entirely about the price paid on the filled shares, not on what's left unfilled.
- Why
- This is the real trade-off every execution algo tunes: trade faster (raise κ quickly) and eat more execution cost, or trade slower and risk more opportunity cost if the price runs away. The lecture's own numbers show what "mostly execution cost" looks like when an order is nearly fully filled.
| Component | Calculation | Value |
|---|---|---|
| Execution cost | 3,000 × (101 − 100) | $3,000 |
| Opportunity cost | 7,000 × (103 − 100) | $21,000 |
| Total implementation shortfall | $24,000 (2.4% of the $1,000,000 paper portfolio) | |
What this means: here only 30% got filled (κ=0.3), so the story flips versus the Krispy Kreme example — most of the $24,000 loss (87.5% of it) is opportunity cost, not execution cost: the broker traded too cautiously while the stock ran away. This is the mirror image of the near-fully-filled case above, and shows exactly why the trade-off is real — filling faster here would have converted opportunity cost into (smaller) execution cost and cut the total loss substantially.
No single measure is enough
The lecture closes on a genuine warning, not a hedge: these measures can disagree. Trading volume and spreads both rise around earnings announcements — so "spread went up" says liquidity fell, while "volume went up" says liquidity rose, from the same event. Price volatility is a bad liquidity proxy for the opposite reason at both extremes: it's low in very liquid markets (prices are stable, large trades barely move them) and low in very illiquid ones (nothing trades, so nothing moves) — the same low number, opposite meanings. Which measure to trust depends on what data you actually have and what question you're actually asking.
Before the next lecture
- 1
Recreate this lecture's graphs and numbers yourself using the full Krispy Kreme dataset (not just the first 30 transactions) from the textbook's companion website.Lecturer's own assigned exercise
- 2
Work the textbook's own implementation shortfall exercise.Lecturer's own assigned exercise
- 3
Read the assigned article on corporate bond market liquidity, and compare how liquidity is measured and behaves there versus in the equity markets this lecture focused on.Lecturer's own assigned exercise
- 4
Pull effective-spread or implementation-shortfall data for a stock you trade (many brokers now provide this) and see which component — execution cost or opportunity cost — actually dominates your own trades.
Which measure matters to which algorithm
Every measure in this lecture answers a slightly different question, which means every algo-trading role from Lecture 1 cares about a different one:
Care about realized spread, not effective spread — effective spread overstates their real edge once adverse post-trade price drift is accounted for.
Are built directly around VWAP tracking or implementation-shortfall minimization — the two measures this lecture spends the most time on, for exactly this reason.
Needs the Lee-Ready algorithm or Roll's measure whenever historical data is missing trade direction or even quotes — most real historical datasets have exactly these gaps.
Uses the price impact coefficient / Hasbrouck / Amihud family to estimate, ahead of time, how much a given order size will move the price — the same problem Lecture 1's "walking the book" example showed concretely.