-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a check to ensure bot doesn't run without a connection to TWS(IB only) #472
Conversation
My review is in progress 📖 - I will have feedback for you in a few minutes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed your code and found 1 potential issue. To discuss my individual comments that I have added, tag me in replies using @korbit-ai.
Please react with a 👍 to my comments that you find helpful and a 👎 to those you find unhelpful - this will help me learn and improve as we collaborate.
while not connected: | ||
self.connect(ipaddress, portid, clientid) | ||
connected = self.isConnected() | ||
time.sleep(0.2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The while loop used to ensure a connection to TWS could potentially result in an infinite loop if the connection is never established. To mitigate this, consider adding a maximum number of retries or a timeout mechanism. This will prevent the bot from trying to connect indefinitely and allow it to handle the situation gracefully if TWS is not available.
To Do:
|
…nteractiveBrokers class has an optional parameter for max_connection_retries
No description provided.