I'm just starting to use the IB API in python. I'm able to retrieve all the desired results I want. However, one big problem arise to me. I don't fully understand how the linkage between the EClient
class and a particular callback is made within the EWrapper
class.
As of now I understand the workflow like this (high level):
As far as I understand, IB Gateway triggers the correct Callback function. What I don't see from the documentation / source code is the connection between a EClient
method and a the interface (callback) I override in my EWrapper
class. When I trigger a specific method in step 1 above. How does IB Gateway know, which callback to run? Is this specified somewhere?
The callback functions which handle responses to each function called in EClient are hard-coded and detailed in the TWS API Reference Guide.
For instance, calling EClient.reqAccountUpdates causes responses to be returned in EWrapper::updateAccountValue
and EWrapper::updatePortfolio
, and you would need to override those functions in your own code.