I have found similar questions in this forum but those answers didn't specifically clear the fact.

  • 1
  • It's not likely for a market order be matched by another market order. I think that it would take a locked market (bid price at one exchange and ask price at another are equal) and the size of the two market orders would have to exceed the two limit orders on the books (no other orders behind them). Both are taken out and the excess is matched b/t the two market orders (partial fill of balance). Reg NMS bans locked markets but they still happen so this would be a perfect storm scenario. Yeh, I know. It's a lot of ifs... Commented May 8, 2020 at 12:52
  • @Bob Baerker - even then the market orders would not trade against each other in a locked or crossed market because a locked or crossed market can generally only occur across two different exchanges. The buy order would be sent to the exchange with the best offer, and the sell to the best bid (on different exchanges).
    – xirt
    Commented May 8, 2020 at 13:17
  • @xirt - Would Smart Routing be a factor? IOW, after the partial fills, the unfilled portion of each order is rerouted? Or does Smart Routing apply only to the entire order and the unfilled portion of the order remains at the original destination? Commented May 8, 2020 at 13:39
  • @Bob Baerker Most firms are free to implement "smart" routing however they see fit, subject to following the regulations. Exchanges offer smart routing too. If you have an aggressive strategy, it would re-route unfilled portions elsewhere, but this is different from the OP's question :-)
    – xirt
    Commented May 8, 2020 at 13:49

1 Answer 1



Usually there is a limit order book, so any market order that comes in matches against the existing limit orders in the book. As an exchange matches orders one at a time, it is likely that they will always match a market order against an existing limit order.

One of the problems with executing two market orders against each other is determining what the execution price would be.

Some exchanges (for example, IEX, the Investors Exchange) offer a midpoint order type, which effectively places a hidden limit order at the midpoint between the bid and ask. This in turn will execute against any other midpoint orders (or market orders) submitted.

In implementing my own matching engine, this was one of the edge cases I had to consider - what happens if someone submits a market order if there are no existing orders in the book? Potentially a market order could sit there. However if another market order came in, how would you determine the execution price?

Exchanges deal with this situation by requiring that market orders be marked or are implicitly marked as "immediate or cancel" (they should be unlikely to be cancelled), and process incoming orders one at a time.

That is not to say that an exchange could file with the SEC that they are going to offer market order matching and outline the process for doing it (e.g. allowing submitted market orders to hang around at the midpoint for a second before executing against the limit order book). However there would have to be sufficient demand for such a feature, but some people might get upset if their orders are taking a second to get filled even if it is at a better price, so could submit negative comments on the proposal.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .