Sub topic 2
Market and limit orders: what you actually ask for
When you tap Buy, you are not buying a share at a price. You are sending your broker an instruction, and the instruction type decides what you are guaranteed and what you are risking. This chapter covers the two basic order types, the extra conditions that can be attached to them, and the mistakes they cause most often.
Prerequisites
This chapter assumes you know three things:
- A share represents part ownership of a company.
- A bid is the highest price a buyer currently offers, and an ask is the lowest price a seller currently accepts.
- You have used a brokerage app or website.
The previous chapter covered what the broker does with your account. The next two chapters follow the order to a trading venue and show how it is matched. Here we only look at what you can ask for.
An order is a set of constraints
An order tells the broker four things:
- Side: buy or sell.
- Quantity: how many shares.
- Price condition: how much you are willing to pay or accept.
- Duration: how long the instruction stays alive.
Every order type is a different combination of price condition and duration. No order can guarantee both that it executes and that it executes at a price you choose. Almost every order-type decision comes down to that trade-off.
Market orders: certainty of execution
A market order is an instruction to buy or sell immediately at the best prices available. It has no price condition. A market buy takes the lowest asks first and moves up to higher asks until your quantity is filled. A market sell does the reverse and works down through the bids.
A market order guarantees execution, as long as there are willing counterparties. It does not guarantee price. The price you see on screen is the last trade or the current quote. It is not a promise.
Most of the time, in a heavily traded stock, the difference is a fraction of a cent. It becomes large in three situations:
- The stock is thinly traded, so the best ask has few shares behind it.
- Your order is big relative to the shares offered at the best price.
- The market is moving fast, for example right after the open or after news.
When your order consumes several price levels, you pay a different price for different parts of it. That difference between the price you expected and the average price you got is called slippage.
Limit orders: certainty of price
A limit order adds a price condition. A buy limit means "pay this price or less." A sell limit means "accept this price or more." The price is called the limit price.
A limit order guarantees that you will not trade at a worse price than your limit. It does not guarantee that you will trade at all.
Two outcomes are possible when a limit order arrives at the market:
- Marketable: the limit price already crosses the other side of the book. A buy limit at or above the best ask is marketable, and so is a sell limit at or below the best bid. It executes right away against resting orders.
- Non-marketable: the limit price does not cross. The order rests in the order book and waits for someone to trade with it.
A marketable limit order can also be only partly marketable. Part of it fills at once and the rest rests in the book.
The limit price is a boundary, not the execution price. A buy limit at 10.02 can fill at 10.01 if that is what a seller is offering. You get the better price, and the later matching chapter explains why.
A worked comparison
The following program runs four orders against the same snapshot of sell offers. It is a simplification. It takes the offers in price order and ignores everything except price levels.
def execute(asks, qty, limit=None):
"""Fill a buy order against asks listed best (lowest) price first.
limit=None means a market order. Returns (fills, unfilled_qty)."""
fills = []
for price, available in asks:
if qty == 0 or (limit is not None and price > limit):
break
traded = min(qty, available)
fills.append((price, traded))
qty -= traded
return fills, qty
def average(fills):
shares = sum(q for _, q in fills)
if shares == 0:
return None
return round(sum(p * q for p, q in fills) / shares, 4)
asks = [(10.01, 50), (10.02, 100), (10.05, 200)] # (price, shares)
orders = [
("market buy 120", 120, None),
("market buy 400", 400, None),
("limit buy 400 @ 10.02", 400, 10.02),
("limit buy 100 @ 10.00", 100, 10.00),
]
for label, qty, limit in orders:
fills, left = execute(asks, qty, limit)
print(label, fills, "avg", average(fills), "unfilled", left)Running it prints:
market buy 120 [(10.01, 50), (10.02, 70)] avg 10.0158 unfilled 0
market buy 400 [(10.01, 50), (10.02, 100), (10.05, 200)] avg 10.0357 unfilled 50
limit buy 400 @ 10.02 [(10.01, 50), (10.02, 100)] avg 10.0167 unfilled 250
limit buy 100 @ 10.00 [] avg None unfilled 100Each line shows a different behavior:
- The first market order fills completely, at two prices.
- The second market order walks all the way up to 10.05 and still cannot fill, because only 350 shares were offered. The average price is worse than the first order's.
- The third order, a limit at 10.02, refuses the 10.05 shares. It is partially filled, and 250 shares would rest in the book as a bid.
- The fourth order never touches the book. Its limit of 10.00 is below the best ask, so nothing fills and the whole order rests.
Choosing between them
The diagram shows the decision most people actually make.
The table summarizes the trade-off.
| Property | Market order | Limit order |
|---|---|---|
| Execution guaranteed | Yes, if there are counterparties | No |
| Price guaranteed | No | Yes, never worse than the limit |
| Main risk | Slippage and surprise prices | Never filling, or filling only in part |
| Fits | Liquid stocks, small size, urgency | Thin stocks, large size, price-sensitive trades |
A common middle path is a marketable limit order. You set a buy limit slightly above the current ask. It fills at once like a market order, but it cannot run away from you if the price jumps.
Duration: how long an order lives
The duration is called time in force. The common options in the US are:
- Day: the order is cancelled if it has not filled by the end of the regular session. This is the usual default.
- Good-til-cancelled (GTC): the order stays active until it fills or you cancel it. Brokers put their own cap on this, often somewhere between 30 and 90 days, so check your broker's rule.
- Immediate-or-cancel (IOC): fill whatever you can right now, and cancel the rest.
- Fill-or-kill (FOK): fill the entire quantity right now, or cancel the whole order.
Duration matters most for limit orders. A market order normally fills in a moment, so its duration rarely comes into play.
Stop orders: a trigger, then an order
A stop order has a trigger price. It does nothing until the market trades at the trigger. Then it turns into another order:
- A stop (stop-market) order becomes a market order once triggered. It sells even if the price has dropped further, so the fill can be far below the trigger.
- A stop-limit order becomes a limit order once triggered. It protects the price but may not fill at all if the market gaps past your limit.
So a stop order is not a guarantee of selling at the stop price. In a fast market or after an overnight gap, the fill can be well away from it. Both versions carry the same trade-off as before: stop-market keeps certainty of execution and gives up price certainty, and stop-limit does the reverse.
Partial fills and order quantity
A big order often fills in pieces. Your confirmation may show several executions at different prices, and your app will usually display them as one position with an average price. Two points to remember:
- A partly filled limit order stays open for the remainder until it fills, expires, or you cancel it.
- If you change an order's price or quantity, many venues treat that as a cancel and a new order. Your place in the queue may be lost, and the later matching chapter explains why that matters.
Many brokers also offer fractional shares. In that case the broker typically handles the order inside its own systems. It may group fractional orders together and execute them at certain times rather than at the instant you tap, and limit orders on fractional shares are often not available. The details depend on the broker.
Outside regular hours
The regular US session is 9:30 a.m. to 4:00 p.m. Eastern time. Some brokers allow trading in extended hours before and after that. Liquidity is thinner then, spreads are wider, and prices can move sharply on little volume. Brokers that allow extended-hours trading commonly require limit orders for it, precisely because market orders would be dangerous in such thin conditions. If you send a market order when the market is closed, it normally waits and is submitted at the next open, and the price at the open can differ a lot from the last close.
Common errors
- Assuming the displayed price is the fill price. Quotes change between your tap and the execution, and a market order takes whatever is there.
- Using a market order on a thinly traded stock. The gap between bid and ask can be wide, and few shares are offered at each price.
- Setting a buy limit below the market and expecting a fill. It only fills when the market comes down to you. If it never does, you stay out.
- Confusing the limit with the price you will get. A limit is the worst price you will accept. You may do better.
- Expecting a stop to be a guaranteed exit price. It is a trigger, not a guarantee.
- Leaving old GTC orders open. They can fill long after your reasons for placing them have gone.
What happens next
Once you press the button, the instruction goes to your broker. The broker decides where to send it, which is the subject of the next chapter. The venue then matches the order. Which order type you chose determines what the venue is allowed to do with it.
Exercise
The best asks are 100 shares at 20.00, 100 shares at 20.10 and 300 shares at 20.50. You send a buy order for 250 shares. What is the average price if it is a market order, and how many shares fill if it is a buy limit at 20.10?
Show answer
The market order takes 100 at 20.00, 100 at 20.10 and 50 at 20.50. The total cost is 2000 + 2010 + 1025 = 5035, so the average price is 5035 / 250 = 20.14. The buy limit at 20.10 refuses the 20.50 shares and fills only 200 shares, 100 at 20.00 and 100 at 20.10, for an average of 20.05. The remaining 50 shares rest in the book as a bid at 20.10.
Exercise
A stock closes at 50.00. Overnight, bad news arrives and it opens at 44.00. You hold a sell stop-market order with a trigger of 48.00 and a sell stop-limit order with trigger 48.00 and limit 47.50 (on another account). What happens to each?
Show answer
The market has gapped past the trigger, so both orders are triggered at the open. The stop-market order becomes a market order and sells at about 44.00, well below the 48.00 trigger, so the order is filled but at a bad price. The stop-limit order becomes a sell limit at 47.50, but no buyer is paying that much when the price is 44.00. It rests unfilled, and you still hold the shares, exposed to further falls. Neither order guaranteed an exit at 48.00.
Exercise
Why might you choose a marketable limit order over a plain market order?
Show answer
A marketable limit order has a limit price slightly beyond the current best quote, so it fills at once as a market order would. The limit caps the worst price, so a sudden jump in the price or a thin book cannot make you pay far more than you expected. The cost is that if the price moves beyond your limit before the order reaches the market, it may fill only partly or not at all.