QuantRocket

Part 3 Usage Guide problems - prices query failing


#1

Hi - I’m new at this apologies if question is a dumb one. I’m working through the guide, trying to get the hang of the data. I am at the interactive strategy development section on the code library, the python queries work using sharadar to get fundamentals. It fails when i try to query historical prices - specifically this query.

from quantrocket import get_prices

DB = “sharadar-1d”
UNIVERSES = “nyse-stk”
EXCLUDE_UNIVERSES = [“nyse-financials”, “nyse-reits”, “nyse-adrs”]

prices = get_prices(DB,
start_date=“2014-01-01”,
end_date=“2016-01-01”,
universes=UNIVERSES,
exclude_universes=EXCLUDE_UNIVERSES,
fields=[“Close”, “Volume”])
prices.tail()

I get the following error message.


HTTPError Traceback (most recent call last)
in ()
10 universes=UNIVERSES,
11 exclude_universes=EXCLUDE_UNIVERSES,
—> 12 fields=[“Close”, “Volume”])
13 prices.tail()

/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)
184 # separate history dbs from realtime dbs
185 history_dbs = set(list_history_databases())
–> 186 realtime_dbs = list_realtime_databases()
187 realtime_agg_dbs = set(itertools.chain(*realtime_dbs.values()))
188

/opt/conda/lib/python3.6/site-packages/quantrocket/realtime.py in list_databases()
239 “”"
240 response = houston.get("/realtime/databases")
–> 241 houston.raise_for_status_with_json(response)
242 return response.json()
243

/opt/conda/lib/python3.6/site-packages/quantrocket/houston.py in raise_for_status_with_json(response)
204 e.json_response = {}
205 e.args = e.args + (“please check the logs for more details”,)
–> 206 raise e
207
208 # Instantiate houston so that all callers can share a TCP connection (for

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

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

HTTPError: (‘500 Server Error: Internal Server Error for url: http://houston/realtime/databases’, {‘status’: ‘error’, ‘msg’: ‘an unhandled exception occurred, please check flightlog for the traceback and notify support if the problem persists as this might be a bug’, ‘error’: ‘(psycopg2.OperationalError) FATAL: database “_quantrocket_realtime_meta” does not exist\n (Background on this error at: http://sqlalche.me/e/e3q8)’})

Any help much appreciated. I have kicked off the downloads i think, i managed to get the security filters all working in the stages before that, but falls over here. Any help greatly appreciated.
Thanks


#2

The missing database should be created when the realtime service starts up and it appears that didn’t happen. The first thing to try would be to relaunch that service:

docker-compose up -d --force-recreate realtime

Please open the detailed logs first and check for any tracebacks when the service is coming up. Then try the query again.

I’m assuming this is a fresh installation.


#3

Hi Brian, Thanks for the reply! yes i did it yesterday, and i’m not great at all the behind the scenes database/install stuff by any means. Thanks - i will try and revert. Appreciated.


#4

Hi Brian, where abouts do i put that command? I tried it in the terminal window and got the following?
jupyter:/codeload $ docker-compose up -d --force-recreate realtime
bash: docker-compose: command not found

i tried it in windows powershell and got his message:
ERROR:
Can’t find a suitable configuration file in this directory or any
parent. Are you in the right directory?

    Supported filenames: docker-compose.yml, docker-compose.yaml

i also tried it in the jupyter .ipynb and got this:
!docker-compose up -d --force-recreate realtime

/bin/sh: 1: docker-compose: not found

I must be doing something wrong! thanks in advance for your help.


#5

In powershell, in the directory where your docker-compose.yml is located. Probably:

cd ~/quantrocket
docker-compose up -d --force-recreate realtime

#6

This is great - thank you so much