Rate limit exceeded when downloading options data

Hello, I'm trying to download options chains following the usage guide and I'm getting a 100 error from IB.

I was under the impression quantrocket would back off but it seems to continue to make requests. Is there a known workaround?

`quantrocket master collect --exchanges 'NASDAQ' --sec-types 'STK' --symbols 'GOOG' 'FB' 'AAPL'
quantrocket master get -e 'NASDAQ' -t 'STK' -s 'GOOG' 'FB' 'AAPL' | quantrocket master options --infile -

2019-02-09 03:24:32 quantrocket.master: WARNING Disconnecting from gateways to force reconnect after DisconnectedGateway('ibg1 is no longer connected',) (retry 5 of 5) 2019-02-09 03:25:10 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=56 (1) 2019-02-09 03:25:29 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=55 (2) 2019-02-09 03:25:39 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=54 (3) 2019-02-09 03:25:59 quantrocket.master: ERROR Traceback (most recent call last): 2019-02-09 03:25:59 quantrocket.master: ERROR File "sym://qrocket_log_py", line 34, in wrapped 2019-02-09 03:25:59 quantrocket.master: ERROR File "sym://qrocket_mule_py", line 89, in mule_collect_option_chains 2019-02-09 03:25:59 quantrocket.master: ERROR File "sym://qrocket_master_collect_options_py", line 88, in collect 2019-02-09 03:25:59 quantrocket.master: ERROR File "sym://qrocket_interactivebrokers_gateway_py", line 369, in wrapped_function 2019-02-09 03:25:59 quantrocket.master: ERROR File "sym://qrocket_master_collect_base_py", line 88, in request_contract_details 2019-02-09 03:25:59 quantrocket.master: ERROR qrocket.interactivebrokers.exceptions.DisconnectedGateway: ibg1 is no longer connected 2019-02-09 03:25:59 quantrocket.master: ERROR

Is this error repeatable? Your timestamps are during IB's weekly Friday night server reset, during which the IB API tends to go bonkers.

It does seem to be repeatable outside of that time window.

Here's that same query a moment ago:

2019-02-11 21:11:16 quantrocket.master: INFO Requesting option strike prices and expiries for conids 265598, 107113386, 208813720
2019-02-11 21:11:17 quantrocket.master: INFO Requesting option contract details for 13426 possible combinations of strike price and expiry for conids 265598, 107113386, 208813720
2019-02-11 21:12:17 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=51 (1)
2019-02-11 21:12:40 quantrocket.master: INFO Expected remaining runtime to collect listings: 0:25:45
2019-02-11 21:12:53 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=55 (2)
2019-02-11 21:13:02 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=57 (3)
2019-02-11 21:13:32 quantrocket.master: WARNING Disconnecting from gateways to force reconnect after DisconnectedGateway('ibg1 is no longer connected',) (retry 1 of 5)
2019-02-11 21:14:40 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=57 (1)
2019-02-11 21:14:49 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=56 (2)
2019-02-11 21:14:59 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=56 (3)
2019-02-11 21:15:29 quantrocket.master: WARNING Disconnecting from gateways to force reconnect after DisconnectedGateway('ibg1 is no longer connected',) (retry 2 of 5)
2019-02-11 21:15:40 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=58 (1)
2019-02-11 21:15:50 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=56 (2)
2019-02-11 21:15:59 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=59 (3)
2019-02-11 21:16:29 quantrocket.master: WARNING Disconnecting from gateways to force reconnect after DisconnectedGateway('ibg1 is no longer connected',) (retry 3 of 5)
2019-02-11 21:16:41 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=57 (1)
2019-02-11 21:16:50 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=55 (2)
2019-02-11 21:17:00 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=53 (3)
2019-02-11 21:17:30 quantrocket.master: WARNING Disconnecting from gateways to force reconnect after DisconnectedGateway('ibg1 is no longer connected',) (retry 4 of 5)
2019-02-11 21:17:42 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=59 (1)
2019-02-11 21:17:51 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=57 (2)
2019-02-11 21:18:46 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=56 (3)
2019-02-11 21:19:16 quantrocket.master: WARNING Disconnecting from gateways to force reconnect after DisconnectedGateway('ibg1 is no longer connected',) (retry 5 of 5)
2019-02-11 21:20:03 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=59 (1)
2019-02-11 21:20:13 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=55 (2)
2019-02-11 21:22:39 quantrocket.master: WARNING ibg1 client 2031 got IB error code 100: Max rate of messages per second has been exceeded:max=50 rec=53 (3)
2019-02-11 21:23:09 quantrocket.master: ERROR Traceback (most recent call last):
2019-02-11 21:23:09 quantrocket.master: ERROR File "sym://qrocket_log_py", line 34, in wrapped
2019-02-11 21:23:09 quantrocket.master: ERROR File "sym://qrocket_mule_py", line 92, in mule_collect_option_chains
2019-02-11 21:23:09 quantrocket.master: ERROR File "sym://qrocket_master_collect_options_py", line 88, in collect
2019-02-11 21:23:09 quantrocket.master: ERROR File "sym://qrocket_interactivebrokers_gateway_py", line 371, in wrapped_function
2019-02-11 21:23:09 quantrocket.master: ERROR File "sym://qrocket_master_collect_base_py", line 89, in request_contract_details
2019-02-11 21:23:09 quantrocket.master: ERROR qrocket.interactivebrokers.exceptions.DisconnectedGateway: ibg1 is no longer connected
2019-02-11 21:23:09 quantrocket.master: ERROR

Is there any additional information I can provide?

What version of quantrocket/master are you running? (docker ps to check)

quantrocket/master:1.5.0

The master service waits for each response from IB before sending the next request, which is usually more than sufficient to avoid triggering rate limit errors. My assumption is that your responses from IB are coming back faster for whatever reason.

We'll add some throttling around this in the next patch release.

We added throttling in Quantrocket 1.5.1 which should hopefully address this issue.

Thank you very much, I was able to download the options chains with this fix.