---
title: "Measuring Market Making and Execution"
book: "Research Craft: Predictors, Backtests, Measurement, Portfolios"
subject: quant
language: en
chapter: 23
exercises: 8
source: https://one-course.com/books/quant/7/en/chapter/23-measuring-market-making-and-execution
---

# Chapter 23 — Measuring Market Making and Execution

A market maker quoting one lot on each side of a $100 stock ends its year $945 000 down. Its books show [spread capture](#def-rs-measuring-market-making-and-execution-pnl) of $+\$480\,000$, adverse selection of $-\$1.23$ million, inventory losses of $-\$145\,000$ and fees of $-\$56\,000$. The year is twelve simulated hours of `firm.tape` scaled to 252 days of 6.5 hours, and the decomposition is the point: it says that the quotes earn their half spread and then lose more than twice as much to the traders who hit them, within twenty seconds; that 42% of the fills met informed orders, which cost 1.85 ticks a share, while the uninformed fills made money; and that a filter which trades 59% less cuts the loss by 61% without making a single fill much better. This chapter measures the fills of a market maker and of an execution algorithm, with `firm.markout`: [mark-out curves](#def-rs-measuring-market-making-and-execution-curve), fill statistics, a P&L decomposition that adds up exactly, and [transaction cost analysis](#def-rs-measuring-market-making-and-execution-tca).

## 23.1 Mark-out curves

**Definition 23.1 (Mark-out curve).**

The *mark-out curve* of a set of fills is the quantity-weighted average, as a function of the horizon $h$, of each fill’s mark-out (Book 2, chapter 15), $s_i\,(m(t_i + h) - p_i)$ for a fill of side $s_i$ at price $p_i$ and time $t_i$, against a reference price $m$: the mid, or the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro) (chapter 8).

