Execution mechanics: from intended orders to actual fills · 3 / 5
Reconcile an IOC partial fill and the exposure it leaves behind
Immediate-or-cancel describes what happens to the unfilled portion of an order. It does not erase an existing position, undo a partial fill or promise that a requested exit will finish. Separating order state from position state is the central task. A cancelled order can coexist with a position that remains open.
Athenum6 minUpdated:
Fix the book and order assumptions
Assume an existing ten-unit long in a hypothetical linear product. A reduce-only sell limit for ten units has a limit of 99.80 USDT and IOC time in force. The available bids are four units at 100.00, three at 99.90 and five at 99.70. Assume those quotes remain available until matching, no other orders intervene, fees are charged in quote currency, and the venue applies the described IOC behavior.
Reconcile state before another exit
Before sending another exit, reconcile execution identifiers, accumulated filled quantity and the current position. An acknowledgement is not a fill report, and a network timeout does not prove the first request failed. Repeating the original ten-unit sell without checking actual state can produce unwanted orders; venue reduce-only rules help constrain exposure but do not substitute for reconciliation. Use the order's stable client identifier and exchange status mechanisms where supported. Do not invent a universal retry rule across venues.
Seven units fill; three units remain exposed
The first two bid levels are eligible. Four units sell at 100.00 and three at 99.90, producing 699.70 USDT of gross sale proceeds. The five-unit level at 99.70 is below the sell limit and is not eligible. Seven units fill, three units of the order cancel, and the original long position has three units remaining. Average execution price is 699.70 / 7 = 99.95714286 USDT, not the 99.80 limit price.
At an illustrative taker fee of 0.05%, the fill fee is 0.34985 USDT. That fee belongs to the seven executed units, not to all ten requested units. Net proceeds are 699.35015 USDT. These proceeds are not the position's trading profit: the original entry cost and any other fees or funding still matter. The remaining three units retain market and liquidation exposure.
| Bid level | Available units | Eligible units filled | Gross proceeds USDT |
|---|---|---|---|
| 100.00 | 4 | 4 | 400.00 |
| 99.90 | 3 | 3 | 299.70 |
| 99.70 | 5 | 0 | 0.00 |
| Total | 12 | 7 | 699.70 |
Open full-size diagram- Original long position: 10 units
- Units actually sold: 7 units
- Long units still exposed: 3 units
FOK can leave the whole position open
A fill-or-kill instruction would have different semantics. Under the same static book and an atomic all-or-none rule, ten units cannot execute at or above 99.80, so the order would have no fill. That can protect a minimum executed quantity but leave all ten original units exposed. Choosing between IOC and FOK is therefore also a choice about tolerable residual exposure, not simply about avoiding fees.
Before acting
- Record requested quantity, side, limit and time in force.
- Sum fills by unique execution identifier.
- Compute average price and fees from executed quantity.
- Reconcile the remaining position separately from the cancelled order.
- Choose the next action from confirmed position state.
Check your understanding
If the first bid offers only two units while the other IOC assumptions stay unchanged, what fills, what fee is charged and what position remains?
Show the explained answer
Five units fill for 499.70 USDT, averaging 99.94 USDT. At 0.05%, the fee is 0.24985 USDT. Five units of the original long remain open even though the unfilled order remainder cancels.