What Does a Market Order Consume?
Sweep a sell book level by level and separate immediate fills, average execution, and an unmatched IOC remainder.
- Explain why a market order crosses multiple price levels
- Use average execution to measure depth impact
- Explain why an IOC remainder does not become a resting order
- PREVIOUSWho Should Fill First?
- CURRENTWhat Does a Market Order Consume?
Sweep a sell book level by level and separate immediate fills, average execution, and an unmatched IOC remainder.
- NEXTWho Leaves the Spread Behind?
Think about these questions first.
Choose an answer before opening the explanation. You can add anything unexpected to your review list.
Q01Does a market order really mean ‘buy at any price’?+
From a risk perspective, nearly. Real systems often implement it as a protected IOC: consume allowed levels immediately and cancel the rest before an empty or extreme book consumes unlimited funds.
A market order puts “fill now” first and gives price control to the book. It looks simpler than a limit order but depends more on depth: one request can fill across several levels, so its average price may differ sharply from the first ask you see.
No specified price does not mean no price
The lab’s market order promises only an attempt at immediate execution. It consumes available asks from the best ask upward until the quantity is filled or the book runs out. Every fill still has an explicit price; those prices come from resting sell orders.
LAB / credits
Limit orders enter the queue; only a crossed book turns them into fills.
A market order walks the ask levels
It does not write a price into the book; it consumes visible depth immediately. Unfilled remainder does not quietly become a limit order.
Read the book first: best ask is the lowest sell, best bid is the highest buy. Matching starts only when buy price reaches sell price.
- 01
Book created: best ask 102 分(两个价位相同's 订单),best bid 98 .price and time priority must be preserved。
Use the slider to return to an earlier step. Continuing from there replaces the later history with a new sequence.
One order can cross multiple levels
Suppose the ask book has 5 LAB at 102 and another 5 LAB at 105. A market buy for 8 first takes 5 at 102, then 3 at 105. It is not “8 at 102”; it is two fills. Average execution is total notional divided by total filled quantity, so it is above 102 because depth—not a random engine decision—created the difference.
IOC remainder does not quietly join the queue
The teaching implementation uses IOC (Immediate-Or-Cancel): the immediately fillable portion executes, and the rest cancels. “I want to trade now” is kept distinct from “I am willing to wait in the book.”
Expand: how this step works
for ask in asks sorted by price, time:
fill = min(order.remaining, ask.remaining)
settle(at=ask.price, quantity=fill)
if order.remaining == 0: break
cancel(order.remaining)
Real systems also check balances, price protection, risk limits, and matching batches. The lab reports requested, filled, remaining, and average execution so you can inspect state rather than animation.