Partial Fills and Cancellations
A partial fill changes your position by the executed quantity. Track the unfilled remainder separately when deciding whether to wait, cancel, or replace it.
Example: 0.100 BTC Across Two Exchanges
Section titled “Example: 0.100 BTC Across Two Exchanges”The order example requests 0.100 BTC, with 0.060 BTC sent to Binance and 0.040 BTC to Bybit.
| Quantity | After the Binance Fill | After the Bybit Remainder Is Cancelled |
|---|---|---|
| Requested | 0.100 BTC | 0.100 BTC |
| Filled | 0.060 BTC | 0.060 BTC |
| Remaining | 0.040 BTC | 0.000 BTC |
| Cancelled | 0.000 BTC | 0.040 BTC |
The 0.060 BTC fill remains part of the position. A replacement order for the original 0.100 BTC would add more exposure than the cancelled remainder.
Check the Average Fill Price
Section titled “Check the Average Fill Price”Weight each fill by its quantity:
Average fill price = sum(quantity × fill price) / total filled quantityFor 0.060 BTC at 77,000 and 0.040 BTC at 77,008, the average is 77,003.20, assuming comparable price units. Record fees separately, including their asset.
Cancel and Reconcile
Section titled “Cancel and Reconcile”- Submit cancellation for the existing order ID.
- Follow its latest revision and each child order’s state. A fill may arrive while cancellation is pending.
- Confirm final filled, remaining, and cancelled quantities before placing a replacement.
Use Order Fills for individual executions and Child Orders for exchange state.
Recover After a Timeout
Section titled “Recover After a Timeout”Look up the original client_order_id through Find an Order by Client ID. Reuse the original idempotency key only for a retry of the same request. A new order or changed request needs its own identifiers.