Reader question: A trade tape shows price, size and time, but not always whether the buyer or seller initiated the trade. How can an algorithm infer the likely aggressor side from trades and quotes?
The Lee–Ready method combines a quote test with a tick test. A transaction above the prevailing quote midpoint is normally classified as buyer-initiated; one below the midpoint as seller-initiated. When the trade occurs at the midpoint, the algorithm falls back to recent price direction.
This article owns the trade-sign inference problem: time-aligned transactions + bid/ask quotes + a stated synchronization rule → inferred buyer/seller initiation, signed volume, classification-confidence diagnostics and downstream error tests.
It does not own order matching, exchange surveillance, market-impact estimation or execution strategy. Trade signing is an inference layer that other market-microstructure calculations may consume.
This is public mathematical and computational education, not trading advice.
1. Trade price alone does not reveal who initiated
Every executed trade has both a buyer and a seller. The microstructure question is which side demanded immediacy.
A buyer-initiated trade generally means the buyer crossed toward available sell liquidity. A seller-initiated trade generally means the seller crossed toward available buy liquidity.
Historical trade-and-quote datasets often record the transaction without an explicit aggressor-side flag, so direction must be inferred.
2. Start from the prevailing bid and ask
Let:
- Bt = prevailing bid;
- At = prevailing ask;
- Pt = trade price.
The quote midpoint is:
Mt = (At + Bt)/2.
The simplest quote rule is:
- if Pt > Mt, classify as buyer-initiated;
- if Pt < Mt, classify as seller-initiated.
The intuition is that a trade nearer the ask likely consumed sell-side liquidity, while one nearer the bid likely consumed buy-side liquidity.
3. Midpoint trades are the hard case
If:
Pt = Mt,
the quote test has no directional information.
Lee and Ready therefore use a tick test for ambiguous inside-spread or midpoint cases.
4. The tick test
Compare the current trade price with the preceding trade price.
- uptick: Pt > Pt−1 → buy;
- downtick: Pt < Pt−1 → sell.
If the price is unchanged, look backward to the most recent non-zero price change.
- zero-uptick: unchanged price after the last upward move → buy;
- zero-downtick: unchanged price after the last downward move → sell.
This creates a deterministic sign when recent price movement is informative.
5. A compact algorithm
- Select the quote judged to be prevailing for the trade.
- Compute the midpoint M.
- If trade price is above M, sign +1.
- If trade price is below M, sign −1.
- If trade price equals M, apply the tick test.
- If neither rule has adequate information, retain an unclassified state rather than inventing certainty.
With sign st ∈ {−1,0,+1}, signed volume is often represented as:
q̃t = st qt,
where qt is trade size.
6. Timestamp alignment is part of the model
The original Lee–Ready study identified a historical data problem: quote updates could be recorded before the trade that caused them. Comparing a transaction to the apparently simultaneous quote could therefore use a quote from after the economic event.
For their 1988 NYSE data, Lee and Ready found that using the quote from five seconds earlier reduced misclassification.
Critical boundary: five seconds is not a universal modern constant. It was a correction for a specific historical reporting environment.
7. Modern data may need event ordering, not a fixed lag
Electronic markets can timestamp messages at microsecond or finer resolution, but feeds can still differ in latency and sequencing.
A modern implementation should prefer, where available:
- exchange sequence numbers;
- venue-native event timestamps;
- documented trade/quote message ordering;
- known feed-latency adjustments.
If the data already preserve causal ordering, applying a historical five-second lag can make classification worse.
8. The prevailing quote must be defined
Possible quote choices include:
- venue-specific best bid and ask;
- consolidated national best bid and offer;
- last non-stale quote;
- quote from the execution venue;
- quote reconstructed from order-book messages.
These are not interchangeable.
A trade executed on one venue may legitimately occur inside a consolidated spread or away from another venue’s quote.
9. Inside-spread trades are not errors
A transaction between the displayed bid and ask can arise from:
- hidden liquidity;
- midpoint orders;
- price improvement;
- standing orders not represented by the displayed best quote;
- fragmented venue conditions.
Lee and Ready explicitly studied the difficulty of classifying such trades.
Weak link: displayed quotes are only a partial representation of available liquidity.
10. A simple example
Suppose the prevailing quote is:
bid 99.90 / ask 100.10.
The midpoint is 100.00.
- trade at 100.08 → buyer-initiated by quote rule;
- trade at 99.94 → seller-initiated by quote rule;
- trade at 100.00 → midpoint, so use tick information.
If the previous distinct trade price was 99.98, the 100.00 midpoint trade is an uptick and would be signed as a buy.
11. The first trade can be unclassifiable
If the first usable transaction occurs exactly at the midpoint and there is no earlier distinct price change, the tick test has no history.
A robust implementation may return 0 or NA rather than force a buy or sell label.
Evidence discipline: “unknown” is often more accurate than false precision.
12. Locked and crossed quotes break naive midpoint logic
A locked market has bid = ask. A crossed market has bid > ask.
In those states, the midpoint may not represent an economically valid contemporaneous spread.
Possible causes include:
- feed asynchrony;
- venue fragmentation;
- stale messages;
- temporary market states.
Diagnostic: flag locked and crossed observations separately instead of silently applying the ordinary rule.
13. Out-of-sequence messages can reverse the sign
Suppose a buyer-initiated trade lifts the ask from 100.10 to 100.20. If the 100.20 quote is timestamped before the 100.10 trade in the merged dataset, the trade can appear below the new midpoint and be misclassified as a sell.
This is the precise reason synchronization matters.
Falsifier: rebuild the event sequence using venue-native ordering. If the sign flips systematically, the merged-clock classifier was wrong.
14. Inputs and outputs
Inputs can include:
- trade price;
- trade size;
- trade timestamp;
- bid and ask;
- quote timestamp;
- venue identifier;
- sequence number where available;
- trade condition code;
- correction/cancellation flags;
- chosen lag or synchronization rule.
Outputs can include:
- trade sign +1/−1/unknown;
- signed volume;
- order imbalance;
- classification coverage;
- midpoint-rule share;
- tick-rule share;
- ambiguous-trade share;
- validation accuracy where ground truth exists.
15. Condition codes matter
Not every tape record should be treated as an ordinary continuous-market trade.
Opening auctions, closing auctions, late reports, average-price trades, corrections and special conditions can have different relationships to displayed quotes.
Hard diagnostic: define the eligible trade-condition set before signing.
16. Cancellations and corrections must be reconciled
If a cancelled trade remains in the dataset, it can distort both sign history and volume.
A corrected trade can also change the prior tick sequence used to sign later midpoint transactions.
Cleaning is therefore recursive: one bad historical record can alter several subsequent classifications.
17. Classification error contaminates Kyle’s lambda
The Kyle’s lambda article uses signed order flow to estimate price impact.
If trade signs are wrong, explanatory order flow is measured with error.
This can attenuate, inflate or otherwise distort the estimated market-impact relationship depending on the error structure.
Connection: trade signing is an upstream measurement problem; Kyle lambda is a downstream regression problem.
18. Classification error also contaminates spread estimates
Effective-spread calculations often compare transaction prices with the midpoint and use trade direction to interpret execution cost.
Later research using datasets with known trade direction found that classification algorithms can bias effective-spread and price-impact estimates, especially for trades inside quotes.
The classifier must therefore be validated for the market and period in which it is used.
19. Historical validation results are not universal constants
Ellis, Michaely and O’Hara tested several algorithms on Nasdaq data where actual trade direction could be identified. The Lee–Ready rule performed better than simpler quote-only or tick-only rules in that sample, but inside-quote trades remained difficult.
Those historical percentages should not be imported unchanged into modern fragmented markets.
Update trigger: market structure changes require revalidation.
20. Evidence polarity
Evidence for confidence includes high agreement with known aggressor flags, stable accuracy across venues and trade sizes, low sensitivity to small timestamp adjustments, coherent signs around quote changes, and downstream estimates that remain stable under alternative classifiers.
Evidence against confidence includes large midpoint-trade fractions, stale quotes, locked/crossed markets, strong dependence on an arbitrary lag, poor accuracy on known-direction samples, systematic errors for large or inside-spread trades, or large changes in Kyle lambda and order imbalance when the classifier changes.
21. Counterexample: a midpoint trade from hidden liquidity
A hidden midpoint order executes exactly at M. The prior tick happened to be upward, so Lee–Ready signs the trade as a buy.
The actual aggressor may have been a seller.
Lesson: the tick rule is an inference, not direct observation of order intent.
22. Counterexample: the five-second lag becomes harmful
A modern feed reports trades and quotes with accurate sequence numbers and sub-millisecond timestamps.
Applying a five-second quote lag compares the trade with a genuinely stale market state.
Falsifier: validate against exchange aggressor flags. If zero-lag event ordering outperforms the historical lag, retire the lag.
23. Counterexample: one venue’s quote is used for another venue’s trade
A transaction on Venue B occurs at 100.04 while Venue A displays 99.90/100.00. A consolidated or mismatched quote can make the trade appear strongly buyer-initiated even though Venue B’s own midpoint was 100.05.
Diagnostic: compare venue-native and consolidated classifications.
24. Diagnostics checklist
- Define eligible trade conditions.
- Remove cancellations and apply corrections.
- Choose venue-native or consolidated quotes deliberately.
- Verify timestamp units and clock source.
- Use sequence numbers where available.
- Measure trade-to-quote latency distribution.
- Flag locked and crossed quotes.
- Measure midpoint-trade frequency.
- Measure unclassified frequency.
- Test several plausible lag rules.
- Validate against known aggressor side where possible.
- Repeat by venue, size and time of day.
- Recompute downstream order-imbalance and impact metrics under alternative classifiers.
25. Alternatives and complements
Quote rule: sign solely by position relative to the midpoint.
Tick rule: sign solely by price movement relative to prior trades.
Ellis–Michaely–O’Hara-style rules: modify trade-sign logic for electronic-market evidence.
ECN-specific classifiers: use market-specific information to improve inside-quote classification.
Bulk-volume classification: infers aggregate buying/selling pressure at a bar level rather than signing every individual trade.
Ground-truth exchange flags: where reliable and available, direct aggressor indicators are preferable to inference.
26. What would falsify confidence?
Confidence should be withdrawn if the quote cannot be causally aligned to the trade; if classification accuracy is poor against known-direction data; if signs reverse under tiny plausible timing changes; if inside-spread trades dominate; if condition-code cleaning is incomplete; or if downstream results depend materially on one arbitrary signing rule.
27. Verification and update triggers
Preserve raw trade and quote messages, venue, timestamps, sequence numbers, condition codes, cancellation/correction processing, quote-selection rule, lag rule, tick-state history and final signs.
Revalidate after feed-vendor changes, timestamp-resolution changes, venue migrations, tick-size changes, auction redesign, growth of midpoint or hidden execution, new reporting rules, or material shifts in classification accuracy.
28. Connections to the surrounding Bukit Timah Tutor knowledge estate
Kyle’s lambda algorithms use signed flow to estimate price impact.
Hasbrouck information-share algorithms ask which venue contributes permanent price innovations, a different problem from assigning a sign to each trade.
Electronic market-matching algorithms explain how executable orders are paired before the resulting transaction appears on the tape.
The lane is indexed at Finance & Banking Algorithms | Applied Mathematics in Real Financial Systems.
29. Primary and high-quality references
- Charles M. C. Lee and Mark J. Ready, Inferring Trade Direction from Intraday Data, Journal of Finance, 1991.
- Katrina Ellis, Roni Michaely and Maureen O’Hara, The Accuracy of Trade Classification Rules: Evidence from Nasdaq, Journal of Financial and Quantitative Analysis, 2000.
- Bidisha Chakrabarty, Bingguang Li, Vanthuan Nguyen and Robert A. Van Ness, Trade classification algorithms for electronic communications network trades, Journal of Banking & Finance, 2007.
Educational boundary: A Lee–Ready sign is an inference from observed market data. It is not direct evidence of a trader’s identity, motive, strategy or future price direction.
