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 using /api/v1/open-order endpoint. For create order request, we can query the order status by client-request-id from the request; for cancel order request, we can query the order status by order-id.

Recommendations

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. If the order gets stuck in pending status for too long (e.g. 2 minutes), we recommend cancelling the order and retrying the request.