OrderSendAsync() - is it guaranteed that the commands are processed in the same order they are sent?

 

Dear friends,

Suppose I have a pending sell limit order for a certain instrument in a stock exchange market.

If I run an OrderSendAsync() command to cancel this order and, shortly thereafter, I run another OrderSendAsync() command to send a market buy order for the same instrument, is it guaranteed that my sell limit order will be canceled before my market buy order is executed?

Is there any chance that the OrderSendAsync() commands are executed out of order and my pending sell limit order is executed by my own market buy order, before being canceled?

What if I use OrderSend() instead of OrderSendAsync() ?

ps: of course I could just poll the pending sell order status and wait until cancellation is confirmed before sending the market buy order, but, due to performance requirements, I need the ellapsed time between canceling the sell order and sending the buy order to be as short as possible, so that OrderSendAsync() would be preferable to OrderSend(), as long as the desired sequence of events could be guaranteed.
 
Nothing is guarantee whatever you will use. If you want to be sure a pending is deleted before requesting a market order, you need to check it by code.
 

The only guaranties in trading incl. software are secured by Murphy's laws.

This would probably depend on ping, server settings and, of course, broker honesty.

 

Thank you guys!

It was not the answer I would like to hear, but a bad truth is always better than a good illusion.

Thank you!

Reason: