Support per-account IBKR gateway ports - #98
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a83846ab07
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| group_config.ib_gateway_port | ||
| if group_config.ib_gateway_port is not None | ||
| else parse_optional_int(os.getenv("IB_GATEWAY_PORT")) | ||
| ), |
There was a problem hiding this comment.
Stop using legacy env as implicit port override
When ib_gateway_port is omitted from the selected account group, this path now pulls IB_GATEWAY_PORT from the process env before applying the live/paper defaults. In deployments that still carry a legacy IB_GATEWAY_PORT, that stale global value silently overrides group behavior and can route a paper account group to the live gateway port (or vice versa), which undermines the per-account-port rollout and can direct orders to the wrong Gateway session.
Useful? React with 👍 / 👎.
Summary
ib_gateway_portto IBKR account group runtime settings so multiple Gateway sessions can share one VM on different host ports.Validation
PYTHONPATH=.:/home/ubuntu/Projects/QuantPlatformKit/src:/home/ubuntu/Projects/UsEquityStrategies/src timeout 180 .venv/bin/python -m pytest tests/test_runtime_config_support.py tests/test_event_loop.py::test_account_group_can_override_ib_gateway_port tests/test_event_loop.py::test_ib_gateway_mode_derives_paper_port tests/test_account_group_examples.py tests/test_strategy_runtime.py tests/test_request_handling.py::test_build_extra_notification_lines_includes_account_id tests/test_request_handling.py::test_handle_request_sends_escalated_strategy_plugin_alert -qtimeout 120 .venv/bin/python -m ruff check README.md docs/examples/ibkr-account-groups.paper.json docs/ibkr_runtime_rollout.md main.py runtime_config_support.py tests/test_account_group_examples.py tests/test_event_loop.py tests/test_request_handling.py tests/test_runtime_config_support.py tests/test_strategy_runtime.py