erdewit / ib_insync

Python sync/async framework for Interactive Brokers API
BSD 2-Clause "Simplified" License
2.8k stars 743 forks source link

reqHistoricalData Error #169

Closed palepoodot closed 5 years ago

palepoodot commented 5 years ago

Looks like the reqHistoricalData function is giving out an error.

" File "~/TWS/algos/python3/lib/python3.7/site-packages/ib_insync/ib.py", line 1052, in reqHistoricalData useRTH, formatDate, keepUpToDate, chartOptions)) File "~/TWS/algos/python3/lib/python3.7/site-packages/ib_insync/ib.py", line 290, in _run return util.run(*awaitables, timeout=self.RequestTimeout) File "~/TWS/algos/python3/lib/python3.7/site-packages/ib_insync/util.py", line 251, in run result = loop.run_until_complete(task) File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete return future.result() ConnectionError: Socket disconnect " Tried amending the reqHistoricalDataAsync function's fields list, which may also be causing some issues: " Error 320, reqId 0: Error reading request:Message type 0. Unable to parse data. java.lang.NumberFormatException: For input string: "1 D" Error 320, reqId -1: Error reading request:Message type -1. Unable to parse data. java.lang.NumberFormatException: For input string: "TRADES" "

Not sure where the issue is, please help?

erdewit commented 5 years ago

It must be an old TWS version (at least v972 is required). I've added a version check to the code.