You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.
When an ib_insync connection is closed, the events (e.g., the often used Ticker.updateEvent, Trade.statusEvent and Trade.fillEvent) are not set as "done" by the ib_insync machinery. This forces client code to track at the same time both these events and the global disconnection event to stop listening to the former once a disconnection occurs and trigger the right exceptions.
However looking deeper into ib_insync code, it does set as done some events in some situations: if the protocol version is incorrect, Ticker.updateEvents are properly set as done
This irregularity is not documented and not generalized elsewhere. It seems simpler to simplify this: the API should either guarantee that all events are set as done, or none of them (in such case we could get rid of that code in the library that brings no benefit anyway).
PS: if a choice is made, the former alternative would make client code much easier, as we are currently forced to double-track events and the disconnection everywhere as the "done" state is in most cases never triggered by a disconnection.
The text was updated successfully, but these errors were encountered:
Thanks for your insightful bug report. All events that belong to objects that get destroyed after a disconnect should be set as done (*). Currently this is not done after a regular disconnect, and also not for trade events. This will be fixed.
(*) Note that this does not apply to the IB.xxxEvent events, they can start emitting again after a new connection is made.
When an ib_insync connection is closed, the events (e.g., the often used Ticker.updateEvent, Trade.statusEvent and Trade.fillEvent) are not set as "done" by the ib_insync machinery. This forces client code to track at the same time both these events and the global disconnection event to stop listening to the former once a disconnection occurs and trigger the right exceptions.
However looking deeper into ib_insync code, it does set as done some events in some situations: if the protocol version is incorrect, Ticker.updateEvents are properly set as done
ib_insync/ib_insync/wrapper.py
Line 116 in 10ee98a
This irregularity is not documented and not generalized elsewhere. It seems simpler to simplify this: the API should either guarantee that all events are set as done, or none of them (in such case we could get rid of that code in the library that brings no benefit anyway).
PS: if a choice is made, the former alternative would make client code much easier, as we are currently forced to double-track events and the disconnection everywhere as the "done" state is in most cases never triggered by a disconnection.
The text was updated successfully, but these errors were encountered: