Komnomnomnom / swigibpy

Third party Interactive Brokers Python API generated from TWS C++ API using SWIG.
http://github.com/Komnomnomnom/swigibpy/
Other
157 stars 35 forks source link

Exchange not set in EWrapper::position #45

Closed CLevasseur closed 8 years ago

CLevasseur commented 8 years ago

I'm trying to get the exchange of a contract i have position on. From my understanding of the IB documentation, this info is not given in EWrapper::updatePortfolio and should be obtained in EWrapper::position instead, but in my case the exchange is not set in EWrapper::position.

My code looks like this:

def position(self, accountName_p, contract_p, position_p, avgCost_p):
    print("set exchange to '%s'" % contract_p.exchange)

And prints:

set exchange to ''

Maybe i'm missing something obvious but I can't tell what. Other information about the contract are correctly received

I'm using TWS build 952.2h, and swigibpy 0.5.0

Komnomnomnom commented 8 years ago

This is more of a question about the TWS API than swigibpy. Calls to EWrapper methods are passed whatever info TWS provides.

Have you tried reqContractDetails() or reqExecutions() to get the info you need? Refer to the C++ API docs for more details https://www.interactivebrokers.co.uk/en/software/api/api.htm

I'm going to close this as it isn't directly related to swigibpy. If you think it's a swigibpy bug or that swigibpy is doing something wrong please re-open.