Exchange & liquidity
Cancel & replace
Handle expected versions, fill races and priority changes safely.
Cancel the open remainder
Supply the original order ID and expected_version. A fill can win a race with cancellation. Read the resulting order and distinguish filled quantity from the cancelled remainder. A cancel request does not establish that all original quantity was open.
New order, new priority
Prepare a replacement preview and obtain approval for its exact terms. Replacement creates a new order ID and queue priority. Retain original-to-replacement links instead of rewriting the old record.
Recover uncertain commands
Read the original command and relevant order IDs after interruptions. Use current expected versions. Do not keep submitting new IDs until one succeeds. Funding for matched fills is separate from a safely released open remainder.