nautechsystems / nautilus_trader

A high-performance algorithmic trading platform and event-driven backtester
https://nautilustrader.io
GNU Lesser General Public License v3.0
1.71k stars 402 forks source link

Fix IBKR resubscribing after disconnection #1626

Closed benjaminsingleton closed 1 month ago

benjaminsingleton commented 2 months ago

Pull Request

As reported in the Interactive Brokers Discord channel, resubscribing to subscriptions after a reconnect only worked for 1 of multiple subscriptions. This PR fixes that issue and also refactors the lifecycle methods, which are synchronous functions that need to call asynchronous functions.

Type of change

How has this change been tested?

Tests pass and validated with live trading.

benjaminsingleton commented 1 month ago

I tested this on live markets and got the expected result, so I'm ready to merge.