Interaction of CancelReplace and rate limits

Hello! Suppose I have exhausted my rate limit and I send CancelReplace. Server responds with the following message:
“code”: -1015,
“msg”: “Too many new orders; current limit is 50 orders per 10 SECOND.”
I assume that “new” part of the CancelReplace failed. But what happened with the “cancel” part? Was the old order canceled or not? Is this behavior specified somewhere?

If you have cancelReplaceMode=STOP_ON_FAILURE:

  • If the cancel request fails, the new order placement will not be attempted. So you won’t get into the new order step and receive “Too many new orders;…” error message.

If you have cancelReplaceMode=ALLOW_FAILURE:

  • New order placement will be attempted even if cancel request fails, so it you get the “Too many new orders;…” error message, the cancel might have been successful or not. In this case, I would suggest for you to use the user data stream (websocket ) to be notified on the order status.

This in not an answer to my question, unfortunately. STOP_ON_FAILURE implies that if I failed to cancel, then I fail to place new. But it doesn’t imply that if I failed to place new, then I failed to cancel.

You failed to place new order, but the placement was attempted.
If it was attempted with STOP_ON_FAILURE, then the cancel was successful, because otherwise the new order submission won’t even start (definition of STOP_ON_FAILURE).

Also a good idea to use user data stream (websocket ) for when it’s cancelReplaceMode=STOP_ON_FAILURE.