The chapter’s market maker trades inside `firm.tape` as chapter 19’s live stand-in: one lot on the best bid and one on the best ask, within five lots of inventory, with latencies it draws itself (market data 0.02 seconds plus an exponential of mean 0.02, order entry 0.03 plus 0.02) and a fee of 0.05 tick a share. Over twelve one-hour sessions it posts 18 000 lots and 8 144 are filled. Each fill’s counterparty is known, because the tape records whether the market order that hit the quote was informed. [Figure 23.1](#fig-rs-measuring-market-making-and-execution-curve) shows the mark-outs: 0.43 tick a share at the fill against the mid just before it (the half spread, less when the spread was one tick and the fill came at a stale level), falling to $-0.67$ at twenty seconds. Uninformed fills keep a positive mark-out, 0.18 at twenty seconds and 0.52 at five minutes; informed ones fall to $-1.85$ and $-2.71$. Against the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro) the fill earns only 0.19 tick at $h = 0$: the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro) already leans towards where the mid is going, and measures the spread that was really captured.

The curve’s horizon matters as much as its level. Up to a few seconds the mark-out mixes spread and noise; beyond some horizon it stops moving, because the information in the trade has been absorbed. For the chapter’s quoter the pooled curve stays within two standard errors of its five-minute value from twenty seconds on: the mark-outs settle at twenty seconds, and that is the horizon at which adverse selection is measured. Brogaard, Hendershott and Riordan found the same shape in real data: high-frequency traders’ liquidity-supplying orders are adversely selected, and their trading predicts price changes over horizons of seconds.

![Mark-out curves of the touch quoter’s fills over twelve simulated hours, with a two-standard-error band for all fills. The dotted line marks twenty seconds, where the curve settles. Data: rs_markout.curves.](https://one-course.com/images/onecourse/chapters/quant-7/rs-measuring-market-making-and-execution/fig-0fbcb9751ecf.svg)

***Figure 23.1.** [Mark-out curves](#def-rs-measuring-market-making-and-execution-curve) of the touch quoter’s fills over twelve simulated hours, with a two-standard-error band for all fills. The dotted line marks twenty seconds, where the curve settles. Data: `rs_markout.curves`.*

## 23.2 Fill rates and hit ratios

**Definition 23.2 (Fill rate, hit ratio).**

The *fill rate* of a set of passive orders is the quantity filled over the quantity posted. The *hit ratio* of a dealer answering requests for quotes is the share of its quotes that the clients trade on.

A [fill rate](#def-rs-measuring-market-making-and-execution-fill) says how much of what the market maker offered was taken, and by itself cannot say whether that is good: quotes are taken most readily when they are wrong. The chapter’s second quoter withdraws its bid whenever the bid queue holds less than 30% of the size at the touch, and its ask symmetrically, because a thin queue predicts that the price will move through it (chapter 8):

| twelve simulated hours | touch quoter | with the imbalance filter |
| --- | --- | --- |
| lots posted, lots filled | 18 000, 8 144 | 16 391, 3 309 |
| [fill rate](#def-rs-measuring-market-making-and-execution-fill) | 45% | 20% |
| share of fills against informed orders | 42% | 40% |
| mark-out at the fill, against the mid | 0.43 | 0.52 |
| against the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro) | 0.19 | 0.44 |
| mark-out at twenty seconds | $-0.67$ | $-0.53$ |
| P&L per lot filled | $-\$0.85$ | $-\$0.81$ |

The filter fills less than half as often, and its fills are made when the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro) sits near the mid, so it captures more of the spread (0.44 tick against the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro) rather than 0.19); but the traders who hit it are as often informed as before, and per lot it loses nearly as much. A dealer’s [hit ratio](#def-rs-measuring-market-making-and-execution-fill) has the same ambiguity on a request-for-quote platform: a dealer who wins every request is quoting too well.

## 23.3 The market maker’s P&L, decomposed

**Definition 23.3 (Spread capture, adverse-selection cost, inventory P&L).**

For a fill of side $s$, quantity $q$ and price $p$ at time $t$, with reference price $m$, horizon $H$ and the end of the period $T$: the *spread capture* is $sq\,(m(t) - p)$; the *adverse-selection cost* is $sq\,(m(t + H) - m(t))$; the *inventory P&L* is $sq\,(m(T) - m(t + H))$. Summed over fills, with fees, the three add up to the P&L of the fills with the final position marked at $m(T)$.

The identity is exact: $m(T) - p = (m(t) - p) + (m(t+H) - m(t)) + (m(T) - m(t+H))$ for each fill ([Listing 23.2](#lst-rs-measuring-market-making-and-execution-decompose)). What it leaves to judgement is the horizon $H$: too short, and the adverse selection still unfolding after it is booked as inventory; too long, and inventory risk the market maker chose to carry is booked as adverse selection. The settling horizon of the [mark-out curve](#def-rs-measuring-market-making-and-execution-curve) is the natural choice, twenty seconds here. Menkveld’s decomposition of a real high-frequency market maker on Chi-X and Euronext has the same structure: a profit of €1.55 a trade on the spread net of fees, a positioning loss of €0.68 (a profit on positions held less than five seconds, a loss on longer ones), a gross profit of €0.88.

![The P&L of the two quoters over twelve simulated hours, decomposed with a horizon of twenty seconds. Data: rs_markout.decomposition.](https://one-course.com/images/onecourse/chapters/quant-7/rs-measuring-market-making-and-execution/fig-4fbb16424b91.svg)

***Figure 23.2.** The P&L of the two quoters over twelve simulated hours, decomposed with a horizon of twenty seconds. Data: `rs_markout.decomposition`.*

Over the twelve hours the touch quoter captures $3 519 of spread, loses $8 977 to adverse selection within twenty seconds, $1 060 on inventory after it, and pays $407 of fees: a loss of $6 925 ([Figure 23.2](#fig-rs-measuring-market-making-and-execution-decomp)). Per share, the spread brings 0.43 tick and adverse selection takes 1.10, which is the mark-out of $-0.67$ at twenty seconds. The filtered quoter captures $1 734, loses $3 483 and $771, pays $165: $-\$2\,685$. Neither is a business; the decomposition says what would have to change (fewer informed counterparties, or a wider spread) and that inventory is not the problem.

## 23.4 Measuring execution

**Definition 23.4 (Delay cost, opportunity cost, VWAP slippage).**

For a parent order decided at price $P_d$, released at the [arrival price](https://one-course.com/books/quant/7/en/chapter/19-simulation-versus-live#def-rs-simulation-versus-live-calibration) $P_a$, filled for $Q$ of its target $X$ at average price $\bar P$, with the price $P_e$ at its end: the *delay cost* is $sQ(P_a - P_d)$, the execution cost $sQ(\bar P - P_a)$, the *opportunity cost* $s(X - Q)(P_e - P_d)$; with fees they add up to the [implementation shortfall](https://one-course.com/books/quant/7/en/chapter/19-simulation-versus-live#def-rs-simulation-versus-live-calibration) (chapter 19). The *VWAP slippage* is $s(\bar P - \mathrm{VWAP})$, the average price against the market’s [volume-weighted average price](https://one-course.com/books/quant/7/en/chapter/2-market-data-for-research#def-rs-market-data-for-research-bar) over the order’s life.

The chapter’s parent order buys 300 lots: decided at minute 10, released at minute 11, due by minute 30. Every twenty seconds the executor rests the next step’s lots at the best bid and sends a market order for whatever is more than eight lots behind a straight-line schedule. In one session (seed 61) it fills 28 700 shares, 43% passively on average over the sessions, and its report reads:

| [transaction cost analysis](#def-rs-measuring-market-making-and-execution-tca), one order | ticks a share |
| --- | --- |
| [delay cost](#def-rs-measuring-market-making-and-execution-costs) | 0.00 |
| execution cost against arrival | $-7.83$ |
| [opportunity cost](#def-rs-measuring-market-making-and-execution-costs) (1 300 shares unfilled) | $-0.91$ |
| fees | 0.05 |
| [implementation shortfall](https://one-course.com/books/quant/7/en/chapter/19-simulation-versus-live#def-rs-simulation-versus-live-calibration) | $-8.69$ |
| [VWAP slippage](#def-rs-measuring-market-making-and-execution-costs) | $-1.10$ |

A negative shortfall of 8.69 ticks (8.7 basis points at $100) looks like a triumph of execution. It is the market: the mid fell over those nineteen minutes, and a buyer who arrives before a fall looks brilliant against arrival. Over the twelve sessions the shortfall averages $-2.00$ ticks a share with a standard error of 2.73; its execution part, $-4.68$ (2.09), splits into the drift of the mid from arrival to each fill, $-4.78$ (2.07), and the price paid against the mid just before the fill, $+0.10$ (0.03). Only the second is the algorithm’s doing, and only it is measured precisely. Even the [delay cost](#def-rs-measuring-market-making-and-execution-costs), $+2.83$ (0.94), is chance: the same twelve sessions run without the order rise by 2.92 ticks in that minute. And the simulator allows what no desk can do: run the same session without the order. The mid’s move from minute 11 to minute 30 is $-9.71$ ticks with the order and $-9.96$ without it, an impact of $+0.25$ (0.24). In this market the efficient price does not respond to the order, so its lasting impact is nil by construction; a real market’s would not be (chapter 27).

![Twelve parent orders: the execution cost measured against the arrival price follows the market’s own move over the order’s life (measured in the same session run without the order); the price paid against the mid at each fill does not. Data: rs_markout.tca_all.](https://one-course.com/images/onecourse/chapters/quant-7/rs-measuring-market-making-and-execution/fig-b5010df2d3a5.svg)

***Figure 23.3.** Twelve parent orders: the execution cost measured against the [arrival price](https://one-course.com/books/quant/7/en/chapter/19-simulation-versus-live#def-rs-simulation-versus-live-calibration) follows the market’s own move over the order’s life (measured in the same session run without the order); the price paid against the mid at each fill does not. Data: `rs_markout.tca_all`.*

## 23.5 Transaction cost analysis

**Definition 23.5 (Transaction cost analysis).**

*Transaction cost analysis* (TCA) is the measurement of the costs of executed orders against benchmarks (the decision and [arrival prices](https://one-course.com/books/quant/7/en/chapter/19-simulation-versus-live#def-rs-simulation-versus-live-calibration), VWAP, the close), decomposed into parts attributable to decisions (delay, the choice to leave quantity unfilled) and to execution (the price paid against the market at each fill), and aggregated over many orders to compare brokers, algorithms and traders.

The lesson of the twelve orders is that TCA is a statistical exercise with a large noise term. An arrival-price shortfall has the variance of the market’s move over the order’s life, which dwarfs the cost being measured; averages over many orders, conditioning on the market’s move (regressing shortfall on the contemporaneous return of the stock or its sector), and cost measures anchored at each fill (the price paid against the mid, the fill’s own mark-out) are what make it informative. [VWAP slippage](#def-rs-measuring-market-making-and-execution-costs) has less noise (0.40 tick with a standard error of 0.61 here) because the benchmark moves with the market, and it can be gamed for the same reason: an algorithm that trades with the volume matches VWAP whatever it costs. A TCA report should state the benchmark, the decomposition, the standard error, and the number of orders, and compare algorithms by randomised experiment (chapter 21).

## 23.6 Tutorial: the flat year

**Goal.** Run two market makers and an executor inside `firm.tape`, draw the [mark-out curves](#def-rs-measuring-market-making-and-execution-curve) by counterparty, decompose the P&L, and write the TCA of a parent order. **End state:** the two tables and Figures [23.1](#fig-rs-measuring-market-making-and-execution-curve), [23.2](#fig-rs-measuring-market-making-and-execution-decomp) and [23.3](#fig-rs-measuring-market-making-and-execution-tca).

1. **Mark-outs**: the reference in force at each time, and every fill against it at every horizon. `def ref_at (ref_t, ref_px, t): i = np.searchsorted(np.asarray(ref_t), np.asarray(t, float ), side=" right " ) - 1 return np.asarray(ref_px, float )[np.clip(i, 0 , len (ref_px) - 1 )] def markouts (t, side, px, ref_t, ref_px, horizons): t, side, px = (np.asarray(a, float ) for a in (t, side, px)) return np.column_stack([side * (ref_at(ref_t, ref_px, t + h) - px) for h in horizons])` **Listing 23.1.** Mark-outs against a reference price path. code/firm/markout/firm_markout.py
2. **The decomposition** that adds up. `def mm_decompose (t, side, px, qty, ref_t, ref_px, H: float , fee: float = 0.0 , t_end: float | None = None ): """For each fill, ref(T) - px = [ref(t) - px] + [ref(min(t + H, T)) - ref(t)] + [ref(T) - ref(min(t + H, T))]: spread capture, adverse selection up to H, inventory after H; times side * qty and summed. The total is the P&L of the fills with the final position marked at ref(T), minus fees (fee per unit traded).""" t, side, px, qty = (np.asarray(a, float ) for a in (t, side, px, qty)) T = float (ref_t[-1 ]) if t_end is None else t_end r0 = ref_at(ref_t, ref_px, t) rh = ref_at(ref_t, ref_px, np.minimum(t + H, T)) rT = float (ref_at(ref_t, ref_px, [T])[0 ]) w = side * qty out = {" spread " : float (w @ (r0 - px)), " adverse " : float (w @ (rh - r0)), " inventory " : float (w @ (rT - rh)), " fees " : -fee * float (qty.sum())} out[" total " ] = out[" spread " ] + out[" adverse " ] + out[" inventory " ] + out[" fees " ] return out` **Listing 23.2.** Spread capture, adverse selection, inventory, fees. code/firm/markout/firm_markout.py
3. **The shortfall** of a parent order. `def shortfall (side: int , target: float , decision_px: float , arrival_px: float , fills, end_px: float , fee: float = 0.0 ): """Implementation shortfall of a parent order against the paper portfolio traded at the decision price, as a cost (positive = worse): delay (decision to arrival, on the filled quantity), execution (fills against arrival), opportunity (the unfilled quantity's move from decision to the end), fees. fills: [(price, qty)].""" f = np.asarray(fills, float ).reshape(-1 , 2 ) q = float (f[:, 1 ].sum()) cost = {" delay " : side * q * (arrival_px - decision_px), " execution " : side * float (f[:, 1 ] @ (f[:, 0 ] - arrival_px)), " opportunity " : side * (target - q) * (end_px - decision_px), " fees " : fee * q} cost[" total " ] = sum (cost.values()) cost[" filled " ] = q return cost` **Listing 23.3.** Implementation shortfall in four parts. code/firm/markout/firm_markout.py
4. **Run** `rs_markout.curves` , `decomposition` , `settle` , `execution` , `tca_all` and `fig_markout.py` .

**What to change next.** Quote one tick behind the touch and see the [fill rate](#def-rs-measuring-market-making-and-execution-fill) fall and the per-lot mark-out rise; give the executor a signal (the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro)) and measure whether its price paid against the mid improves.

## 23.7 Build: the measurement module

**Purpose.** Every fill the firm makes, passive or aggressive, is measured the same way: mark-outs at standard horizons against the mid and the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro), grouped by counterparty, venue and strategy; market-making P&L decomposed; every parent order analysed.

**Interface.** `microprice`, `ref_at(ref_t, ref_px, t)`, `markouts(t, side, px, ref_t, ref_px, horizons)`, `curve(M, qty, groups)`, `settle_horizon(mean, horizons, tol)`, `fill_rate`, `hit_ratio`, `mm_decompose(t, side, px, qty, ref_t, ref_px, H, fee, t_end)`, `shortfall(side, target, decision_px, arrival_px, fills, end_px, fee)`, `vwap_slippage`, `tca_report`.

**Rules.** The reference is the one in force before the fill; the decomposition adds up to the marked P&L to the cent; horizons are fixed firm-wide; every average is reported with its standard error and its count.

**Acceptance tests.** `code/firm/markout/tests/`: references and mark-outs by hand; a weighted curve; the settling horizon; the decomposition equal to the P&L of random fills with the position marked at the end; the shortfall equal to the paper portfolio’s gain minus the real one’s; [VWAP slippage](#def-rs-measuring-market-making-and-execution-costs), [fill rate](#def-rs-measuring-market-making-and-execution-fill) and [hit ratio](#def-rs-measuring-market-making-and-execution-fill) by hand.

**Stretch.** Mark-outs against a fair-value model; regression-adjusted TCA (shortfall on the market’s move); counterparty scorecards for a dealer.

Sources and further reading

- A. J. Menkveld, “High frequency trading and the new market makers”, *Journal of Financial Markets* 16(4), 2013 (Tinbergen Institute discussion paper 11-076, 2011).
- J. Brogaard, T. Hendershott and R. Riordan, “High-frequency trading and price discovery”, *Review of Financial Studies* 27(8), 2014.
- A. F. Perold, “The implementation shortfall: paper versus reality”, *Journal of Portfolio Management* 14(3), 1988.

## 23.8 Exercises

**Exercise 23.1 ★.**

A buy fill at 99.99 when the mid was 100.00; twenty seconds later the mid is 99.97, at the end of the day 100.02. Split the fill’s P&L per share into [spread capture](#def-rs-measuring-market-making-and-execution-pnl), adverse selection and inventory (in ticks of 0.01).

**Solution of Exercise 23.1.**

[Spread capture](#def-rs-measuring-market-making-and-execution-pnl) $100.00 - 99.99 = +1$ tick; adverse selection $99.97 - 100.00 = -3$ ticks; inventory $100.02 - 99.97 = +5$ ticks; the total, $100.02 - 99.99 = +3$ ticks, is their sum.

**Exercise 23.2 ★.**

The touch quoter posted 18 000 lots and 8 144 were filled. What is its [fill rate](#def-rs-measuring-market-making-and-execution-fill)? Why is a higher [fill rate](#def-rs-measuring-market-making-and-execution-fill) not better?

**Solution of Exercise 23.2.**

$8\,144/18\,000 = 45\%$. Quotes are filled most readily when they are wrong (the price is about to move through them), so a higher [fill rate](#def-rs-measuring-market-making-and-execution-fill) can mean more adverse selection; the filtered quoter fills 20% and loses less.

**Exercise 23.3 ★.**

The spread brings 0.43 tick a share and adverse selection to twenty seconds takes 1.10. What is the mark-out at twenty seconds?

**Solution of Exercise 23.3.**

$0.43 - 1.10 = -0.67$ tick a share, the curve’s value at twenty seconds.

**Exercise 23.4 ★★.**

Why does the choice of the horizon $H$ not change the total of the decomposition? Which components does it move, and in which direction when $H$ is too short?

**Solution of Exercise 23.4.**

For each fill the three terms telescope to $m(T) - p$ whatever $H$ is. $H$ moves the boundary between adverse selection and inventory: too short, and the adverse move still unfolding after $H$ is booked as inventory (adverse selection looks smaller, inventory worse); too long, and chosen inventory risk is booked as adverse selection.

**Exercise 23.5 ★★.**

A buy order of 100 shares is decided at 50.00, released at 50.20, filled 80 shares at an average of 50.40; the price is 51.00 at its end; fees are 0.01 a share. Compute the delay, execution and [opportunity costs](#def-rs-measuring-market-making-and-execution-costs) and the shortfall.

**Solution of Exercise 23.5.**

Delay $80 \times 0.20 = 16$; execution $80 \times (50.40 - 50.20) = 16$; opportunity $20 \times (51.00 - 50.00) = 20$; fees $0.80$; shortfall $52.80, which is the paper portfolio’s gain of $100 minus the real one’s $47.20.

**Exercise 23.6 ★★.**

The imbalance filter cut the loss from $6 925 to $2 685. How much of that is fewer fills and how much better fills?

**Solution of Exercise 23.6.**

The loss fell by $4 240. At the touch quoter’s loss per lot ($0.85), the filtered quoter’s 3 309 lots would have lost $2 814: fewer fills account for $4 111 (97%), better fills for $129.

**Exercise 23.7 ★★★.**

*Coding.* Scale the chapter’s twelve-hour decomposition of the touch quoter to a year of 252 days of 6.5 hours, and state what the scaling assumes.

**Solution of Exercise 23.7.**

$6.5 \times 252 = 1\,638$ hours, 136.5 times the twelve simulated: [spread capture](#def-rs-measuring-market-making-and-execution-pnl) $+\$480\,000$, adverse selection $-\$1.23$ million, inventory $-\$145\,000$, fees $-\$56\,000$, total $-\$945\,000$. The scaling assumes every hour of the year is like the simulated ones: the same activity, no open or close, no news, no change of competitors.

**Exercise 23.8 ★★★.**

*Find the flaw.* “Our new execution algorithm beat arrival by 8.7 basis points on its first order, so it is the best algorithm we have.”

**Solution of Exercise 23.8.**

One order’s shortfall against arrival is dominated by the market’s move over its life: the chapter’s seed-61 order beat arrival by 8.69 ticks because the price fell, and the twelve orders’ average of $-2.00$ has a standard error of 2.73. Measure the price paid against the mid at each fill, average over many orders with standard errors, condition on the market’s move, and compare algorithms by randomised experiment.

## 23.9 Problem: The Flat Year

**Problem 23.1.**

Weekend problem — the market maker’s books

The chapter’s two quoters and its executor, in twelve simulated hours of `firm.tape`.

**Part I — Mark-outs.**

1. What is the touch quoter’s mark-out at the fill, against the mid and against the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro) , and why do they differ?
2. What are the informed and uninformed mark-outs at twenty seconds and five minutes?
3. What share of the fills met informed orders?
4. At which horizon does the curve settle, by which rule?

**Part II — Fills.**

5. Give both quoters’ lots posted, lots filled and [fill rates](#def-rs-measuring-market-making-and-execution-fill) .
6. What does the imbalance filter change in the mark-outs, and what does it not change?
7. What is each quoter’s P&L per lot?

**Part III — The decomposition.**

8. Decompose the touch quoter’s twelve hours at twenty seconds.
9. Decompose the filtered quoter’s.
10. How do the spread and adverse-selection components per share relate to the [mark-out curve](#def-rs-measuring-market-making-and-execution-curve) ?
11. What does Menkveld’s decomposition of a real market maker look like?

**Part IV — Execution and the verdict.**

12. Give the one-order TCA report of seed 61.
13. Average the shortfall and its parts over the twelve orders, with standard errors.
14. Which part is the algorithm’s doing?
15. What is the order’s impact on the mid, measured by the counterfactual, and why is it small here?
16. State the *named result* : the touch quoter’s year decomposed into [spread capture](#def-rs-measuring-market-making-and-execution-pnl) , adverse selection, inventory and fees, and the horizon at which its mark-outs settle.
17. What would the market maker have to change to break even?
18. How should a desk compare two execution algorithms?
19. What should every TCA report state?
20. In one sentence: what does a [mark-out curve](#def-rs-measuring-market-making-and-execution-curve) measure?

**Solution of Problem 23.1.**

1. 0.43 tick against the mid, 0.19 against the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro) : the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro) leans towards the next move, so part of the apparent half spread is already lost at the fill.
2. Informed: $-1.85$ and $-2.71$ . Uninformed: $+0.18$ and $+0.52$ .
3. 42%.
4. Twenty seconds: from there on the curve stays within two standard errors of its five-minute value.
5. Touch quoter 18 000 posted, 8 144 filled, 45%; filtered 16 391, 3 309, 20%.
6. It raises the spread captured (0.52 against the mid, 0.44 against the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro) ) and the twenty-second mark-out ( $-0.53$ against $-0.67$ ); it does not reduce the share of informed counterparties (40% against 42%).
7. $-\$0.85$ and $-\$0.81$ .
8. [Spread capture](#def-rs-measuring-market-making-and-execution-pnl) $3 519, adverse selection $-\$8\,977$ , inventory $-\$1\,060$ , fees $-\$407$ , total $-\$6\,925$ .
9. $1 734, $-\$3\,483$ , $-\$771$ , $-\$165$ , total $-\$2\,685$ .
10. Per share they are the curve’s value at the fill (0.43) and its fall to the horizon ( $-1.10$ ); their sum is the twenty-second mark-out.
11. €1.55 a trade on the spread net of fees, a positioning loss of €0.68 (a gain on positions under five seconds, a loss on longer ones), €0.88 gross.
12. 28 700 shares filled; delay 0.00, execution $-7.83$ , opportunity $-0.91$ , fees 0.05, shortfall $-8.69$ ticks a share; [VWAP slippage](#def-rs-measuring-market-making-and-execution-costs) $-1.10$ .
13. Shortfall $-2.00$ (2.73); delay $+2.83$ (0.94); execution $-4.68$ (2.09), of which drift $-4.78$ (2.07) and price paid $+0.10$ (0.03); opportunity $-0.20$ (0.20); fees 0.05.
14. The price paid against the mid at each fill, $+0.10$ tick a share; the rest is the market.
15. $+0.25$ tick (0.24): the mid moved $-9.71$ with the order and $-9.96$ without. The simulated efficient price ignores the order, so no impact lasts.
16. **Named result.** Scaled to a year: [spread capture](#def-rs-measuring-market-making-and-execution-pnl) $+\$480\,000$ , adverse selection $-\$1.23$ million, inventory $-\$145\,000$ , fees $-\$56\,000$ , total $-\$945\,000$ ; the mark-outs settle at twenty seconds.
17. Meet fewer informed traders (a fair-value signal that anticipates the efficient price, not the queue alone) or quote wider when they are active; inventory is not the problem.
18. By randomised experiment on the firm’s flow, on the price paid against the mid and on mark-outs, with standard errors (chapter 21).
19. The benchmark, the decomposition, the number of orders, the standard errors and what was conditioned on.
20. What happens to the price after each fill, averaged over fills and horizons: how much of the spread the fills keep.

## 23.10 Interview questions

**Interview question 23.1 ★ trader.**

What is a mark-out, and what horizon would you use?

**Solution of Interview question 23.1.**

The fill’s P&L per share against the reference price at a later horizon, $s(m(t+h) - p)$; use a curve of horizons from the fill to the point where it settles (twenty seconds for the chapter’s quoter), against both the mid and the [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro).

**Interview question 23.2 ★★ trader, researcher.**

Decompose a market maker’s P&L. How do you choose the split between adverse selection and inventory?

**Solution of Interview question 23.2.**

[Spread capture](#def-rs-measuring-market-making-and-execution-pnl) (the reference at the fill minus the price), adverse selection (the reference’s move to a horizon $H$), inventory (after $H$), fees; exact by construction. Choose $H$ where the [mark-out curve](#def-rs-measuring-market-making-and-execution-curve) settles, and report the sensitivity to it.

**Interview question 23.3 ★★ researcher.**

A high-frequency market maker earns €1.55 a trade on the spread and loses €0.68 on positions. What does this tell you about its business?

**Solution of Interview question 23.3.**

It earns the spread and gives back less than half of it on positions, a profit of €0.88 a trade, many times a day; Menkveld found the positions profitable under five seconds and costly beyond, so its edge is speed of unwinding and its main risk is being left holding inventory.

**Interview question 23.4 ★★ trader, bank.**

Your [hit ratio](#def-rs-measuring-market-making-and-execution-fill) on a request-for-quote platform doubled last month. Good news?

**Solution of Interview question 23.4.**

Not necessarily: a [hit ratio](#def-rs-measuring-market-making-and-execution-fill) rises when the quotes become more generous than the competition’s, which is when clients are most informed about the price. Look at the mark-outs of the trades won.

**Interview question 23.5 ★★ trader, researcher.**

How do you tell whether an execution algorithm is better than another, given that each order’s shortfall is dominated by the market’s move?

**Solution of Interview question 23.5.**

Randomise orders (or stock-days) between them, measure costs anchored at each fill (price paid against the mid, mark-outs) and the shortfall conditioned on the market’s move, and use CUPED-style adjustments and enough orders for the standard error (chapter 21).

**Interview question 23.6 ★★★ researcher, developer.**

Design the firm’s fill-measurement service: inputs, reference prices, horizons, groupings, and the checks that its numbers add up.

**Solution of Interview question 23.6.**

Inputs: every fill with side, price, quantity, time stamps (exchange and local), order and strategy ids, counterparty or flow type where known; the market data to rebuild the mid and [microprice](https://one-course.com/books/quant/7/en/chapter/8-order-book-features#def-rs-order-book-features-micro). Fixed horizons; groupings by strategy, venue, counterparty, time of day, size. Checks: decomposed P&L equal to the accounting P&L to the cent; fill counts equal to the exchange’s; references taken strictly before each fill.
