Problem

When creating or cancelling an order using the WebSocket API, we may run into situations where the response is lost or delayed. This can happen due to network issues, server overload, or other factors. In such cases, it’s important to handle these unreceived responses to ensure that the order is created or cancelled successfully.

Solution

Whether the unreceived response is lost or delayed, we can handle it by checking the status of the order and the /api/v1/open-order endpoint can be used for this purpose. In particular, if it is a create order request, we can query the order status by client-request-id from the request; if it is a cancel order request, we can query the order status by order-id.

Recommendations

In case of a delayed response, we recommend waiting for a reasonable amount of time (e.g. 10 seconds) before querying the order status. This will leave enough time for the order to be processed. In rare cases where the order status is still pending upon querying, we recommend waiting until the status changes to active before proceeding.