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 and time , the markout at horizon is the signed move in the mid-price:
where is the mid-price at time and side is for a buy and 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 — 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 (buy), so:
A markout of -\0.08-16-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.
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 .
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