Interactive Brokers Listings

I'm attempting to download IBKR Listings and running into problems. I was unable to locate "regions" for North_America (I searched the Tech Support History but north_america did not work). I ran the following:

from quantrocket.master import list_ibkr_exchanges
list_ibkr_exchanges(regions=[], sec_types=["STK", "ETF", "FUT", "CASH", "IND"])

And received the following error:

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
Cell In[10], line 2
      1 from quantrocket.master import list_ibkr_exchanges
----> 2 list_ibkr_exchanges(regions=[], sec_types=["STK", "ETF", "FUT", "CASH", "IND"])

File /opt/conda/lib/python3.11/site-packages/quantrocket/master.py:174, in list_ibkr_exchanges(regions, sec_types)
    171     params["regions"] = regions
    173 response = houston.get("/master/exchanges/ibkr", params=params, timeout=180)
--> 174 houston.raise_for_status_with_json(response)
    175 return response.json()

File /opt/conda/lib/python3.11/site-packages/quantrocket/houston.py:225, in Houston.raise_for_status_with_json(response)
    223     e.json_response = {}
    224     e.args = e.args + ("please check the logs for more details",)
--> 225 raise e

File /opt/conda/lib/python3.11/site-packages/quantrocket/houston.py:217, in Houston.raise_for_status_with_json(response)
    212 """
    213 Raises 400/500 error codes, attaching a json response to the
    214 exception, if possible.
    215 """
    216 try:
--> 217     response.raise_for_status()
    218 except requests.exceptions.HTTPError as e:
    219     try:

File /opt/conda/lib/python3.11/site-packages/requests/models.py:1021, in Response.raise_for_status(self)
   1016     http_error_msg = (
   1017         f"{self.status_code} Server Error: {reason} for url: {self.url}"
   1018     )
   1020 if http_error_msg:
-> 1021     raise HTTPError(http_error_msg, response=self)

HTTPError: ('500 Server Error: Internal Server Error for url: http://houston/master/exchanges/ibkr?sec_types=STK&sec_types=ETF&sec_types=FUT&sec_types=CASH&sec_types=IND', {'status': 'error', 'msg': 'an unhandled exception occurred, please check flightlog for the traceback', 'error': '404 Client Error: Not Found for url: https://www.interactivebrokers.com/IBSales/servlet/exchange?apiPath=getAllExchanges'})

The Flightlog provided the following:

jupyter:/codeload $ quantrocket flightlog stream
2024-07-11 20:51:26 quantrocket.master: INFO Pausing 10 seconds before retrying after timeout: https://www.interactivebrokers.com/IBSales/servlet/exchange?apiPath=getAllExchanges
2024-07-11 20:51:37 quantrocket.master: INFO Pausing 20 seconds before retrying after timeout: https://www.interactivebrokers.com/IBSales/servlet/exchange?apiPath=getAllExchanges
2024-07-11 20:51:57 quantrocket.master: INFO Pausing 40 seconds before retrying after timeout: https://www.interactivebrokers.com/IBSales/servlet/exchange?apiPath=getAllExchanges
2024-07-11 20:52:37 quantrocket.master: INFO Pausing 80 seconds before retrying after timeout: https://www.interactivebrokers.com/IBSales/servlet/exchange?apiPath=getAllExchanges
2024-07-11 20:53:57 quantrocket.master: ERROR Traceback (most recent call last):
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG Resetting dropped connection: houston
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR   File "sym://qrocket_wsgi_py", line 64, in app
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask/app.py", line 2213, in __call__
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR     return self.wsgi_app(environ, start_response)
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask/app.py", line 2193, in wsgi_app
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR     response = self.handle_exception(e)
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR                ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask_restful/__init__.py", line 298, in error_router
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR     return original_handler(e)
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR            ^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask_restful/__init__.py", line 295, in error_router
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR     return self.handle_error(e)
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR            ^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:57 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask_restful/__init__.py", line 310, in handle_error
2024-07-11 20:53:57 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     _handle_flask_propagate_exceptions_config(current_app, e)
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     response = self.full_dispatch_request()
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     rv = self.handle_user_exception(e)
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask_restful/__init__.py", line 298, in error_router
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     return original_handler(e)
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR            ^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask_restful/__init__.py", line 295, in error_router
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     return self.handle_error(e)
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR            ^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask_restful/__init__.py", line 310, in handle_error
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     _handle_flask_propagate_exceptions_config(current_app, e)
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     rv = self.dispatch_request()
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR          ^^^^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask_restful/__init__.py", line 489, in wrapper
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     resp = resource(*args, **kwargs)
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR            ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask/views.py", line 109, in view
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     return current_app.ensure_sync(self.dispatch_request)(**kwargs)
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     resp = meth(*args, **kwargs)
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR            ^^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/webargs/core.py", line 649, in wrapper
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     return func(*args, **kwargs)
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR            ^^^^^^^^^^^^^^^^^^^^^
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "sym://qrocket_app_py", line 65, in get
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "sym://qrocket_master_ibkr_exchanges_py", line 99, in list_exchanges
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "sym://qrocket_master_ibkr_exchanges_py", line 66, in _list_exchanges
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "sym://qrocket_utils_web_py", line 17, in retry_url
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR   File "/opt/conda/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR     raise HTTPError(http_error_msg, response=self)
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://www.interactivebrokers.com/IBSales/servlet/exchange?apiPath=getAllExchanges
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21
2024-07-11 20:53:58 quantrocket.master: ERROR 
2024-07-11 20:53:58 urllib3.connectionpool: DEBUG http://houston:80 "GET /version HTTP/1.1" 200 21

Any guidance would be appreciated.

Thanks.

Please update to the latest version of QuantRocket to access the fix for this issue:

1 Like

That did the trick. Thank you.