If I run a basic TWS example, I receive the error message . If I comment out the error()
call back it runs fine. I've tried this on several examples and get the same result.
Exception has occurred: TypeError
error() takes 4 positional arguments but 5 were given
File "/Users/jayurbain/Dropbox/twsapi/Algorithmic Trading using Interactive Broker's
Python API /ib_basic_app.py", line 20, in <module> app.run()
Please advise.
Here's the call back that is being overridden in wrapper.py:
def error(self, reqId:TickerId, errorCode:int, errorString:str, advancedOrderRejectJson = ""):
Here is the entire code:
from ibapi.client import EClient
from ibapi.wrapper import EWrapper
class TradingApp(EWrapper, EClient):
def __init__(self):
EClient.__init__(self,self)
def error(self, reqId, errorCode, errorString):
print("Error {} {} {}".format(reqId,errorCode,errorString))
app = TradingApp()
app.connect("127.0.0.1", 7497, clientId=1)
app.run()
The solution to the problem was to execute python setup install
rather than using pip
to install ibapi. Thanks for your answers.