且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

IbPy:我无法获取市场数据

更新时间:2022-04-02 00:37:45

我假设您只是在粘贴代码时弄乱了格式.否则它将永远无法正常工作.

I'm assuming you just messed up the formatting when pasting the code. It would never work otherwise.

如果您收到错误回调,则可能会看到类似无效的通用刻度"的信息.您将"AAPL"放置在您指定想要的报价类型的位置.只需将其保留为空白即可.

If you were getting error callbacks you may have seen something like "invalid generic ticks". You put 'AAPL' in the position where you specify which type of ticks you want. Just leave this empty for normal ticks.

con.reqMktData(tickId, stkContract, '', False)

我不确定演示将使用哪个端口和ID,但您可以在此处指定是否不是7496、0(默认值).

I'm not sure what port and id the demo uses but you can specify here if not 7496, 0 (the defaults).

例如con = ibConnection(port = 7497, clientId = 123)