Skip to content
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

Merged
merged 3 commits into from
Jun 15, 2024

Conversation

Al4ise
Copy link
Contributor

@Al4ise Al4ise commented Jun 14, 2024

No description provided.

@Al4ise Al4ise requested a review from grzesir as a code owner June 14, 2024 10:27
Copy link
Contributor

korbit-ai bot commented Jun 14, 2024

My review is in progress 📖 - I will have feedback for you in a few minutes!

Copy link
Contributor

@korbit-ai korbit-ai bot left a 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.

Comment on lines 1198 to 1201
while not connected:
self.connect(ipaddress, portid, clientid)
connected = self.isConnected()
time.sleep(0.2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

category Objects and Data Structures

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.

@Al4ise
Copy link
Contributor Author

Al4ise commented Jun 14, 2024

To Do:

  • tests/test_data_source.py waits until all retries have finished, idk why
  • polygon backtest fails? tests/backtest/test_polygon.py. Could be unrelated

…nteractiveBrokers class has an optional parameter for max_connection_retries
@grzesir grzesir merged commit df7d797 into Lumiwealth:dev Jun 15, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants