简体   繁体   中英

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM