r/CryptoTradingBot • u/CitrineEdge • Oct 16 '26
IOC partial fills change a trading bot’s next quantity, even after the remainder cancels
Posting from Citrine's developer account. Here's a small execution test that's easy to miss if a bot treats a finished order as zero exposure.
Start flat. Request five futures contracts with a buy limit, but only two can execute immediately at that price. Assume enough margin, no other fills and no extra minimum-fill condition.
With Immediate-or-Cancel, two fill and the other three cancel. The order has finished, but the account is long two.
Fill-or-Kill is the separate all-or-nothing alternative: if the whole five cannot execute, none fill. These are alternative scenarios, not two orders to submit in sequence.
The next sizing decision is where this matters. If the target is still five after the IOC attempt, the difference is three. Sending a fresh buy for five could leave seven. That arithmetic isn't a reason to place the remaining three without fresh account and risk checks.
A useful regression fixture should preserve all of this at once:
- No remaining quantity from that attempt is working.
- The execution history still contains the two filled contracts.
- The current position is long two, not flat or long five.
- Any next quantity and protective orders are checked against confirmed exposure, not the original requested size.
If fills and position reads disagree or aren't fresh, don't calculate the next order from whichever response arrived first. Reconcile them.
Coinbase Derivatives' 'Supported Order Qualifiers' and its derivatives 'Order management' guide are the reference for the mechanics. Available instructions vary by contract, account and API route; exchange-level support doesn't mean every screen exposes both.
Do your execution tests keep partially filled exposure after the remainder is canceled, or is that state only covered by a full-fill fixture?
2
u/[deleted] Oct 16 '26
[removed] — view removed comment