Is anyone failed to use ibpy in new TWS on windows?
-
I use TWS and IBpy on ubuntu,it's ok. However,on the windows10,the IBpy cannot connect to TWS.
error info:<error id=-1, errorCode=502, errorMsg=Couldn't connect to TWS. Confirm that "Enable ActiveX and Socket Clients" is enabled on the TWS "Configure->API" menu.>

from ib.opt import Connection def print_message_from_ib(msg): print(msg) def main(): conn = Connection.create(host="127.0.0.1",port="7497",clientId=999) conn.registerAll(print_message_from_ib) conn.connect() #In future blog posts, this is where we'll write code that actually does #something useful, like place orders, get real-time prices, etc. import time time.sleep(1) #Simply to give the program time to print messages sent from IB conn.disconnect() if __name__ == "__main__": main()
-
@tianjixuetu As the error said - you should check the "Enable ActiveX and Socket Clients" settings
-
@vladisld I am very sorry. this picture is new, in fact, in the TWS, the "Enable ActiveX and Socket Clients" is choosed. however,when I use the TWS API ,not the IBpy,I can connect. so,is the IBpy on the windows go wrong? on the ubuntu,the IBpy can use.
-
@tianjixuetu ok. One other thing that I've noticed in my experience is the default port number on linux and windows could be different.
So if your code assumes the same port on all platforms - this could be a source of the problem and it worth to check this out.
I
-
@vladisld thank you very much.