# Immediate or cancel (IOC)

Immediate or cancel (IOC) is a time-in-force instruction to execute an order immediately to the extent possible and cancel any unfilled quantity rather than leave it open.

## What it means

An IOC instruction gives an order only an immediate opportunity to execute. The broker sends the order for execution; any shares that cannot be filled promptly are canceled instead of remaining available for later execution. IOC is a **time-in-force instruction**, not an order price: an IOC order can carry a limit price, and the price condition still applies. Broker and trading-venue rules determine the precise handling of “immediate.”

IOC permits a partial fill. That distinguishes it from fill-or-kill (FOK), which requires the entire quantity to execute immediately or none of it to execute. A day order, by contrast, can remain open during the trading day unless filled or canceled sooner.

## How it is calculated

IOC is an instruction rather than a financial metric, so it has no pricing formula. Its quantity accounting is:

`Canceled shares = Submitted shares − Immediately filled shares`

- **Canceled shares**: the unfilled quantity withdrawn after the immediate execution attempt, measured in shares.
- **Submitted shares**: the original order quantity, measured in shares.
- **Immediately filled shares**: the quantity executed during that attempt, measured in shares; it can be zero.

The filled quantity cannot exceed the submitted quantity. If the order has a limit price, only executions meeting that limit can count toward the fill. For a buy limit, the execution price cannot exceed the limit; for a sell limit, it cannot fall below the limit. The formula describes the order outcome, not a way to predict the fill.

## Worked example

Suppose, hypothetically, an investor submits an IOC limit order to buy **1,000 shares** at **US$20.00 or less**. Assume immediately available sellers can supply 300 shares at US$19.98 and 200 shares at US$20.00, with no further immediately available shares at or below the limit.

1. The order fills 300 shares at US$19.98, costing US$5,994 before any fees.
2. It fills another 200 shares at US$20.00, costing US$4,000 before any fees.
3. The immediately filled quantity is 500 shares, with a total purchase value of US$9,994 before any fees.
4. The remaining `1,000 − 500 = 500 shares` are canceled. They do not stay on the order book to await another seller.

The investor has bought 500 shares, not 1,000. The weighted-average fill price is `US$9,994 ÷ 500 = US$19.988 per share`, excluding fees. A later order for the canceled shares would be a separate order, subject to prices and liquidity available at that time.

## Why it matters before you trade

IOC limits how long unfilled quantity remains active, but it does **not** ensure a complete fill or a favorable execution price. Before placing an order, consider whether a partial position would make sense for the intended basket, whether the limit price is acceptable, and how available liquidity compares with the requested quantity. Visible quotes can change before an order reaches a venue; displayed size is not a guaranteed fill.

For a basket, partial fills can change position weights and leave intended transactions unmatched. Multiple IOC orders do not guarantee simultaneous or proportional fills. Spread, market impact, fees and the possibility of another order for the remainder can all affect total execution cost. IOC addresses the order’s duration, not these other costs.

## How PreTrAIde uses it

PreTrAIde is an AI pre-trade analysis platform for stocks. A user builds a basket with a buy or sell side, quantity and execution conditions for each line. Before any order is placed, its PreTrade analysis returns basket-level and line-level GO, NO-GO or MODIFY verdicts, risk assessments, suggested execution strategies and plain-language reasoning. Its quantitative layer estimates spread, participation in daily volume and market impact—checks relevant when assessing an order that might fill only partly.

The product facts do not establish that PreTrAIde selects, submits or simulates IOC orders specifically. Its verdicts are decision support, not recommendations. PreTrAIde never receives, transmits or executes orders; users place trades themselves through their own broker.

## Common mistakes

- **Treating IOC as all-or-nothing.** IOC allows partial fills; FOK does not.
- **Assuming a limit guarantees execution.** A limit restricts the acceptable price but does not supply liquidity.
- **Assuming canceled shares were traded.** Only filled shares create an executed position.
- **Confusing cancellation with a reversal.** Canceling the remainder does not undo shares already filled.
- **Ignoring basket effects.** A partial fill can alter intended position sizes and portfolio exposures.

---
Source: https://pretraide.com/glossary/immediate-or-cancel
