Python google colab与IB的连接
正在尝试运行以下代码以连接到IB APIPython google colab与IB的连接,python,google-colaboratory,interactive-brokers,Python,Google Colaboratory,Interactive Brokers,正在尝试运行以下代码以连接到IB API 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', 7497, 1) app.run() 但是,
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', 7497, 1)
app.run()
但是,请在下面获得一条消息:
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
我已经打开了我的TWS并启用了activeX,还试图取消本地主机的限制,但没有帮助。花了一天时间寻找解决方案,但运气不佳。也许基本上不可能通过colab连接IB
非常感谢您的帮助,谢谢