erdewit / ib_insync

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

whatif hangs #525

Closed peachy88 closed 1 year ago

peachy88 commented 1 year ago

since "Treat error 110 as a warning, fixes https://github.com/erdewit/ib_insync/issues/502." whatif may hang

example: contract = Stock(currency='EUR', secIdType='ISIN', secId='NL0012817175', exchange='IBIS') ib.qualifyContracts(contract) order = LimitOrder("BUY", 1, 90.11, usePriceMgmtAlgo=True) status = ib.whatIfOrder(contract, order)

whatIfOrder causes the script to hang and won't do anything. because 90.11 is not a valid price for the asset (90.10 or 90.12 is)

removing "110" in this line in wrapper.py "warningCodes = {110, 165, 202, 399, 404, 434, 492, 10167}"

fixes the issue.

Instead of infenidly freezing, it raises the error.

erdewit commented 1 year ago

I fixed this by special-casing error 110 for a whatIf request. This is available in v0.9.76.