QuantRocket

Unable to load historical bar sizes for 1 sec


#1

I’m trying to download the historical intraday data for ConId = 102558681 and when I try to collect data with barsize of 1seconds, I get an error. The code works fine with bar sizes>=15 mins, but doesnt work for frequencies below 15 mins. Is the data missing?

create_db(“shortlist-1m”, universes=[“shortlist”], bar_size=“1 secs”,start_date=“2020-02-01”,shard=‘off’)
{'status': 'successfully created quantrocket.history.shortlist-1m.sqlite'}

collect_history(“shortlist-1m”,start_date=“2020-02-01”)
{'status': 'the historical data will be collected asynchronously'}

get_prices(“shortlist-1m”, start_date=“2020-02-01”)

---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
/opt/conda/lib/python3.6/site-packages/quantrocket/history.py in download_history_file(code, filepath_or_buffer, output, start_date, end_date, universes, conids, exclude_universes, exclude_conids, times, cont_fut, fields, tz_naive)
559     try:
--> 560         houston.raise_for_status_with_json(response)
561     except requests.HTTPError as e:

/opt/conda/lib/python3.6/site-packages/quantrocket/houston.py in raise_for_status_with_json(response)
205                 e.args = e.args + ("please check the logs for more details",)
--> 206             raise e
207 

/opt/conda/lib/python3.6/site-packages/quantrocket/houston.py in raise_for_status_with_json(response)
197         try:
--> 198             response.raise_for_status()
199         except requests.exceptions.HTTPError as e:

/opt/conda/lib/python3.6/site-packages/requests/models.py in raise_for_status(self)
934         if http_error_msg:
--> 935             raise HTTPError(http_error_msg, response=self)
936 

HTTPError: ('400 Client Error: BAD REQUEST for url: http://houston/history/shortlist-1m.csv?start_date=2020-02-01', {'status': 'error', 'msg': 'no history matches the query parameters'})

During handling of the above exception, another exception occurred:

NoHistoricalData                          Traceback (most recent call last)
<ipython-input-372-0fcfd278f39e> in <module>()
----> 1 shortlist_intdy = get_prices("shortlist-1m", start_date="2020-02-01")

/opt/conda/lib/python3.6/site-packages/quantrocket/price.py in get_prices(codes, start_date, end_date, universes, conids, exclude_universes, exclude_conids, times, fields, timezone, infer_timezone, cont_fut, master_fields)
279 
280             try:
--> 281                 download_history_file(db, tmp_filepath, **kwargs)
282             except NoHistoricalData as e:
283                 # don't complain about NoHistoricalData if we're checking

/opt/conda/lib/python3.6/site-packages/quantrocket/history.py in download_history_file(code, filepath_or_buffer, output, start_date, end_date, universes, conids, exclude_universes, exclude_conids, times, cont_fut, fields, tz_naive)
562         # Raise a dedicated exception
563         if "no history matches the query parameters" in repr(e).lower():
--> 564             raise NoHistoricalData(e)
565         raise
566 

NoHistoricalData: ('400 Client Error: BAD REQUEST for url: http://houston/history/shortlist-1m.csv?start_date=2020-02-01', {'status': 'error', 'msg': 'no history matches the query parameters'})

#2

The traceback is simply telling you there is no data in the database when you query it. To figure out why, you need to inspect the detailed logs while running collect_history.