Fix IB historical bars resubscription failure after connection loss #3002
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
NautilusTrader prioritizes correctness and reliability, please follow existing patterns for validation and testing.
CONTRIBUTING.mdand followed the established practicesSummary
Fixes a critical bug introduced in PR #2870 where historical bar subscriptions fail to resubscribe after IB Gateway disconnects/reconnects due to a parameter
signature mismatch. The fix stores start timestamps separately from the resubscription handle to prevent
TypeErrorduring automatic resubscription, restoringproper data flow after connection loss.
Related Issues/PRs
Fixes #3001
Related to #2870
Type of change
Breaking change details (if applicable)
N/A - This is a bug fix that restores intended behavior without changing the public API.
Documentation
docs/developer_guide/docs.md)No documentation changes required (code-only fix).
Release notes
RELEASES.mdthat follows the existing conventions (when applicable)Will add after review.
Testing
Ensure new or changed logic is covered by tests.
Technical Details
Problem:
startas a separate kwarg to_subscribe()instead of withinparamsfunctools.partialwithstart=<value>in kwargssubscribe_historical_bars(start=...)paramsdict →TypeErrorSolution:
_subscription_start_timesdict (keyed byreq_id)paramsdict to_subscribe()instead of individualstartkwargstartfrom stored dict when filtering bars (line 907)Affected versions: 1.220.0, 1.221.0+
Last working version: 1.219.0