我使用IB网关连接到tws,使用IbPy示例Python2.7来自https://gist.github.com/valiant-falstaff/4093998b625d76ef4afe的代码,它会产生以下错误:
Server Error: <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.>
Server Response: error, <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.>
Server Error: <error id=-1, errorCode=504, errorMsg=Not connected>
Server Response: error, <error id=-1, errorCode=504, errorMsg=Not connected>但是,我没有选择在Gateway中选择“启用ActiveX和套接字客户端”,在我找到的所有示例中都显示了这一点。这就是“标准”设置窗口的样子。

这就是我的设置窗口

。有人知道我怎么解决这个问题吗?
发布于 2017-04-25 04:26:21
Brian发现了这个问题--代码调用了一个与GUI截图不同的端口。(为结案而回答)
https://stackoverflow.com/questions/43561619
复制相似问题