我在他们的API中使用IB提供的样本,但我绝对(至少从我看到的)随机结果,这里有一些日志:
main (16:32:27): REQ: secDef 1
main (16:32:27): REQ: rfq 1528036347
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2104 msg=Market data farm connection is OK:usfuture
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2104 msg=Market data farm connection is OK:eufarm
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2104 msg=Market data farm connection is OK:usopt
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2104 msg=Market data farm connection is OK:usfarm
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2106 msg=HMDS data farm connection is OK:euhmds
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2106 msg=HMDS data farm connection is OK:ushmds
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2104 msg=Market data farm connection is OK:usfuture
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2104 msg=Market data farm connection is OK:eufarm
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2104 msg=Market data farm connection is OK:usopt
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2104 msg=Market data farm connection is OK:usfarm
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2106 msg=HMDS data farm connection is OK:euhmds
AWT-EventQueue-0 (16:32:27): Error id=-1 code=2106 msg=HMDS data farm connection is OK:ushmds
AWT-EventQueue-0 (16:32:27): tickPrice:1 field:68 (delayedLast) value:1.55
AWT-EventQueue-0 (16:32:27): tickPrice:1 field:66 (delayedBid) value:1.51
AWT-EventQueue-0 (16:32:27): tickPrice:1 field:67 (delayedAsk) value:1.56
AWT-EventQueue-0 (16:32:27): tickPrice:1 field:72 (delayedHigh) value:2.1
AWT-EventQueue-0 (16:32:27): tickPrice:1 field:73 (delayedLow) value:1.48
AWT-EventQueue-0 (16:32:27): tickSize:1 field:74 (delayedVolume) value:161
AWT-EventQueue-0 (16:32:27): tickPrice:1 field:75 (delayedClose) value:1.47
AWT-EventQueue-0 (16:32:27): Error id=1 code=10090 msg=Part of requested market data is not subscribed. Subscription-independent ticks are still active.Delayed market data is available.IBM NYSE/TOP/ALL
请注意,尽管Error
,我仍然收到延迟的价格。
现在(28秒后)我重新启动了完全相同的样本而没有触及任何东西:
main (16:32:55): REQ: secDef 1
main (16:32:55): REQ: rfq 1528036375
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2104 msg=Market data farm connection is OK:usfuture
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2104 msg=Market data farm connection is OK:eufarm
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2104 msg=Market data farm connection is OK:usopt
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2104 msg=Market data farm connection is OK:usfarm
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2106 msg=HMDS data farm connection is OK:euhmds
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2106 msg=HMDS data farm connection is OK:ushmds
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2104 msg=Market data farm connection is OK:usfuture
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2104 msg=Market data farm connection is OK:eufarm
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2104 msg=Market data farm connection is OK:usopt
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2104 msg=Market data farm connection is OK:usfarm
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2106 msg=HMDS data farm connection is OK:euhmds
AWT-EventQueue-0 (16:32:55): Error id=-1 code=2106 msg=HMDS data farm connection is OK:ushmds
AWT-EventQueue-0 (16:32:55): Error id=1 code=10090 msg=Part of requested market data is not subscribed. Subscription-independent ticks are still active.Delayed market data is available.IBM NYSE/TOP/ALL
现在我没有收到任何价格!这是呼叫本身的样子:
client().reqMarketDataType(3); //delayed prices
client().reqMktData(1,contract,"",true, null);
有什么想法吗?
答案 0 :(得分:0)
使用Ib_insync sdk对我有用:
ib = IB()
ib.connect('127.0.0.1', 7497, clientId=1)
c = Contract(conId=292579214)
ib.qualifyContracts(c)
ib.reqMarketDataType(3)
ticker = ib.reqTickers(c)
print(ticker)
for obj in ticker:
print("--->{}<------".format(obj.ask))```
也许这会帮助别人...