TWS is not incrementing orderID properly in live trading account

TWS normally increments the orderID automatically. Yesterday, my live account stopped incrementing the numbers properly, and it's now reusing orderIDs from prior days.

This is not happening in my paper trading account, which is continuing to increment properly.

Is anyone else seeing this issue?

It is not TWS that increments OrderID. IBcontroller first asks TWS for next ID using GetNextID call. Once it receives next ID the subsequent ones are simply incremented by IBC.
Chances are that in your case TWS is returning ID that was used before. Possibly because of disconnection or some other condition within TWS

I can see that TWS is returning an already-used orderID as the next orderID, so I think it's a TWS issue.

If I may comment. I would encourage users/traders to develop their own GUID's for orders and fills, independent of what brokers provide. You can develop ones that can be decrypted and describe things like instrument,Date Time order placed, date/time of fill, whether it was a partial order, like a unit and whether i got partial fills, order type, exchange routing, order type, signal name, system nameetc... You could even have it contain matching broker order ID's. Just my 2cents.

1 Like