I removed spaces before the definition of error function;
it worked. But I don't know why.
Is there anyone explain this?
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()
python testreq.py
-->
ERROR -1 1754209901652 2104 Market data farm connection is OK:usfarm.nj
ERROR -1 1754209901652 2104 Market data farm connection is OK:usfuture
ERROR -1 1754209901652 2104 Market data farm connection is OK:eufarm
ERROR -1 1754209901659 2104 Market data farm connection is OK:usopt.nj
ERROR -1 1754209901660 2104 Market data farm connection is OK:cashfarm
ERROR -1 1754209901661 2104 Market data farm connection is OK:usopt
ERROR -1 1754209901661 2104 Market data farm connection is OK:usfarm
ERROR -1 1754209901662 2106 HMDS data farm connection is OK:ushmds
ERROR -1 1754209901662 2158 Sec-def data farm connection is OK:secdefil