开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Is a race condition that causes inconsistent states of position and open orders possible?


 

If in the messages TWS streams back to the client, it sends the order/execution message first before it sends the position update message, it is possible for the client to be in an inconsistent state as it no longer sees the open order, but the position is not updated. This is dangerous because the program may sneakily go above the risk limits without the program noticing. I have done a search of this forum, and it appears no one has had such an issue in practice. However, in the TWS API official documentation, I also do not see any mention of it talking about synchronization guarantees. Is it something I really need to worry about? I really appreciate any input.