c++ - 使用 100 个符号时,交互式经纪人 api 落后于 tws

标签 c++ interactive-brokers

在我开始在屏幕上放置更多符号之前,我一直没有遇到这个问题。我不认为这是一个处理问题,我的 cpu 一直很好,而且我也没有做任何 super super 花哨的事情(只是将数据存储到对象并经常写入 txt 文件)。

从使用 api 的第一天开始,我注意到我必须在不断检查消息的 while 循环中放置一个 sleep(1),如下所示:

PosixTestClient client;
client.connect( host, port, clientId);  
while( client.isConnected()) {
        sleep(1);
        client.processMessages();
    }

如果我那里没有 sleep(1),它就会崩溃。所以我想我的第一个问题是:这正常吗?或者有什么问题吗?

我的下一个问题是...关于为什么 api 数据与 tws 数据相比可能存在滞后的任何提示?我知道有一个滞后,因为当数据进入 api 时,我将它存储到字符串中,然后每分钟将数据写入文本文件。然后我返回浏览我的文本文件并将其与 tws 中的图表进行比较……我注意到大约有 2 分钟的延迟!我还注意到,在交易日的前半个小时之后,情况似乎变得更好(滞后消失),当时交易非常活跃。

那么……有什么建议吗?

最佳答案

您是否订阅了 Booster 包? TWS API 有 100 个报价限制,以及 API。您可以花 30 美元购买额外的 100 个报价单。

Quote Booster Increase your allowance of simultaneous quotes windows by purchasing monthly Quote Booster packs at USD 30.00 per pack.

Each booster pack provides 100 simultaneous Level I quotes. Booster Pack quotes are additional to your monthly quote allotment from all sources, including commissions. Booster pack quotes are available for use in the desktop systems and in the API. Once subscribed, quotes are available immediately and will display the next time you log into the system. Data from a cancelled booster pack subscription remains available through the end of the current billing cycle. Limit of 10 Quote Booster packs per account.

关于c++ - 使用 100 个符号时,交互式经纪人 api 落后于 tws,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43122123/

相关文章:

java - 自定义 Interactive Brokers 的 reqIds() 和 reqMktData() Java 方法

C++ vector 与数组(时间)

c++ - 遍历任意形状的点

C++ Builder XE2 - 复选框提示不显示

c++ - 项目包含的lib比dll文件多

c++ - 如何识别从 iBrokers API 接收到的 HistoricalData 的类型(whatToShow)

python - 获取 SPY 股价

c++ - vector 删除错误

c++ - 盈透证券为单个订单返回多个 "presubmitted"订单状态

链接到 Ox 的 C 库