I've not found a definitive way of knowing when TWS has completed startup so I too sleep though for an initial 20 seconds. I then attempt connects from my API handler using eConnect(host, port, clientid).. and if it is successful then a call to isConnected() returns true...otherwise I sleep for 2 additional seconds and attempt another connection. This will repeat itself up to10 times where if it has continued to fail I reset the applications and start over from the beginning.
I do not use IBController though I would think that it would be similar starting it in it's own thread like I do with jclient.
Barnet Wagman <bw@...> wrote:
Gregory Smith wrote:
I start the TWS and my "API" handler in separate threads but from the same parent. If the API handler detects a disconnect, or if it fails to receive updates on particular exchanges (i.e. futures, equities or fx) or if there are other internal failures (db or trading strategy) then I set an error status and the parent thread shutsdown and restarts the processes (TWS, API...).
Do you have a way of detecting when TWS is actually up? It seem to take
a fair amount of time (at least 10 seconds, although I've never timed
it) for TWS to fully start. I'm a little concerned about sending a
connect before TWS is available. Any idea of what happens? I.e. will
EWrapper return a recognizable error?
Also, are you using IBController to start the TWS?
Thanks
SPONSORED LINKS
Investment management software Investment property software Investment software Investment tracking software Return on investment software Stock investment software
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "TWSAPI" on the web.
To unsubscribe from this group, send an email to:
TWSAPI-unsubscribe@...
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
---------------------------------
How low will we go? Check out Yahoo! Messenger¡¯s low PC-to-Phone call rates.