0

I have an Interactive Broker account and use ib_insync python package to work with IB API.

I've bought some shares of one company via multiple transactions. How to get the total amount of shares of that company which I have? I need it to know how much I can sell.

Thanks!

gunterdo
  • 1
  • 1
  • 1
  • You should read the API documentation. http://interactivebrokers.github.io/tws-api/positions.html I don't use insync but there's a user group at https://groups.io/g/insync/messages – brian Jul 12 '19 at 14:22

1 Answers1

2

Basically you would just need to use the positions() function

from ib_insync import *
util.startLoop()

ib = IB()
ib.connect('127.0.0.1', 7497, clientId=1)
ib.positions()

From: https://github.com/erdewit/ib_insync/blob/master/notebooks/ordering.ipynb

ib_insync documentation

Josh
  • 706
  • 3
  • 8