¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

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

?

?

?

From: [email protected] <[email protected]> On Behalf Of sunyc45@...
Sent: 02 March 2021 21:39
To: [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)
?

Join [email protected] to automatically receive all group messages.