I want to receive the average cost of a single position.
I am using the IB-insync API and using reqPositions(). The ouput is:
[Position(account='DU1675421', contract=Stock(conId=29622888, symbol='HEIA', exchange='AEB', currency='EUR', localSymbol='HEIA', tradingClass='HEIA'), position=100.0, avgCost=90.97088),
Position(account='DU1675421', contract=Future(conId=176791153, symbol='N225M', lastTradeDateOrContractMonth='20191212', multiplier='100', currency='JPY', localSymbol='164120019', tradingClass='NK225M'), position=1.0, avgCost=2284540.0)]
I would like to have the avgcost of 1 position. How would I do this?
b = ib.reqPositions()
while ib.sleep(0.5):
plb = b
print (plb)
b.avgCost() doesn't work.