# How do exchanges handle overflowing market orders

Say that I observe the following market (a simplified limit order book with only limit and market orders):

``````  Bid  | Price  |  Ask
| 100.75 |   10
| 100.50 |   40
20 |  99.40 |
30 |  99.30 |
``````

What would happen if a market order to buy a volume of 90 would arrive and how would it be handled by the exchange/market matching algorithm?

Logically, we have the option that

• the market order gets rejected right away
• the market order gets filled as much as possible (40 shares @ 100.50, 10 shares @ 100.75)

if the second option is handled, what happens to the remaining volume of 40?

• it gets thrown away (i.e., nothing additional happens)
• it gets converted to a limit order at the last best price, i.e., a new limit order on the bid side for a price of 100.75 and a volume of 40 (seems a bit unlikely but logically possible...)

I am aware that this might be a bit too simplistic (i.e., only one exchange, only two types of orders etc), if you have an answer that only applies with additional assumptions, do please answer and state the additions that you have made.

## Note

This question is related but not equal to this and this question, but while the first one addresses order matching in general, the second one only covers a total empty orderbook (this is somewhat related to the second option). To my understanding neither question specifically asks for overflowing market orders.

• An immediate or cancel order is for full quantity and not partial quantity. – Dheer Sep 3 '17 at 12:38

The market order will get filled as far as possible by matching with the limit orders (so second option) and then the remaining unfulfillable order for 40 shares should get cancelled.

Exchanges should treat market orders as immediate or cancel orders, as the name says this means that a market order has to find a match immediately or gets cancelled, partial matching, like this case, leading to the unfulfilled portion getting cancelled.

I suppose converting the remaining portion to a limit order would be possible but it would mean the broker/exchange (who would even set that?) changing a trader's order which seems like a good way to anger them. That said, the absolute last thing you would want would be to have an outstanding market order, it would present a golden opportunity for an unscrupulous trader to engage in some price gouging.

• -1 Which exchange uses IOC orders by default? – hroptatyr Sep 4 '17 at 5:09
• @hroptatyr the NYSE for starters. nyse.com/publicdocs/nyse/markets/nyse/NYSE-Order-Type-Usage.pdf – Koen vd H Sep 4 '17 at 8:05
• That's incorrect. See nyse.com/publicdocs/nyse/markets/nyse/…, 7.1, Field 59. It defaults to Day but IOC is permissible too, and according to your report more widely used. – hroptatyr Sep 4 '17 at 9:33
• @hroptatyr Seems I was wrong, that seems really crazy to default a market order to Day. Unless I'm missing something, the market order types in that report seem to only be IOC and open/close orders (so also extremely short duration) though? – Koen vd H Sep 4 '17 at 10:10
• If you think about it: limit orders sacrifice quantity to maintain price, market orders sacrifice price to maintain quantity. The IOC and FOK additions soften these goals by allowing the order to be cancelled. I honestly cannot imagine an exchange making these soft versions default. But then again, NYSE has so many (special) order types with strange defaults and phased out Stop and GTC orders (since 2016), your answer might become true one day :) – hroptatyr Sep 4 '17 at 11:21

This depends on the exchange and the type of order

A Immediate or cancel will get filled or cancelled. A GTC will get filled as much as possible and remain at top as market. So if someone puts a ask of 200 it would match.

Market order are only recommend for Highly liquid stock.