Microstructure and Execution · Execution
11The Empirics of Price Impact
Buy one per cent of a day’s volume and the price moves, on average, by some amount; buy four per cent and it moves about twice as much, not four times. That the impact of an order grows like the square root of its size is one of the most robust regularities in finance, and nobody designed it. It is also hard to measure: impact is a small average under a large noise, the orders that are measured were sent for reasons that also move prices, and a simulated market can show impact only if it can respond. This chapter measures impact at three scales, a single trade, the flow of an interval and a metaorder, in a reactive simulated market, then fits the square-root law on the firm’s metaorder records and shows how a forecast in their timing biases it.
11.1 The impact of a single trade
Impact is the price move that follows a trade in its direction (One Quant Book 7, chapter 18); chapter 5 measured it per trade, against the mid, at a horizon. The chapter’s market is firm.agentmkt’s population on firm.exchsim: liquidity providers who place one-lot orders relative to the book as it is, a share one tick from the opposite quote and the rest up to ten ticks away with more weight further out (a book whose depth grows away from the price), noise takers whose orders arrive at pre-drawn times with pre-drawn signs and sizes, and fundamentalists who trade toward a hidden value that moves by random jumps. Everything but the noise orders and the value’s jumps reacts to the book.
Definition 11.1 (Impact curve)
An impact curve is the mean price move in the direction of a trade, or of a metaorder, as a function of the time since it started (the response function of a single trade, in trades or seconds) or of its size.
The response to a single market order, merged from its executions, grows with its size in the simulated hour (763 900 shares in 7 639 trades): after one more order it is 0.27 ticks for one lot, 0.58 for two or three, 1.12 for four to seven and 2.34 for eight or more (Figure 11.1, left). It then decays for large orders, to 0.46 ticks fifty orders later, while it grows for one-lot orders, to 0.81: the fundamentalists who know the value send one-lot orders, and their trades predict the price. In this thin book the response is close to proportional to size; in real markets it is strongly concave, partly because large market orders are sent when the book can take them.
Definition 11.2 (Aggregate impact)
Aggregate impact is the mean price change over an interval as a function of the interval’s signed order flow (buys less sells), whoever traded.
Over ten-second intervals the mid moves 2.1 ticks per thousand shares of net buying; the binned means run from ticks for about shares to for (Figure 11.1, right). Aggregate impact is linear for small imbalances and bends at large ones, where the flow meets the book’s deeper levels and the fundamentalists.
mx_impact.single_and_aggregate.11.2 The impact of a metaorder: during and after
Definition 11.3 (Peak impact and impact reversion)
The peak impact of a metaorder is the price move in its direction from its start to its last fill. Impact reversion is the part of that move that disappears after the metaorder ends; what remains after a long time is its permanent impact.
A metaorder’s impact is a few ticks under a price that wanders by several ticks a minute, so a single execution says little. A simulator can do better than the data: run the session twice, with and without the metaorder, with the same pre-drawn noise orders and value jumps, and take the difference of the two price paths. The noise that does not depend on the metaorder cancels; what the providers and fundamentalists do differently does not, because a small change in the book changes their later choices.
Two results follow. First, a replayed background cannot show impact at all. Sent into firm.tape’s replayed flow, a 24 000-share metaorder leaves the mid path exactly where it was without it, at every horizon from 5 to 20 minutes: the replayed liquidity providers keep posting at the prices they posted at in the recording and never learn of the order. Second, in the reactive market (Figure 11.2), 30 children over ten minutes of a 24 000-share buy, 3.2% of the hour’s 749 200 shares, move the price 6.3 ticks halfway through (standard error 1.9 over six sessions) and 7.8 (2.2) at the end; five minutes after the end it is (1.5): the fundamentalists have pulled it back. The 6 000- and 1 500-share orders end at 2.6 (1.9) and 2.4 (0.9) ticks, within their errors of each other. Six sessions resolve the largest order and not the curve; the square-root law was found in hundreds of thousands of real metaorders, as in Bacry, Iuga, Lasnier and Lehalle (2015), and in the trading profiles of Moro and co-authors (2009).
mx_impact.counterfactual.11.3 The square-root law
Definition 11.4 (Impact prefactor)
In the square-root law with , where is the peak impact as a fraction of the price, the daily volatility, the metaorder’s size and the daily volume, the impact prefactor is the dimensionless constant, of order one, that sets the level.
With and , buying 1% of the day’s volume costs about basis points of impact and 4% about 32: four times the size, twice the impact. Toth and co-authors (2011) explained the law by a book whose average supply and demand are V-shaped and vanish at the price, so that large metaorders must be split and the local liquidity is anomalously small; Zarinelli, Treccani, Farmer and Lillo (2015) found that in US data the square root fits over about two orders of magnitude of size and a logarithm over almost five. Loeb (1983) had tabulated trading costs rising with order size long before.
The firm’s records are the right place to fit it: many metaorders across stocks, with their sizes, durations, volatilities and fills. The chapter simulates them: 2 000 metaorders on 50 stocks, sizes from 0.01% to 5% of the daily volume, durations at a tenth of the volume, a true law , , and a price noise of on each. firm.impactfit.fit_power averages impact over sizes within bins (a single impact can be negative, so logs of individual impacts are useless), fits the log of the bin means on the log of the size (Book 7’s firm.tcost.fit_impact), and bootstraps whole stocks for the intervals.
def fit_power(impact, sigma, participation, bins: int = 20, boot: int = 200, clusters=None,
seed: int = 1) -> dict:
impact, sigma, participation = (np.asarray(a, float) for a in (impact, sigma, participation))
base = fit_impact(impact, sigma, participation, 0.0, bins)
rng = np.random.default_rng(seed)
groups = np.unique(clusters) if clusters is not None else None
ex, et = [], []
for _ in range(boot):
if groups is None: # resample orders
idx = rng.integers(0, len(impact), len(impact))
else: # resample whole stocks
pick = rng.choice(groups, len(groups))
idx = np.concatenate([np.flatnonzero(clusters == g) for g in pick])
f = fit_impact(impact[idx], sigma[idx], participation[idx], 0.0, bins)
ex.append(f["exponent"])
et.append(f["eta"])
def ci(x):
return tuple(np.percentile(x, [2.5, 97.5]))
return {"exponent": base["exponent"], "prefactor": base["eta"], "exponent_ci": ci(ex),
"prefactor_ci": ci(et), "prefactor_sqrt": base["eta_fixed"]}
The fit returns (95% interval 0.39 to 0.56) and (0.55 to 1.66); with the exponent fixed at one half, . The data identify the exponent to about and the prefactor to a factor of two, from 2 000 orders with the true law inside.
11.4 Measurement pitfalls
Definition 11.5 (Alpha contamination)
Alpha contamination is the part of a measured impact that is the price move the order’s owner expected anyway: orders sent because of a forecast move with the forecast, and their impact looks larger than it is.
Suppose 30% of the firm’s metaorders were started because a forecast expected a drift of in their direction over their duration. The same fit returns (0.44 to 0.55) and (1.01 to 2.04); with the exponent fixed, , 62% too high (Figure 11.3). The exponent is untouched because the forecast’s horizon is the order’s duration, which grows with its size, so the drift scales like the impact; only the level is wrong. Removing the forecast from each timed order’s measured impact restores the clean fit exactly; a regression of impact on the forecast would have found a coefficient of 1.54, not one, because larger orders carry both more impact and more forecast.
def panel(seed: int = 1, alpha_share: float = 0.0, a: float = 0.5, n_stocks: int = 50,
per_stock: int = 40, y: float = 0.8, delta: float = 0.5, dur_fixed: float | None = None) -> dict:
"""Impact at completion as a fraction of price: y sigma (Q/V)^delta, plus price noise
sigma sqrt(T / day), plus, for timed orders, the forecast drift a sigma sqrt(T / day) in their
direction. sigma is daily volatility."""
rng = np.random.default_rng(seed)
sig = rng.uniform(0.01, 0.03, n_stocks)
stock = np.repeat(np.arange(n_stocks), per_stock)
n = len(stock)
part = np.exp(rng.uniform(np.log(1e-4), np.log(0.05), n)) # Q / V
dur = np.clip(part / 0.1, 0.002, 0.5) # days, at 10% of volume
if dur_fixed is not None:
dur = np.full(n, dur_fixed)
s = sig[stock]
timed = rng.random(n) < alpha_share
forecast = np.where(timed, a * s * np.sqrt(dur), 0.0)
impact = y * s * part**delta + s * np.sqrt(dur) * rng.standard_normal(n) + forecast
return {"impact": impact, "sigma": s, "participation": part, "stock": stock,
"forecast": forecast, "timed": timed}
mx_impact.panel_fits.The other pitfalls are as common. Noise: the price moves over an order’s life whatever the order does, so small orders’ impact is invisible without many of them, and measuring it over a long fixed horizon biases the exponent down. Selection: only executed orders are recorded, and orders that were cancelled because the price ran away are missing. Overlap: concurrent metaorders of the same firm, or of the market, add their impact to each other’s. Replay: a background that cannot respond shows no impact at all. Every published estimate is a choice about these, which is why estimates of differ more than estimates of .
11.5 Tutorial: the square root in our own data
Goal. Measure impact at three scales in a reactive market, then fit the square-root law on the firm’s metaorders and correct it for their timing. End state: Figures 11.1, 11.2 and 11.3.
- Market.
firm_agentmkt.session(mx_impact.MARKET, seconds, seed, agents);res.tape()for trades and quotes. - Single and aggregate.
firm_impactfit.response(trades, times, mids)andaggregate(…, 10.0, edges). - Metaorders.
mx_impact.counterfactual(): each session with and without aMetaorder;replay_pitfall()for the replayed flow. - Law.
panel(seed, alpha_share)andfit_power(impact, sigma, participation, clusters=stock);decontaminate(impact, forecast); draw withfig_impact.py.
What to change next. Give the providers a flatter placement law (shape 0) and see whether the single-order response becomes concave; fit the panel with a logarithm instead of a power and compare the residuals.
11.6 Build: impact estimation
Purpose. Impact curves and laws from the firm’s fills and market data, for the execution models of chapters 14 and 15, the pre-trade estimates of chapter 19 and Book 7’s cost model.
Interface. orders(trades), response(trades, times, mids, lags, size_edges), aggregate(trades, times, mids, interval, edges), metaorder_path(times, mids, start, end, sign, grid), fit_power(impact, sigma, participation, bins, boot, clusters), decontaminate(impact, forecast). With it, firm.agentmkt (PopulationConfig, Population, Metaorder, session), whose full description is chapter 27’s.
Rules. Executions at one time and sign are one order; responses in orders; binned fits (Book 7’s fit_impact); cluster bootstrap by stock; forecasts subtracted order by order.
Acceptance tests. code/firm/impactfit/tests/: merged orders and a response by hand; the slope of a linear aggregate impact; the exponent and prefactor of a planted law inside their intervals. code/firm/agentmkt/tests/: a deterministic population, shared exogenous flow, persistent signs, a metaorder that trades its plan.
Stretch. Impact surfaces in size and duration; decay kernels after completion (chapter 12); the logarithmic law.
Sources and further reading
- T. F. Loeb, “Trading cost: the critical link between investment information and results”, Financial Analysts Journal 39(3), 1983.
- E. Moro, J. Vicente, L. G. Moyano, A. Gerig, J. D. Farmer, G. Vaglica, F. Lillo and R. N. Mantegna, “Market impact and trading profile of hidden orders in stock markets”, Physical Review E 80, 2009.
- B. Tóth, Y. Lemperière, C. Deremble, J. de Lataillade, J. Kockelkoren and J.-P. Bouchaud, “Anomalous price impact and the critical nature of liquidity in financial markets”, Physical Review X 1, 2011.
- E. Bacry, A. Iuga, M. Lasnier and C.-A. Lehalle, “Market impacts and the life cycle of investors orders”, Market Microstructure and Liquidity 1(2), 2015.
- E. Zarinelli, M. Treccani, J. D. Farmer and F. Lillo, “Beyond the square root: evidence for logarithmic dependence of market impact on size and participation rate”, Market Microstructure and Liquidity 1(2), 2015.
11.7 Exercises
Exercise 11.1 ★
With , and a daily volatility of 2%, what impact does the square-root law give for buying 1% and 4% of the day’s volume?
Solution
Solution of Exercise 11.1.
, 16 basis points; , 32 basis points.
Exercise 11.2 ★
In the simulated market, the mid moves 2.1 ticks per thousand shares of net buying over ten seconds. How far should 600 shares of net buying move it, and why is the relation only approximately linear?
Solution
Solution of Exercise 11.2.
About ticks. Small imbalances meet the thin levels near the price and move it proportionally; large ones reach deeper levels and wake the fundamentalists, so the relation bends.
Exercise 11.3 ★
The 24 000-share metaorder moved the price 7.8 ticks by its end and five minutes later. How much of its impact reverted, and what in the market caused it?
Solution
Solution of Exercise 11.3.
All of it, within its error: ticks with a standard error of 1.5. The fundamentalists trade toward the hidden value, which the metaorder did not move, and pull the price back.
Exercise 11.4 ★★
Why does a forecast whose horizon is the order’s duration bias the prefactor but not the exponent?
Solution
Solution of Exercise 11.4.
The forecast drift is and is proportional to at a fixed participation rate, so the drift is proportional to , the same shape as the impact: it adds to the prefactor ( times the share timed, roughly) and leaves the slope.
Exercise 11.5 ★★
Why are the intervals computed by resampling whole stocks rather than single orders?
Solution
Solution of Exercise 11.5.
Orders on one stock share its volatility, its liquidity and its days, so their errors are correlated; resampling single orders treats them as independent and gives intervals too narrow.
Exercise 11.6 ★★
Why does a replayed background show no impact, and what does that imply for backtests on replayed data?
Solution
Solution of Exercise 11.6.
Its orders were recorded in a market without ours: its providers keep posting where they posted and its takers keep taking what they took, whatever we do. A backtest on replayed data has only the mechanical cost of the book we consumed, no response to it, and so underestimates the cost of large orders.
Exercise 11.7 ★★★
Coding. Rerun the panel with every order’s duration fixed at a tenth of a day, with and without the timed orders. Fit the law and explain what you find.
Solution
Solution of Exercise 11.7.
Without timed orders the exponent falls to 0.28 (prefactor with the exponent fixed 0.81); with them, 0.20 (1.24). Over a tenth of a day the noise is the same for every order and swamps the small ones, whose bin means are dominated by noise; the timed orders’ forecast, now the same for every size, flattens the curve further.
Exercise 11.8 ★★★
Find the flaw. “Our fills give an exponent of 0.5, exactly the published value, so our impact model is right and our alpha is not in it.”
Solution
Solution of Exercise 11.8.
The exponent can be right while the level is not: in the simulation, 30% of orders timed by a forecast left the exponent at 0.50 and raised the prefactor by 62%. Check the prefactor against orders without a forecast, or remove the forecast order by order.
11.8 Problem: The Square Root in Our Own Data
Problem 11.1
Weekend problem — the square root in our own data
The execution desk wants a pre-trade impact model and asks research to fit it on the firm’s own metaorders. Measure, fit and check it.
Part I — Small scales.
- Describe the simulated market and what in it reacts.
- Give the response to a market order by size after one order, and after fifty.
- Why does the response of one-lot orders grow with the lag?
- Give the aggregate impact per thousand shares over ten seconds.
Part II — Metaorders.
- How is a counterfactual impact measured in a simulator, and what does it remove?
- What does the replayed background show, and why?
- Give the 24 000-share order’s impact halfway, at the end and five minutes after.
- Why do six sessions not resolve the impact curve?
Part III — The law.
- State the square-root law and compute exercise 1.
- How is the law fitted on the panel, and why in bins?
- Give the exponent and prefactor with their intervals.
- What did Toth and co-authors, and Zarinelli and co-authors, find?
Part IV — Pitfalls and the verdict.
- Define alpha contamination.
- Give the fit with 30% of orders timed by a forecast.
- Why is the exponent unbiased here?
- How is the forecast removed, and what does a regression on it return?
- What happens with a fixed long horizon (exercise 7)?
- List three other measurement pitfalls.
- State the named result: the exponent and prefactor of the square-root law fitted on the firm’s simulated metaorders with confidence intervals, and their bias when order timing carries a forecast.
- In one sentence: what should the desk’s pre-trade model use?
Solution
Solution of Problem 11.1.
1. Providers placing orders relative to the current book, pre-drawn noise orders, fundamentalists trading toward a hidden value; the providers and fundamentalists react. 2. 0.27, 0.58, 1.12 and 2.34 ticks for 1, 2–3, 4–7 and 8+ lots; after fifty orders 0.81, 0.23, 0.68 and 0.46. 3. The informed fundamentalists send one-lot orders, and the price moves toward the value after them. 4. 2.1 ticks. 5. The session with the metaorder less the same session without it, with the same noise orders and value jumps: the exogenous noise cancels. 6. No difference at any horizon: the replayed providers never learn of the order. 7. 6.3, 7.8 and ticks. 8. The price differences after the first child grow with the providers’ different choices; standard errors of 1 to 3 ticks against impacts of a few ticks. 9. , ; 16 and 32 basis points. 10. Mean impact over volatility within size bins, a log-log fit on the bin means, a bootstrap over stocks; single impacts can be negative. 11. (0.39 to 0.56), (0.55 to 1.66); 0.81 with the exponent fixed. 12. A V-shaped average book vanishing at the price, and a square root fitting two orders of magnitude of size with a logarithm fitting five. 13. The price move the order’s owner expected, counted as impact. 14. (0.44 to 0.55), (1.01 to 2.04), 1.31 with the exponent fixed. 15. The forecast’s horizon is the duration, which grows with size, so the drift has the impact’s shape. 16. Subtract each timed order’s forecast; the regression of impact on the forecast gives 1.54, because larger orders carry both. 17. The exponent falls to 0.28 without timed orders and 0.20 with them: noise and the size-independent forecast flatten the curve. 18. Selection of executed orders, overlapping metaorders, replayed backgrounds (and noise). 19. Named result: on 2 000 simulated metaorders with a true law of 0.8 and one half, the fit gives (0.39 to 0.56) and (0.55 to 1.66); with 30% of orders timed by a forecast, and , the prefactor 62% too high with the exponent unchanged. 20. A square root with the prefactor fitted on orders without a forecast, or with each order’s forecast removed.
11.9 Interview questions
Interview question 11.1 ★ trader, researcher
State the square-root impact law and what each term means.
Solution
Solution of Interview question 11.1.
: the price move of a metaorder as a fraction of the price, of order one, daily volatility, the order’s size and daily volume; it holds on average, for orders that are a fraction of daily volume, whatever the execution schedule within broad limits.
What the interviewer is looking for: Each term; what is averaged; the range of validity.
Interview question 11.2 ★★ researcher
How would you estimate the impact of your firm’s metaorders, and what would bias the estimate?
Solution
Solution of Interview question 11.2.
From start to last fill against the arrival mid, normalised by volatility, binned by size over volume, fitted in logs, clustered by stock and day. Biases: forecasts in timing, selection of executed orders, overlap with other orders, noise, and the horizon chosen.
What the interviewer is looking for: Normalisation; binning; clustering; alpha contamination.
Interview question 11.3 ★★ researcher
Why is impact concave in size? Give one explanation.
Solution
Solution of Interview question 11.3.
Liquidity near the price is small and grows away from it (a V-shaped latent book): consuming requires a move whose square grows with . Also, large orders are split and the book refills between children.
What the interviewer is looking for: Latent liquidity; splitting; refill.
Interview question 11.4 ★★ trader
Your backtest on replayed market data shows no cost for a large order beyond the spread. What is wrong?
Solution
Solution of Interview question 11.4.
The replayed market cannot respond: only the book the order consumed is charged, and nobody moves prices against it. Use an impact model or a reactive simulator.
What the interviewer is looking for: Replay limitation; a fix.
Interview question 11.5 ★★ researcher
How much of a metaorder’s impact is permanent, and what does the answer depend on?
Solution
Solution of Interview question 11.5.
Part of the peak reverts after completion and part remains; how much depends on how informed the flow is, how fast liquidity returns and what else trades. In the simulation all of it reverted, because nothing in it learns from the order; in real data a permanent part is usual.
What the interviewer is looking for: Reversion; information; horizon.
Interview question 11.6 ★★★ researcher
Your alpha team’s orders show twice the impact of the index team’s orders of the same size. Is their execution worse?
Solution
Solution of Interview question 11.6.
Not necessarily: their orders are timed by forecasts, and the forecast drift is counted as impact. Compare after removing the forecast, or on orders sent without one; the simulation’s timed orders showed a 62% higher prefactor with the same execution.
What the interviewer is looking for: Alpha contamination; a fair comparison.