I created a tick database:
>>> from quantrocket.realtime import create_ibkr_tick_db
>>> create_ibkr_tick_db("tick-db", sids=["FIBBG000BJF1Z8"], fields=["LastPrice", "BidPrice","AskPrice", "BidSize", "AskSize"])
{'status': 'successfully created tick database tick-db'}
Then collected the market data while the market is open:
>>> from quantrocket.realtime import collect_market_data
>>> collect_market_data("tick-db", snapshot=True, wait=True)
{'status': 'completed market data snapshot for tick-db'}
Trying to download the market data gives a NoRealTimeData error:
>>> from quantrocket.realtime import download_market_data_file
>>> download_market_data_file("tick-db", fields=["LastPrice","BidPrice","AskPrice"], filepath_or_buffer="tick_db.csv")
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
File /opt/conda/lib/python3.9/site-packages/quantrocket/realtime.py:836, in download_market_data_file(code, filepath_or_buffer, output, start_date, end_date, universes, sids, exclude_universes, exclude_sids, fields)
835 try:
--> 836 houston.raise_for_status_with_json(response)
837 except requests.HTTPError as e:
838 # Raise a dedicated exception
File /opt/conda/lib/python3.9/site-packages/quantrocket/houston.py:225, in Houston.raise_for_status_with_json(response)
224 e.args = e.args + ("please check the logs for more details",)
--> 225 raise e
File /opt/conda/lib/python3.9/site-packages/quantrocket/houston.py:217, in Houston.raise_for_status_with_json(response)
216 try:
--> 217 response.raise_for_status()
218 except requests.exceptions.HTTPError as e:
File /opt/conda/lib/python3.9/site-packages/requests/models.py:1021, in Response.raise_for_status(self)
1020 if http_error_msg:
-> 1021 raise HTTPError(http_error_msg, response=self)
HTTPError: ('400 Client Error: BAD REQUEST for url: http://houston/realtime/tick-db.csv?fields=LastPrice&fields=BidPrice&fields=AskPrice', {'status': 'error', 'msg': 'no market data matches the query parameters'})
During handling of the above exception, another exception occurred:
NoRealtimeData Traceback (most recent call last)
Input In [49], in <cell line: 3>()
1 import pandas as pd
2 from quantrocket.realtime import download_market_data_file
----> 3 download_market_data_file("tick-db", fields=["LastPrice","BidPrice","AskPrice"], filepath_or_buffer="tick_db.csv")
4 ticks = pd.read_csv("tick_db.csv", parse_dates=["Date"])
File /opt/conda/lib/python3.9/site-packages/quantrocket/realtime.py:840, in download_market_data_file(code, filepath_or_buffer, output, start_date, end_date, universes, sids, exclude_universes, exclude_sids, fields)
837 except requests.HTTPError as e:
838 # Raise a dedicated exception
839 if "no market data matches the query parameters" in repr(e).lower():
--> 840 raise NoRealtimeData(e)
841 raise
843 filepath_or_buffer = filepath_or_buffer or sys.stdout
NoRealtimeData: ('400 Client Error: BAD REQUEST for url: http://houston/realtime/tick-db.csv?fields=LastPrice&fields=BidPrice&fields=AskPrice', {'status': 'error', 'msg': 'no market data matches the query parameters'})
Any help on how to solve this?