Keyboard Shortcuts
Likes
Search
two questions about the 50 msg/sec rate limit
Regarding the 50 msg/sec TWS rate limitation, is IBKR checking it by calculating a continuously sliding window, or are they doing a nonoverlapping time window? The first is stricter.
?
If it's the second one, then theoretically you can send up to 100 messages in? a short burst. As long as the first fifty were near the end of the first window, and the next 50 were at the beginning of the next window.?
?
If this was an option, then there would be the challenge of trying to figure out where TWS' clock was. Does anyone know if the calculation is made in TWS before orders are sent out over the wire, or are the calculations made upon receipt at the data center? |
IIRC, the rate is calculated on a 5 sec interval: you can send a burst of 250 messages and then wait 5 seconds without incurring in a rate limit violation. This is consistent with my experience. However, it's been few years now that IB applies automatic pacing by default, so that you don't need to worry about this issue, i.e.: you'll never hit a rate limit violation with default settings. |
Before we start, a few disclaimers and initial thoughts:
With that said, here some observations from a few quick tests with one of my system test tools against stable TWS 10.30.1u. The tool makes a configurable number of reqContractDetails calls at the fastest possible pace and monitors and tallies the resulting responses and errors. In order to focus on the connection between the tool and TWS/IBGW, all requests are made for the same instrument. That makes it possible for TWS/IBGW to respond with a locally cached ContractDetails object and minimizes the need for communication between TWS/IBGW and the IBKR infrastructure. This is an artificial work load and you cannot expect that the results I present work for more complex tasks such as order placement. When the test tool (client) is configured to exceed the allowed rate significantly, TWS/IBGW send up to two "error #100 - Max rate of messages per second has been exceeded” and disconnects the client if the rate is still exceeded after the second error message. It takes approximately 500ms from the start of the test run for the first error and another 500ms for the second error, though times differ between runs considerably. In my setup and with a sequence of reqContractDetails calls for the same instrument, a rapid fire of 750 requests causes two error messages but no disconnect, while a run with 1,000 requests causes disconnects. Below a couple charts that show the timing of requests and responses for seven runs. This was not a controlled experiment just a few runs on two different client computers (one co-located with TWS in the same Linux instance in the cloud and one running remotely in my development environment with Wi-Fi, cable modem, competing with other traffic, ssh tunnel, ..) and during different ?times over the weekend (more quiet times earlier on Sunday as well as runs after 17:00 US/Central when futures were trading in Chicago already). Here some highlights:
Again, don’t expect that you can extend this very artificial benchmark to any serious and meaningful work load. 闯ü谤驳别苍 ?
?
?
On Sun, Mar 2, 2025 at 09:21 AM, <tbrown122387@...> wrote:
|
To disable auto pacing, don't send "+PACEAPI" during client connection AND select the option "Reject messages above maximum allowed message rate vs applying pacing" in the global API configuration in TWS or IBGW.
?
?
?
On Tue, Mar 4, 2025 at 02:00 PM, <tbrown122387@...> wrote:
|