Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Handling disconnection with reqHistoricalData(keepUpToDate=True) stream #699

Open
kkotsche1 opened this issue Feb 26, 2024 · 1 comment
Open

Comments

@kkotsche1
Copy link

kkotsche1 commented Feb 26, 2024

I have been attempting to solve this issue for quite a while now, to no avail unfortunately. Maybe I can find some pointers/insights here as I am close to giving up on this.

I am using the keepUpToDate flag to run my trading logic where I am checking for certain conditions on each new bar received.

I have been attempting to deal with the case where Interactive Brokers loses connection (which happens every now and then, regardless of my internet connections stability), leading to interruption of the bar stream and subsequent death of my programs ability to do anything. However, I am unable to figure out any way in which I can get this thing spun back up after a loss of connection to restart the stream and continue on with the trading logic.

Is there a best practice way to handle this?

I am able to re-establish a connection, but the data stream doesn't continue. I am currently running my trading logic in a seperate function which I tag on to the updateEvent associated with the reqHistoricalData

I have previously tried to handle/solve this using the ib.errorEvent. However, I have been unable to get my reqHistoricalData stream back up and running after reconnection

@jlixfeld
Copy link

I don't use keepUpToDate so I don't know if this question has an obvious answers, but as you are able to re-establish a connection, are you able to just run reqHistoricalData again?

FWIW there is reqRealTimeBars. Or, maybe you could just run reqHistoricalData in a loop at some interval instead of KeepUpToDate?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants