mvberg / ib-gateway-docker

Interactive Brokers Trading Gateway running in Docker
MIT License
229 stars 105 forks source link

error when trying to connect to the api #25

Open eladnm opened 4 years ago

eladnm commented 4 years ago
ERROR -1 502 Couldn't connect to TWS. Confirm that "Enable ActiveX and Socket EClients" 
is enabled and connection port is the same as "Socket Port" on the 
TWS "Edit->Global Configuration...->API->Settings" menu. Live Trading ports: 
TWS: 7496; IB Gateway: 4001. Simulated Trading ports for new installations 
of version 954.1 or newer:  TWS: 7497; IB Gateway: 4002
using this code:
from ibapi.client import EClient
from ibapi.wrapper import EWrapper  
class IBapi(EWrapper, EClient):
     def __init__(self):
         EClient.__init__(self, self) 

app = IBapi()
app.connect('127.0.0.1', 4002,123)
app.run()

tried all 4 ports with no luck...

nshale2 commented 3 years ago

@eladnm did you ever figure this out?

Jake0303 commented 3 years ago

Having this issue too ....

LaurenceBont commented 3 years ago

Make sure you have "Enable ActiveX and Socket EClients" enabled in your settings. If you download and use VNCviewer you should be able to inspect the application and go to settings and see if both "Enable ActiveX and Socket EClients" are enabled.