0

How do i interpret this API response

<position account=DU226955, contract=<ib.ext.Contract.Contract object at 0x10be14650>, pos=3000, avgCost=0.903681278811>
<positionEnd>

everything is correct but how do i get the contract name out of this?

TB1
  • 269
  • 2
  • 5
  • 10

1 Answers1

1

To get the contract symbol (for example) from the message that IbPy returns to your handler, you can do this:

def handler(msg):
    print(msg.contract.m_symbol)
Brian from QuantRocket
  • 5,268
  • 1
  • 21
  • 18