Closed jjharr closed 10 months ago
Where is fetch_history
from?
You're probably trying to use Stock()
as a dict key, but the Stock
classes aren't frozen/immutable, so they can't be used as dict keys.
Simplest solution is to index by symbol only, or you can combine (symbol, exchange, currency)
into a tuple for indexing your results too.
The conId
is used as the hash for a contract, so the conId field must be filled for the contract to be hashable. This can be done with ib.qualifyContracts(contract)
, for example.
I'm using ib_insync-0.9.86, which is the current version as of today.
Error is:
ValueError: Contract Stock(symbol='TZA', exchange='SMART', currency='USD') can't be hashed
To reproduce: