An immediate-or-cancel order permits an immediate partial fill and cancels the remainder. Separate its short lifetime from price protection and full-size completion.
Immediate-or-cancel order
An immediate-or-cancel (IOC) order allows whatever quantity can execute immediately under its conditions to fill, then cancels the unfilled remainder. Partial execution is allowed. A strategy can therefore use IOC to avoid leaving a stale order in the market, while still ending up with less than its intended position. This follows the stock-order definition in Investor.gov’s IOC entry.
The word “immediate” describes an execution window. It does not promise a full fill, a particular price, or a universal number of milliseconds.
The cancelled remainder is not the acquired position
Take a fictional instruction: buy 100 shares, limit USD 101 per share, IOC. At the immediate execution decision, a single eligible liquidity pool can supply 60 shares at the limit or better. Assume whole shares, a frozen pool, no hidden liquidity, no competing activity, no routing and no fees.
The limit order component forbids paying above 101. The IOC component permits the available 60 shares to fill and cancels the other 40 shares. There is no instruction left waiting for a later seller.
Fictional IOC buy of 100 shares at a USD 101 per share limit encounters 60 immediately eligible shares. It buys 60 and cancels 40, leaving a 60-share acquired position and zero shares in the live order remainder.
Original frozen, single-pool example. Quantities are whole shares; the limit is USD per share. No hidden liquidity, competing activity, fees or routing. Cancellation removes unfilled quantity without reversing executed trades.
The completed order ledger reads 100 requested = 60 filled + 40 cancelled, with zero shares resting. If the buyer started with no shares and made no other trades, the executions create a 60-share position. Cancelling the remainder neither sells those shares nor reverses the fills.
Changing only the instruction to fill-or-kill changes the outcome. FOK requires immediate completion of the whole quantity; the available 60 is insufficient. It therefore fills zero and cancels 100. Investor.gov’s FOK entry explicitly excludes partial execution.
Same initial pool and price cap
Filled shares
Cancelled shares
Shares left resting
IOC
60
40
0
FOK
0
100
0
IOC need not result in a partial fill. If no eligible shares are available, all 100 cancel; if at least 100 are eligible in this simplified pool, all 100 fill. “Partial fills allowed” is permission, not a requirement.
Price, quantity and lifetime answer different questions
IOC by itself supplies no price cap. In the example, that cap comes from the separate limit instruction. A buy limit allows its price or lower; a sell limit allows its price or higher. Nor does a limit force execution at its stated price: a better eligible price can satisfy it. Investor.gov’s order guide explains this directional price condition.
All-or-none (AON) imposes complete quantity without IOC’s immediate cancellation policy. In the SEC’s stock-order description, an AON order that cannot execute immediately can remain active; it does not build the position through partial fills. The applicable lifetime still matters. See Investor.gov’s AON definition.
A day order instead gives the unfilled quantity a session deadline. With ordinary partial fills permitted, a remainder may wait within that eligible session. It does not acquire IOC’s immediate deadline merely because both instructions eventually end an order. The SEC’s order-type bulletin separates these timing and quantity instructions and warns that similarly named broker instructions can differ.
A simulation needs an arrival state
An IOC backtest should test the liquidity eligible when the order reaches its execution decision. A snapshot observed earlier is not a reservation of shares. Neither should later replenishment of the order book fill a remainder that the model has already cancelled.
For a named implementation, check the broker, instrument, trading session, allowed price instructions and routing scope. “Available” must mean available under those rules, rather than every displayed quote across every venue. The simple pool above deliberately fixes those choices; it is not a routing model.
Finally, reconcile confirmed executions and the terminal unfilled quantity. An IOC request is not proof that the target position was obtained, and a cancellation report for the remainder is not proof that nothing traded. Market, Limit and Conditional Orders develops this order lifecycle and works through an IOC example. Its preview is public; the full lesson requires membership.
Rishi K. Narang, Inside the Black Box: A Simple Guide to Quantitative and High-Frequency Trading, 2nd edition, Wiley, 2013, Chapter 7, “Aggressive versus Passive,” pp. 122–124, and “Other Order Types,” pp. 124–125 — execution urgency, price conditions and order modifiers.