from ib_insync import IB
class MyTrader:
def __init__(self):
self.ib = IB()
self.ib.setCallback('commissionReport', self.commissionCallback)
def commissionCallback(self, *args):
print(args[-1]) # CommissionReport object will be printed when order is filed
def trulala(self):
self.ib.connect('127.0.0.1', 7498, 1)
contract = Contract(...)
order = Order(...)
self.ib.placeOrder(contract, order)
好吧,我找到了一个解决方案:
最后,还有一种更简单的方法(如果需要访问对象,它很有用),它:
^{pr2}$将返回一个Fill对象列表,其中包含所有必需对象的元组,如Contract、Order、Execution和CommissionReport。在
你应该在https://groups.io/g/insync询问具体细节。我怀疑这里有人使用这个库。在
在执行死刑时不会返回佣金,而是在commissionReport中返回。http://interactivebrokers.github.io/tws-api/classIBApi_1_1CommissionReport.html
请注意,id是与commission报告匹配的执行id。在
相关问题 更多 >
编程相关推荐