简体   繁体   English

如何在ib_insync中获得我的股份金额?

[英]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. 我有一个盈透证券帐户,并使用ib_insync python包与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 基本上,您只需要使用positions()函数

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 来自: https : //github.com/erdewit/ib_insync/blob/master/notebooks/ordering.ipynb

ib_insync documentation ib_insync文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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