A process I have that's been running for a couple of years suddenly stopped working. I avoided updating much in the way of python and packages to avoid that..
I've now updated ib_insync to the latest version, and no improvement. debugging a little gives me this:
the code import ib_insync as ibis ib = ibis.IB() contract = ibis.Contract() contract.secType = 'STK' contract.currency = 'USD' contract.exchange = 'SMART' contract.localSymbol = 'AAPL' ib.qualifyContracts(contract)
Result: File "/Users/macuser/anaconda3/lib/python3.6/site-packages/ib_insync/client.py", line 244, in send if field in empty: File "/Users/macuser/anaconda3/lib/python3.6/site-packages/ib_insync/contract.py", line 153, in hash raise ValueError(f'Contract {self} can't be hashed') ValueError: Contract Contract(secType='STK', exchange='SMART', currency='USD', localSymbol='AAPL') can't be hashed Exception ignored in: <bound method IB.del of <IB connected to 127.0.0.1:7497 clientId=6541>> Traceback (most recent call last): File "/Users/macuser/anaconda3/lib/python3.6/site-packages/ib_insync/ib.py", line 233, in del File "/Users/macuser/anaconda3/lib/python3.6/site-packages/ib_insync/ib.py", line 281, in disconnect File "/Users/macuser/anaconda3/lib/python3.6/logging/init.py", line 1306, in info File "/Users/macuser/anaconda3/lib/python3.6/logging/init.py", line 1442, in _log File "/Users/macuser/anaconda3/lib/python3.6/logging/init.py", line 1452, in handle File "/Users/macuser/anaconda3/lib/python3.6/logging/init.py", line 1514, in callHandlers File "/Users/macuser/anaconda3/lib/python3.6/logging/init.py", line 863, in handle File "/Users/macuser/anaconda3/lib/python3.6/logging/init.py", line 1069, in emit File "/Users/macuser/anaconda3/lib/python3.6/logging/init.py", line 1059, in _open NameError: name 'open' is not defined
| => python --version
Python 3.6.4 :: Anaconda, Inc.
I am not OP, but have had a similar problem. I am attempting to send an order to IB using ib_insync.
Here is the exception that is returned:
I understand that lists and other mutable can't be hashed, but I don't understand why this wouldn't work. It pretty clearly follows the examples in the ib_insync docs.