erdewit / ib_insync

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

Getting portfolio share positions omits or rounds all fractional shares? #433

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hello it seems that either the ib_insync api or ibkr tws api seems to round or omit (if rounding leads to 0) fractional shares. For some positions fractional shares that round to 0 can be worth thousands of dollars, is there a way to keep it from rounding?

Also if I have for instance, 57.68 shares, it rounds to 58.0 shares - which can end up leveraging a short if I were to sell what it tells me I have.

erdewit commented 2 years ago

Probably you have an older version of ib_insync - there's no position rounding in the current one.

ghost commented 2 years ago

I'm using 0.9.70 that pycharm finds when it searches for packages and python 3.9, says its the latest, do I need to clone the repo to get a newer version?

erdewit commented 2 years ago

That's the latest version which is good. The position data must then be sent already rounded by IB. I think a recent gateway/TWS is needed as well.

ghost commented 2 years ago

Ok, I'll just try to take proper precautions into account in my program. Thanks.