Skip to content
All library documents

Order Book Matching, Crossed Quotes, and Trade Reporting

Article Quant Q&A · Author: rodrigo

Summary

The document explains how an order book’s matching engine handles incoming orders, crossed quotes, and reported trades. Matching follows venue rules; a common rule is execution when prices are compatible, subject to market-specific constraints. A buy limit priced above the best offer generally executes against the lowest available offer, so the buyer does not keep the gap between the limit price and execution price. Such an order behaves much like a market order while still imposing a price limit.

The discussion distinguishes a locked or crossed market from ordinary executions and notes that regulation and venue rules can determine whether such quotes are rejected, repriced, or displayed. It also explains why a trade does not necessarily appear as the spread reaching zero: feeds often report the trade without separately showing the incoming order, while some venues publish both events atomically. The examples are explanatory rather than a comprehensive account; matching and reporting conventions vary across markets.

Key ideas

  • Matching engines apply venue rules to determine whether incoming orders execute.
  • A marketable buy limit order typically trades against the lowest available offer, rather than capturing its full price gap.
  • Locked and crossed quotes are handled according to venue rules and may face regulatory constraints.
  • Trade feeds often omit the incoming order event, so a trade need not appear as a zero-spread sequence.
  • Order event reporting and matching conventions vary among markets.

Tags

Full text
# How do order books work to match trades?


# How do order books work to match trades?












I have some questions about how order matching works:

- Can an order be matched if the top of the order book on the bid side is lower than the top on the ask side? I would say no since matching would imply a market marker posting a bid and asking to match each, respectively. Then, the bid order would no longer be lower, so it's a different scenario.

- When the top of the order book on the bid side is higher than the sell side, does the market maker keep the entire difference? Is there a specific standard for dealing with this case?

- Does the bid-ask spread go to 0 every time a trade happens (orders are matched) and then (almost instantly) widen until the next order is matched, when it goes to 0 again, and so on?

- Finally, which book would you recommend to learn about these?

## Answer by databento (score 2)

https://quant.stackexchange.com/a/80512

> 1- Can an order be matched if the top of the order book on the bid side is lower than the top on the ask side? I would say no since matching would imply a market marker posting a bid and asking to match each, respectively. Then, the bid order would no longer be lower, so it's a different scenario.

They don't "ask" to match. That would be what's called a RFQ market.

The matching engine simply determines whether they match based on a set of rules. Usually the rule is very simple: match if price is equal. Sometimes, like in the US, some regulatory limitations apply such as Rule 611 which could prevent the match.

> 2- When the top of the order book on the bid side is higher than the sell side, does the market maker keep the entire difference? Is there a specific standard for dealing with this case?

Easy way to understand this is to imagine the extreme case. You place a buy limit order with infinite price, like \$9,999.99, for a cheap stock, let's say BAC (\$40.14 last sale at time of this writing).

You can test this with 1 share on your brokerage app. It will get filled, but obviously at a price very close to \$40.14. Rather than saying you pocketed the difference between \$9,999.99 - \$40.14—since you obviously didn't get out of this trade \$9,959.85 richer, or it would be an infinite money glitch—you simply got matched with the lowest offer.

It happens that the \$9,999.99 limit order is functionally nearly the same as a market order.

A side remark: Back to regulatory limitations like Rule 611, there is much academic debate whether we should outright reject or reprice the order vs. allowing it to be published on the book with zero or even inverted spread. This scenario is called a locked market or crossed market. In practice, this rarely exists—even if the rules of a market allow it, a crossed market would allow a free arbitrage.

> 3- Does the bid-ask spread go to 0 every time a trade happens (orders are matched) and then (almost instantly) widen until the next order is matched, when it goes to 0 again, and so on?

From the perspective of what the entire market sees published on the data feed, usually no. Most markets do not publish the crossing order (i.e. trade initiator) as a limit add event followed by a trade event. They simply publish the trade.

But some markets, e.g. I've seen this in crypto, will publish the limit and the trade event separately. In fact some distinguish between whether the initiator was a market order or a limit order or even the price of that limit. In theory this means the market was momentarily at zero or inverted spread, but this takes place atomically with the trade that comes after, so it is functionally not a zero spread since you won't be able to jump your own order in there.

> 4- Finally, which book would you recommend to learn about these?

See: Book on market microstructure

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.