I am using the great package ib_insync
for building a project with IB
. I am getting some live ticker data as follows (pseudo code
):
await self._ib_instance.connectAsync(host=self._host, port=self._port, clientId=100, readonly=True)
for contract in contracts:
self._ib_instance.reqMktData(contract)
sleep(2)
for ticker in tickerEvent:
print(ticker)
Basically I insert to a tickerEvent
5 K contracts and then listen to ticker data. And it works just perfect, but with the lapse of time (no pattern, always different time intervals) like 5 mins or 50 mins I get the error:
client - Peer closed connection
I found in the docs this error. But I do not know how to handle it? How to catch it? I try to catch it and reconnect, but it did not help!
Please help to solve this issue!