Open Benvaulter opened 6 years ago
I just found out that once the connection is terminated due to the violation described above, TWS won't allow new connections from the same clientID. I will test now if using a different clientID will work
Try ‘clear all’ and then re init the session. This is a little bug. Will fix soon. Thanks for pinging me about it!
-abel
Sent from my iPhone
On Sep 11, 2018, at 2:26 AM, Benvaulter notifications@github.com wrote:
I just found out that once the connection is terminated due to the violation described above, TWS won't allow new connections from the same clientID. I will test now if using a different clientID will work
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Okay will try - all though it seems this is actually behavior of the TWS (I chatted with someone from the API Support Team) so not sure whether this helps. Will try - thanks!
Hi there,
I am experiencing an issue with the TWS when attempting to re-connect after the connection to TWS has been lost. I have written a very simple function to check for the connection status and re-connect in case the connection is not available:
This code seems to work just fine under normal circumstances. However, when the connection to TWS is lost due to the violation of messages sent from the client to the server in one second (limit is 50 msgs per second - I do have multiple checks in place to prevent this, but it still seems to happen some times) - when trying to reconnect I get the following error:
Couldn't connect to TWS. Confirm that "Enable ActiveX and Socket Clients" is enabled and connection port is the same as "Socket Port" on the TWS "Edit->Global Configuration...->API->Settings" menu. Live Trading ports: TWS: 7496; IB Gateway: 4001. Simulated Trading ports for new installations of version 954.1 or newer: TWS: 7497; IB Gateway: 4002
It seems when I lose the connection due to the violation, some settings in TWS change so that I cannot re-connect in the normal way. Once I restarted TWS, everything works normal again... Any idea on how to fix this behaviour?
Many thanks!