Skip to content

Fix gateway/TWS reconnect process for IBKR #2710

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

Merged
merged 6 commits into from
Jun 12, 2025

Conversation

bartlaw
Copy link
Contributor

@bartlaw bartlaw commented Jun 12, 2025

Pull Request

NautilusTrader prioritizes correctness and reliability, please follow existing patterns for validation and testing.

Summary

When IBKR connection is broken or not connected on the first try, it fails to reconnect.
Many exceptions are thrown during this process. Logic is not working correctly.
The number of threads/tasks doing reconnection simultaneously is growing over time, making many attempts per second.

If anybody wishes to comment on proposed changes, it would be great.

Related Issues/PRs

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (impacts existing behavior)
  • Documentation update
  • Maintenance / chore

Breaking change details (if applicable)

Release notes

  • I added a concise entry to RELEASES.md that follows the existing conventions (when applicable)

Testing

Ensure new or changed logic is covered by tests.

  • Affected code paths are already covered by the test suite
  • I added/updated tests to cover new or changed logic

I tested manually connection/reconnection

@cjdsellers
Copy link
Member

cjdsellers commented Jun 12, 2025

Hi @bartlaw

Thanks for the fix!

Looks like it's the pre-commit failing. Try running the following and then diffing any changes:

make pre-commit

or

pre-commit run --all-files

Also, if you install the git hook then it'll run automatically on each commit and you can't forget:

pre-commit install

@cjdsellers cjdsellers changed the title IBKR: Bug fix of Gateway/TWS reconnect process Fix gateway/TWS reconnect process for IBKR Jun 12, 2025
@cjdsellers cjdsellers merged commit 9a1d74b into nautechsystems:develop Jun 12, 2025
13 checks passed
@bartlaw bartlaw deleted the bug_fix_ib_reconnect branch June 13, 2025 15:02
@bartlaw
Copy link
Contributor Author

bartlaw commented Jun 13, 2025

Hi @cjdsellers
Thank you for the merge and instructions.

@bartlaw bartlaw mentioned this pull request Jun 16, 2025
8 tasks
stastnypremysl pushed a commit to stastnypremysl/nautilus_trader that referenced this pull request Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants