Quant Memo
Core

Predicting Markouts With Machine Learning

Building models that predict a fill's markout — how the price moves in the seconds and minutes after a trade executes — to flag toxic flow and steer execution decisions before the loss shows up in P&L.

Prerequisites: Adverse Selection, Market Impact

Right after you get filled on a trade, did the price then drift in your favor or against you? That short-horizon drift is called the markout, and it's the cleanest available signal for whether a fill was "good" or "toxic," long before the effect shows up in a monthly P&L report. A market maker who consistently buys right before prices fall is being adversely selected — picked off by better-informed counterparties — and a markout-prediction model tries to see that coming, fill by fill, rather than discovering it weeks later in aggregate performance.

Defining the markout precisely

For a fill at price p0p_0 and time t0t_0, the markout at horizon hh is the signed move in the mid-price:

Mh=side×(mt0+hmt0),M_h = \text{side} \times (m_{t_0+h} - m_{t_0}),

where mtm_t is the mid-price at time tt and side is +1+1 for a buy and 1-1 for a sell. In plain English: a positive markout means the market moved in the direction that made your fill look good after the fact (price rose after you bought, or fell after you sold); a negative markout means it moved against you. Horizons typically span from under a second (pure microstructure noise and queue effects) out to several minutes (information slowly diffusing into the price).

The prediction task is to estimate MhM_h — or more often, just its sign, or a toxicity score — using only information available at the moment of the fill, so the model's output can actually change a real-time decision (skip the trade, widen the quote, hedge faster) rather than just explain the past.

Features and the leakage trap

Useful features live entirely in the pre-fill order book and trade tape: the imbalance of resting size on each side of the book, the recent trade-sign run (a burst of same-direction aggressive trades often precedes further movement), spread width, and recent realized volatility. The single most common mistake is leaking post-fill information into a feature — for instance, using a volume bucket that includes trades occurring after the fill being scored, which lets the model "see" the very drift it's supposed to predict and produces spectacular backtest results that vanish live.

Worked example: a market maker's fill

A market maker buys 1,000 shares at a mid of $50.00. Two minutes later the mid is $49.92. Side is +1+1 (buy), so:

M2min=+1×(49.9250.00)=0.08.M_{2\text{min}} = +1 \times (49.92 - 50.00) = -0.08 .

A markout of -\0.08pershare,orper share, or-16basispoints,meansthepricefellafterthemakerboughtthefilllooksadverselyselectedonthistrade.Averagedacrossthousandsofsuchfillsgroupedbypretradeorderbookimbalance,amodelmightlearnthatfillsoccurringwhenrestingsellsidesizewasthinrelativetobuysidesizecarryanaveragetwominutemarkoutofbasis points, means the price fell after the maker bought — the fill looks adversely selected on this trade. Averaged across thousands of such fills grouped by pre-trade order-book imbalance, a model might learn that fills occurring when resting sell-side size was thin relative to buy-side size carry an average two-minute markout of-12$ bp, versus roughly flat markouts when the book was balanced — a pattern the market maker can act on by widening quotes exactly when that imbalance signal fires.

mid fill at t0 price drifts down after buy
A negative markout: the mid keeps falling in the minutes after the buy fill, the signature of adverse selection.

What this means in practice

Markout models feed directly into market-making quote decisions, smart-order-routing venue choices, and post-trade toxicity monitoring — a persistently negative average markout against a given counterparty or venue is often the first hard evidence that flow is informed. They're also the standard way to evaluate whether a change to an execution algorithm helped or hurt, since markouts respond within minutes rather than requiring weeks of P&L accumulation to become statistically visible.

A markout is the signed price drift after a fill, and predicting it from pre-trade order-book and trade-tape features lets a desk flag adverse selection at the moment of the trade rather than discovering it in aggregate P&L weeks later.

Any feature computed from data that includes activity after the fill timestamp will leak the very outcome you're predicting into the inputs — always audit feature windows to end strictly before t0t_0.

Related concepts

Practice in interviews

Further reading

  • Easley, López de Prado, O'Hara, VPIN and the Flash Crash
  • Cont, Kukanov, Stoikov, The Price Impact of Order Book Events
ShareTwitterLinkedIn