I can't connect to TWS. I've confirmed that "Enable ActiveX and Socket EClients" is enabled and connection port is the same as "Socket Port" on the TWS.
import ibapi
from ibapi.client import EClient
from ibapi.wrapper import EWrapper
class IBApi(EWrapper,EClient):
def __init__(self):
EClient.__init__(self, self)
class Bot:
ib=None
def __init__(self):
ib=IBApi()
ib.connect("127.0.0.1",7497,1)
ib.run()
bot=Bot()
I tried changing the port number, but I was not able to also change it from Interactive Broker Client App.