Decouple IBKR Runtime Wiring - #35
Merged
Merged
Conversation
Pigbibi
marked this pull request as ready for review
April 21, 2026 10:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR finishes the IBKR-side runtime decoupling work so the request entrypoint no longer owns broker wiring, strategy input assembly, notification transport, and report construction at the same time.
The runtime already had explicit
IBKRRebalanceRuntime/IBKRRebalanceConfigbundles, but the top-level module was still carrying too many responsibilities. That made the request path hard to reason about, and every new feature or edge case risked pushing more orchestration back intomain.py.Root cause
The shared runtime shape had improved incrementally, but the IBKR repo still lacked the final local builder/composer layers that separate broker adapters, strategy adapters, notification publishing, and runtime reporting. As a result,
main.pystill mixed strategy, broker, transport, and HTTP concerns.What changed
IBKRRebalanceRuntimeandIBKRRebalanceConfigmain.pyas thin delegators so the existing request/runtime tests can still patch them without reintroducing orchestration into the entrypointValidation
./.venv/bin/ruff check main.py application/runtime_notification_adapters.py application/runtime_reporting_adapters.py application/runtime_strategy_adapters.py application/runtime_broker_adapters.py application/runtime_composer.py tests/test_runtime_composer.py tests/test_event_loop.py tests/test_strategy_runtime.py tests/test_snapshot_strategy_runtime.py tests/test_request_handling.py tests/test_rebalance_service.py./.venv/bin/python -m pytest tests/test_runtime_composer.py tests/test_event_loop.py tests/test_strategy_runtime.py tests/test_snapshot_strategy_runtime.py tests/test_request_handling.py tests/test_rebalance_service.py