Unfortunately I am not Python literate enough to give you concrete help, Dave. But on the surface, your approach looks fine.
I am wondering, though, whether there is some adverse interaction between the call to? self.event_nextValidId_callback.wait() and the ability of your client to process incoming TWS API messages. You say "Market data connection callbacks (2104, 2106, 2158) are shown in the IBG API log (but not received by the client)" which makes me wonder whether messages from TWS/IBGW get processed.
Not sure whether that happens behind the scene, but wouldn't you have to start the message reader in a separate thread as it is described in the chapter?
´³¨¹°ù²µ±ð²Ô
On Wed, Jun 14, 2023 at 09:59 AM, David Walker wrote:
toggle quoted message
Show quoted text
Hi ´³¨¹°ù²µ±ð²Ô (and others),
Thanks for your comments on this, as helpful as always.? I'm experiencing a similar absence of the??callback, and have not been able to successfully troubleshoot it.
On calling connect(),
- the client immediately appears in the TWS/IBG API client list
- Market data connection callbacks (2104, 2106, 2158) are shown in the IBG API log (but not received by the client)
- the IBG API logs show the version handshake:
- tracing through connect() shows conn_time and server_version correctly obtained, and IBApi.EClient.connState set to 2 (Connected)
- API logs show no other errors, and the client receives no errors
- but....no nextValidId callback is recieved, at least within the 120 seconds I wait for it
I've copied the (immediately) relevant sections of the code below - this code reproduces the error with both TWS and IBG, so contains whatever is faulty.? The threading.Event() object (self.event_nextValidId_callback) is a standard async notification object in python.? But in any case, while debugging, the nextValidId function is never called, so it does not appear that the event notification itself is at fault.
I would really appreciate any help on this and hope I'm not missing something really obvious!.? Unil recently I have used other connection verification procedures which have largely worked fine; it is only since updating to using nextValidId that I have encountered this.
Dave