Historical data limitations in IB API (C++)

Hi, I'm developing a trading bot based on IB api (actually, I almost finished and it's working jast well), but jast found out that I can make only 60 requests for historical data in 10 minutes.
I'm going to trade on around 170 instruments and I need 2 last closed bars for every instrument every 5 minutes(I'm trading on 5-minute chart). Does it mean that I will be able to get this data only for 60 instruments in every 10 minites?
I didnt think that it will be a problem to get 340 bars of historical data every 5 minutes.
I guess I need to use another data service like IQFeed(they have API and fees bot very Expensive) or maybe you have some advice how to get this solved.
Thank you.
 
In case you only need the closing price of each bar you could build your own database by using streaming market data instead of using historical data bars. You split your list of 170 tickers into two groups, each group having less than 100 tickers. You wait until the clock is at a multiple of 5 minutes. Then you subscribe to streaming market data to all tickers in the first group. Wait until you have received the latest price for all tickers. Then unsubscribe from these tickers and subscribe to all tickers in the second group. Wait until you have received the data and unsubscribe. Now you wait until five minutes have passed and repeat the process. Streaming market data is not subject to the 10 minute rule, as far as I know.
More fancy solutions based on this principle are probably also possible.
 
Thought about that, but I need not only closing price, but also low, hight and open prices. That's why I need historical data. I read their rules a few more times and it seems like this limitations only for small bars(30 sec or less) (https://interactivebrokers.github.io/tws-api/historical_limitations.html )and for bigger bars there is no limitstions except 50 simultaneous requests what can be increased with boost bandles (additional 100 simultaneous requests for 30$/month). But still, I'm not sure on 100% percent. Seems like I should jast try to run bot on papertrading account and see what happens.
 
Thought about that, but I need not only closing price, but also low, hight and open prices. That's why I need historical data. I read their rules a few more times and it seems like this limitations only for small bars(30 sec or less) (https://interactivebrokers.github.io/tws-api/historical_limitations.html )and for bigger bars there is no limitstions except 50 simultaneous requests what can be increased with boost bandles (additional 100 simultaneous requests for 30$/month). But still, I'm not sure on 100% percent. Seems like I should jast try to run bot on papertrading account and see what happens.
The 50 messages per second implies that you have to spread out your 170 reqHistoricalData() requests over 4 seconds, plus any other message that you would submit to IB at that time. This "50 messages" limitation only counts the messages you send to IB (e.g. data requests, orders sent, etc). The amount of messages (and data) from IB to you is not involved in this calculation.
Rereading that web page you could be correct about downloading historical data. Pay attention to note #1 at the bottom of that page though:
1. At this time Historical Data Limitations for barSize = "1 mins" and greater have been lifted. However, please use caution when requesting large amounts of historical data or sending historical data requests too frequently. Though IB has lifted the "hard" limit, we still implement a "soft" slow to load-balance client requests vs. server response. Requesting too much historical data can lead to throttling and eventual disconnect of the API client. If a request requires more than several minutes to return data, it would be best to cancel the request using the IBApi.EClient.cancelHistoricalData function.
 
you slick little basta....;-) I like smart ideas...

In case you only need the closing price of each bar you could build your own database by using streaming market data instead of using historical data bars. You split your list of 170 tickers into two groups, each group having less than 100 tickers. You wait until the clock is at a multiple of 5 minutes. Then you subscribe to streaming market data to all tickers in the first group. Wait until you have received the latest price for all tickers. Then unsubscribe from these tickers and subscribe to all tickers in the second group. Wait until you have received the data and unsubscribe. Now you wait until five minutes have passed and repeat the process. Streaming market data is not subject to the 10 minute rule, as far as I know.
More fancy solutions based on this principle are probably also possible.
 
Back
Top