Well, it's probably less painful to set up your own id server. Have
one > app that requests id's from tws and have your trading software request id's > from the id server instead of tws.
Yes, it's another layer of stuff but I suspect it's the only reliable
way > to get around the problem you are facing.
That was the first approach we took. It doesn't work, here's why.
Assume you have 10 orders outstanding, each with an id. Disconnect
from tws, and reconnect, the call the open orders request. You get
10 reports, and they have all been assigned NEW id's, starting at the
first id you got from the nextid callback.
I had to take your approach a whole layer farther. I now have 'the
trading application' running on the TWS machine, and it exports a
network accessible api. All of the other machines talk to that
application, not TWS itself. I took one look at the issues of having
multiple programs trying to keep order lists strait, when they have
different id's, and said 'no thanks'.
Hmm, not to split hairs, but aren't we talking about the same thing really? The gist of my post was to create a central place where things would get coordinated. It looks like you needed to do more than just hand out unique id's but you did wind up with a central place to keep things together.
Thanks for the info about the re-assignment of id's. I can see this is going to be one of those "10% effort on the real project, 90% effort on spelunking TWS" deals.
- Nick