Sub topic 6
Market Orders: Certain Fill, Uncertain Price
Assume you know what a stock share is, can read a basic quote, and can do simple multiplication. This chapter focuses on what happens after you submit a market order.
What a market order does
A market order tells your broker to buy or sell immediately at the best available prices. The order prioritizes execution over price. If enough shares are available, the order should fill, but the final price is not guaranteed.
For a market buy, the order usually consumes available sell offers, called asks. For a market sell, it consumes available buy offers, called bids. The order book contains these prices and the number of shares available at each price.
Suppose the asks are:
- 100 shares at $50.02
- 200 shares at $50.05
- 500 shares at $50.10
A market buy for 400 shares takes all 100 shares at $50.02, all 200 shares at $50.05, and 100 shares at $50.10. Its average price is about $50.055, usually displayed as $50.06 after rounding. It does not receive one single price for all 400 shares.
Why the last price is not a promise
A quote often shows the last price, which is the price of the most recent completed trade. That price may be different from the current bid and ask. A fast-moving stock can change between the time you view the quote and the time your order reaches the market.
A market buy normally pays at least the current ask. A market sell normally receives no more than the current bid. If the order is large compared with the available shares at the best price, it can consume several price levels.
The difference between the expected price and the actual execution price is slippage. Slippage can help or hurt, but a market order gives you little control over it.
def market_buy_cost(asks, quantity):
"""Return shares filled and average price for a market buy."""
filled = 0
cost = 0.0
for price, available in sorted(asks):
take = min(available, quantity - filled)
filled += take
cost += take * price
if filled == quantity:
break
average = cost / filled if filled else None
return filled, average
asks = [(50.02, 100), (50.05, 200), (50.10, 500)]
print(market_buy_cost(asks, 400))
# (400, 50.055)When a market order may fit
A market order can make sense when immediate execution matters more than controlling the exact price, especially for a small order in a liquid stock during regular trading hours. Liquidity means how readily shares can be traded without moving the price much.
Use extra caution with thinly traded stocks, unusually large orders, rapidly changing prices, and extended-hours sessions. These conditions can produce wider spreads, fewer available shares, and greater slippage.
A practical decision
Before submitting a market order, ask:
- Do I need the trade to happen now?
- Is the spread reasonably narrow?
- Is my quantity small compared with the visible available shares?
- Can I accept a worse price if the quote changes?
If controlling the maximum purchase price or minimum sale price matters more than immediate execution, a limit order is usually the next order type to consider.
Exercise
A stock shows a bid of $49.98 and an ask of $50.02. What price does a market buy guarantee?
Show answer
It guarantees neither $50.02 nor any other exact price. It generally starts by taking available shares at the ask, but the final price can change and can include multiple price levels.