Skip to main content

Cancelling an order

Cross-Session Cancelling: Orders can be cancelled from a different SBE session than the one that submitted them. An order submitted on gateway side A can be cancelled on side B of the same pair.Response Routing: The session that sends the cancel receives CancelOrderResponse. When that session is not the one that submitted the order, and the submitting session has negotiated schema version 17 or later, the submitting session receives an unsolicited OrdersCanceled (310). Sessions negotiated below 17 keep the previous routing: CancelOrderResponse is delivered to both sessions. Fills stay on the submitting session. See Cross-session cancels and Cross-session acknowledgements.

Cross-session cancels

Upcoming change. Schema version 25 adds cancelCorrelationId and cancelApiKeyId to OrdersCanceled. Available on testnet from 4 December 2026.
When a cancel is sent from a different session than the one that submitted the order, each session receives a different message. From schema version 17, the submitting session receives OrdersCanceled, and its content depends on the schema version negotiated at logon: From schema version 25, the submitting session can identify the cancel request:
  • cancelCorrelationId is the correlationId of the cancel request. For a cancel sent from another SBE session, it equals the correlationId on that session’s CancelOrderResponse. Use it to match the two messages across your sessions
  • cancelApiKeyId is the ID of the API key of the session that sent the cancel request. It is null when there is none
  • A cancel that was not sent from an SBE session carries a cancelCorrelationId assigned by the gateway or system that sent it, not a correlationId your sessions sent
Both fields are null when the cancel was not caused by a single cancel request, for example after a mass cancel, an MMP trigger or a disconnect.

CancelOrderRequest (120)

Request to cancel an existing order by its client order ID. This message cannot cancel quotes.

CancelOrderByIdRequest (125)

Request to cancel an existing order by its exchange-assigned order ID. Use this when the clientOrderId is not known. This message cannot cancel quotes. Responses are the same as for CancelOrderRequest: a CancelOrderResponse (220) on success or a CancelOrderReject (222) on failure.

CancelOrderResponse (220)

Response to confirm a CancelOrderRequest or CancelOrderByIdRequest was successful, sent to the session that sent the cancel. When the cancel is sent from a different session than the one that submitted the order, the submitting session is notified with an unsolicited OrdersCanceled (310) once that session has negotiated schema version 17 or later. From schema version 25, that message carries this response’s correlationId as cancelCorrelationId. See Cross-session cancels.
quantity (field 8) and totalFilled (field 9) were added in schema version 16. Clients that negotiate a schema version below 16 do not receive these fields.

CancelOrderReject (222)

Reject generated in case a CancelOrderRequest is unsuccessful.