Closed piotrgolawski closed 1 year ago
Probably you're specifying totalQuantity
as a str. It must be int or float.
Are you totally sure?
At first I was not setting totalQuantity at all, just quantity as a integer.
When I setup totalQuantity also as a integer (just number 2), the problem was still there.
Have you checked that?
Pretty sure yes. I see that you're using a very old version of ib_insync and it would be wise to update it.
Oh, I will then, thank you
Yo. As in title print('trade.remaining()', trade.remaining()) File "/home/p/.cache/pypoetry/virtualenvs/trader-QSw8Zroc-py3.10/lib/python3.10/site-packages/ib_insync/order.py", line 327, in remaining return self.order.totalQuantity - self.filled() TypeError: unsupported operand type(s) for -: 'str' and 'int'
You are casting it somewhere probably, so def remaining(self): """Number of shares remaining to be filled.""" return int(self.order.totalQuantity) - int(self.filled())
BTW. can you share a suggestion how to make sell function to wait untill filledEvent will be finished? Just to make this stuff synchronous.
Thanks