Skip to content
Advertisement

Python Interactive Brokers ibapi

I am having trouble using and incrementing the “orderId” for each stock order using modified IB example code. I have a method that produces nextValidId within the class and prints it to stdout but I am not sure how to access the defined property (self.nextValidOrderId) that is created in my main() program body. I am able to instantiate the EWrapper and EClient Class and place orders (If I manually input the orderId). In example code I hard code it to 126. I thought I would be able to use the following in my main() program body. “orderId = app.nextValidOrderId” but it does not work.

JavaScript

Advertisement

Answer

Your method is not syntactically correct. It should have indentation as below

JavaScript

Also you are not importing the function decorator iswrapper

JavaScript

Hope this helps

Advertisement