Re: avgFillPrice returning zero
If you're using ib_insync, you should ask this question at /g/insync
?
This group is for the APIs provided by IBKR only.
?
Thanks
?
Richard King
TWSAPI Group Owner and Moderator
?
?
?
toggle quoted message
Show quoted text
From: [email protected] <[email protected] > On Behalf Of sunyc45@...Sent: 02 March 2021 21:39To: [email protected] Subject: Re: [TWS API] avgFillPrice returning zero
?
Some more details:
I'm using ib_insync to get a list of all trades from the current session, then getting the data for each trade. Not tracking orderID or anything since I'm relatively new and haven't gotten that to work for me yet. It seems like all the other trade data pulls up fine, so I'm not sure why avgFillPrice doesn't.
Relevant code:
ib = IB()
ib.connect('127.0.0.1', 7496, clientId=10)
tradesList = ib.trades()
?
for trade in tradesList:
???? ticker = trade.contract.symbol
???? buyOrSell = trade.order.action
???? qty = trade.order.filledQuantity
???? price = trade.orderStatus.avgFillPrice
???? print("Trade: ", buyOrSell, ticker, '? qty: ', qty, 'price: ', price)
?
Are you sure you wish to delete this message from the message archives of
[email protected] ?
This cannot be undone.
Are you sure you wish to repost this message?