Quant Memo
Core

Classifying Adverse Selection at Fill Time

Building a classifier that labels a fill as adversely selected or not, using post-trade markouts as ground truth, so a desk can act on toxic-flow warning signs before the next fill rather than after the fact.

Prerequisites: Adverse Selection, Predicting Markouts With Machine Learning

A market maker who quotes both sides of every stock will inevitably trade with some counterparties who simply know more than they do — someone selling right before bad news, or buying right before good news. Those fills are adversely selected: the maker's own inventory moves against them right after the trade. An adverse-selection classifier turns this into a supervised learning problem — predict, from information available before or at the fill, whether this particular trade is likely to turn out to be one of the toxic ones.

Turning markouts into labels

Adverse selection isn't directly observable at the moment of the trade; it's inferred afterward from the markout — how the price moved in the following seconds or minutes. The classifier's label is built by thresholding that markout: a fill is labeled "adverse" if its markout at some fixed horizon exceeds a chosen cutoff against the maker (say, worse than 5-5 basis points at two minutes), and "benign" otherwise. This makes the whole exercise a two-stage pipeline: first define the label from future data (markouts), then train a model to predict that label using only past and present data (pre-trade features), so the trained classifier can actually be deployed in real time without needing to see the future itself.

Features that separate the two classes

The features that distinguish adverse fills from benign ones are the same order-flow signals that drive markouts: order-book imbalance immediately before the trade, the recent run of same-direction aggressive trades (a burst of buying just before a maker sells suggests informed pressure), counterparty identity or venue if available, and the size of the incoming order relative to typical size at that price level — unusually large aggressive orders are disproportionately associated with informed trading. A classifier trained on these can output a probability of adverse selection for every incoming trade, which the market maker can use to widen quotes, reduce size, or step away entirely when the probability crosses a threshold.

Worked example: a threshold in action

Suppose a classifier assigns adverse-selection probabilities to two incoming sell orders hitting a maker's bid. Order 1 arrives with a balanced book and no recent directional trade run: predicted probability of adverse selection, 8%. Order 2 arrives after a run of five consecutive aggressive sells and with the ask-side book unusually thin: predicted probability, 62%. If the desk sets a threshold of 40% for automatically widening the quote or shrinking size, order 2 triggers a defensive response while order 1 is filled at the normal quote. Historically, fills like order 2's pattern realized an average two-minute markout of 14-14 bp against the maker, versus roughly 1-1 bp for fills like order 1's — confirming the threshold is separating genuinely different risk, not just adding noise.

predicted probability of adverse selection threshold = 0.40 mostly benign fills flagged as adverse
Fills scored below the threshold are quoted normally; fills scored above it trigger a defensive quoting response.

What this means in practice

Adverse-selection classifiers close the loop between post-trade analysis and real-time quoting: instead of discovering toxic flow weeks later in an aggregate P&L breakdown, the desk gets a probability attached to every trade as it happens. Evaluation matters as much as the model itself — because adverse fills are usually a minority of all trades, accuracy is a misleading metric, and the desk should look at precision and recall at the operating threshold it actually intends to use, since a threshold set too low will widen quotes constantly and lose benign flow, while one set too high will let real toxicity through unflagged.

An adverse-selection classifier predicts, from pre-trade order-flow features, whether a fill is likely to show a bad markout — with the label itself constructed after the fact from realized price drift, so the trained model can act on the prediction before that drift occurs.

Because the label is built from future markouts, it's easy to accidentally leak post-fill data into the features used to predict it — always confirm every feature is computable strictly before the trade timestamp.

Related concepts

Practice in interviews

Further reading

  • Easley, López de Prado, O'Hara, VPIN and the Flash Crash
  • Glosten, Milgrom, Bid, Ask and Transaction Prices
ShareTwitterLinkedIn