Prevent duplicate orders after request timeouts

A timed-out submission can have an unknown outcome. The exchange may have accepted an order even though the client saw no response. Persist the intent and its client order identifier before the call. Tie the intent to the account, venue, instrument and direction.

Replay the lost acknowledgement

Suppose the client sends a buy with client ID paper-1042. The exchange accepts and fills it just as the response is lost. The client should record an ambiguous state and consult the order status and fills. A second submission using a fresh ID can buy another unit. Even repeated use of a client ID depends on the venue’s documented uniqueness scope, which may cover only currently open orders.

Use one process or transactional claim for each pending intent. Record the terminal outcome once, with the exchange’s order ID when known. On restart load unapplied outcomes and reconcile them before retrying. Treat temporarily missing query results as uncertain and follow the venue’s rules for any safe retry. Binance timeouts and execution status · Kraken client order identifiers

Test an ambiguous response after both an accepted resting order and an immediate fill. In both cases the ledger should represent one intended order and the actual executed inventory. Process partial fills.