-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
Hi,
super useful project, thanks for publishing :)
I'm trying to run ibdemo.py live for several consecutive days. The job crashes when TWS auto-restarts. With _debug=True I get:
2023-08-09 20:14:00,109 ib_insync.client ERROR Peer closed connection.
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py", line 258, in __step
result = coro.throw(exc)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py", line 654, in sleep
return await future
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/futures.py", line 284, in __await__
yield self # This tells Task to wait for completion.
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py", line 328, in __wakeup
future.result()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/futures.py", line 196, in result
raise exc
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/admin/backtrader_ib_insync/venv/lib/python3.9/site-packages/ib_insync/util.py", line 341, in run
result = loop.run_until_complete(task)
File "/Users/admin/backtrader_ib_insync/venv/lib/python3.9/site-packages/nest_asyncio.py", line 99, in run_until_complete
return f.result()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/futures.py", line 196, in result
raise exc
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/admin/backtrader_ib_insync/examples/ibdemo_thomas.py", line 58, in <module>
run()
File "/Users/admin/backtrader_ib_insync/examples/ibdemo_thomas.py", line 54, in run
cerebro.run()
File "/Users/admin/backtrader/backtrader/cerebro.py", line 1132, in run
runstrat = self.runstrategies(iterstrat)
File "/Users/admin/backtrader/backtrader/cerebro.py", line 1303, in runstrategies
self._runnext(runstrats)
File "/Users/admin/backtrader/backtrader/cerebro.py", line 1547, in _runnext
drets.append(d.next(ticks=False))
File "/Users/admin/backtrader/backtrader/feed.py", line 407, in next
ret = self.load()
File "/Users/admin/backtrader/backtrader/feed.py", line 480, in load
_loadret = self._load()
File "/Users/admin/backtrader_ib_insync/backtrader_ib_insync/ibdata.py", line 448, in _load
self.q = self.ibstore.reqRealTimeBars(self.contract)
File "/Users/admin/backtrader_ib_insync/backtrader_ib_insync/ibstore.py", line 544, in reqRealTimeBars
self.ib.sleep(duration)
File "/Users/admin/backtrader_ib_insync/venv/lib/python3.9/site-packages/ib_insync/util.py", line 386, in sleep
run(asyncio.sleep(secs))
File "/Users/admin/backtrader_ib_insync/venv/lib/python3.9/site-packages/ib_insync/util.py", line 343, in run
raise globalErrorEvent.value() or e
ConnectionError: Socket disconnect
Any idea?
Metadata
Metadata
Assignees
Labels
No labels