gunterdo
gunterdo

Reputation: 11

How to get my shares amount in ib_insync?

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!

Upvotes: 1

Views: 3205

Answers (1)

Josh
Josh

Reputation: 816

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

Upvotes: 2

Related Questions