How are unmarketable market orders (other side of the order book is empty) matched with incoming orders? [duplicate]

Note: This question is erroneously marked as a duplicate. It concerns a very specific situation with unfulfillable market orders in very illiquid markets, one that no other discussion here has covered. Related questions are addressed at the end.

TL;DR This is the entire order book:

``````__________________________________________________
|  Time |  Price | Quant |  Time |  Price | Quant |
|       |        |       | 10:05 | market |   1   |
|       |        |       | 10:00 | \$10.00 |   1   |
|_______|________|_______|_______|________|_______|
``````

There's an incoming buy order for 1 share, limit price \$11. Which order gets matched and at what price?

With the above order book, if someone came in and placed a buy order for 1 share at limit price \$9, I assume it matches the market order and trade is executed at \$9. Straightforward. If instead the buyer placed a buy order with limit price \$11, would it match the limit order or the market order?

Answering by determining "price" of unfulfilled market order

When the incoming order is a market order and there are only limit orders on the books, it's clear how to price it: based on the best bid or ask. But that doesn't help us here.

One option is that if we can figure out what to consider as the "price" for the unfulfilled market order on the books, we can decide based on price/time priority.

The possibilities are:

1. Price market order at best ask: \$10. Now we have two orders at the same price, so the earlier-placed one gets it: the limit order. But this seems unfair. The trader placing the market order is clearly willing to go below \$10, so they should get the trade!
2. Price market order at best bid: \$11 or undefined? On the one hand, the incoming buy order is at \$11, but on the other hand, by definition an incoming order isn't on the books yet, so there is no "best ask". If it were \$11, the buy order would be matched with the \$10 limit order, even if the market order had been placed first! Seems unfair that an earlier-placed market order would lose out to a limit order.
3. Price market order at last traded price: let's say \$11. Again the market order would unfairly lose out to the limit order here.
4. Price market order at \$0.01 better than best ask: \$9.99. Okay, this works. But we can't simply treat it as `limit price \$9.99` because this market order would match an incoming buy order with limit price \$9.

Always matching market orders first

As @Dheer's answer suggests, one approach is to simply match market orders first no matter what. This makes a lot of sense, though we still need to figure out at what price does the trade executes. Clearly not the buyer's limit price of \$11, because they'd get a worse deal than the limit order on the books. So, \$10? \$9.99? Last trade price, or opening price (but no more than \$10)?

What if the incoming buyer placed a market order instead. At what price do you match two market orders - same as the answer to the above?

I guess this comes down to specifications for individual exchanges, but I'm wondering if there's a standard here or a way to approach it from basic rules that clears up all these situations.

Edit: Some specifics of how limit orders are matched is discussed at How do exchanges match limit orders? This question is not a duplicate of that - my question is specifically about how an incoming limit order is matched when the other side of the order book has an unfulfilled market order. This case is not discussed at all by various existing questions, which only discuss matching incoming orders when there are sufficient limit orders already on the books.

Other relevant discussions that don't directly address these questions but are good background reading:

Another edit:

According to this answer https://money.stackexchange.com/a/57191/35787, some or all markets will reject incoming market orders if there are no orders on the books to match it to, so the situation I describe in this question wouldn't be possible in the first place. I don't have any sources to back this up but if someone can confirm or contradict this we can probably settle this question.

• Why the downvote? Not at all a dupe if you read the question. For clarity @littleadv I've added a specific explanation of how this is case is unanswered by existing questions. Commented Dec 14, 2015 at 8:38
• While I still consider your question a duplicate, now that you've actually referenced the prior questions and explained why you think they don't answer your question, I removed the downvote. I would expect you to do this ahead of time, without regarding the potential respondents as your servants and giving us the same respect you want to receive in return. Commented Dec 14, 2015 at 10:08
• @littleadv Fair enough - I definitely should have mentioned the near-dupe questions to show that I had considered them. Appreciate you taking another look. Commented Dec 14, 2015 at 10:11
• Isn't it the responsibility of designated market makers to step in when no one else is willing to trade?
– Flux
Commented Oct 29, 2020 at 23:03

I don't have all the answers.

On a illiquid stock, such situations do arise and there are specific mechanisms used by exchanges to match the order. It is generally not advisable to use market order on illiquid stock.

There are lots of different variations here. I guess this comes down to specifications for individual exchanges, but I'm wondering if there's a standard here or a way to approach it from basic rules that clears up all these situations.

There are quite a few variations and different treatments.

Scenario 1:
Market order that are placed when the market is closed [Good till Cancelled] or just around market opening. There are held and not released immediately. Depending on the exchange, first 5 to 15 minutes the trades happen only on Limit Orders. After this; market orders are released and matched. Market buy orders get matched to market sell orders. The price algorithm kicks in. This is closely guarded secret so that price can't be influenced. Generally it factors in the trend for last 6 months of the share, the closing price of previous day, the stock market indexes and the average price for the limit trades in the 5 to 15 minutes the market are open.
Not all order get matched and there could be spill over's. These are then matched to limit orders.

Scenario 2:
On an ill-liquid stock, there are no orders, there is one buy market order and one sell market order. These get matched. The price is last traded price.

Scenario 3:
No order on book. Then there is a buy Limit Order followed by buy Market order [or vice versa]; post this there is a market sell order. The Market sell order is matched to the market buy order. The price is the best limit order on buy side.

Is this determined based on which sell order came first, or based on which would result in the best deal for the incoming buyer?

Generally Market orders have highest priority of execution.

Related info: London Stock Exchange

• "It is generally not advisable to use market order on illiquid stock" this seems like a key takeaway! But thanks - simply treating market orders as higher priority narrows down the # of options greatly, and then as you say it simply has to come down to the market's own formula for determining that price. Commented Dec 14, 2015 at 10:09
• Ultimately it is down to the exchange's specific matching rules, and how they programmed their system. There are sometimes edge cases that cause problems which they in turn subsequently fix.
– xirt
Commented Dec 21, 2017 at 18:53
• There's a reason I post wrong-side limit orders rather than market orders in illiquid markets. Commented Aug 4, 2018 at 4:16