I'm attempting to run the Moonshot Intro "Part 5 - Moonshot Backtest" notebook but I'm receiving the following MultiIndex Error.
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
Cell In[16], line 2
1 from quantrocket.moonshot import backtest
----> 2 backtest("umd-demo", start_date="2019-01-01", end_date="2020-01-01", filepath_or_buffer="umd_moonshot_results.csv")
File /opt/conda/lib/python3.11/site-packages/quantrocket/moonshot.py:190, in backtest(strategies, start_date, end_date, segment, allocations, nlv, params, details, output, filepath_or_buffer, no_cache)
185 _params["no_cache"] = no_cache
187 response = houston.post("/moonshot/backtests.{0}".format(output),
188 params=_params, timeout=60*60*24)
--> 190 houston.raise_for_status_with_json(response)
192 filepath_or_buffer = filepath_or_buffer or sys.stdout
193 write_response_to_filepath_or_buffer(filepath_or_buffer, response)
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: ('400 Client Error: BAD REQUEST for url: http://houston/moonshot/backtests.csv?strategies=umd-demo&start_date=2019-01-01&end_date=2020-01-01', {'status': 'error', 'msg': "Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'MultiIndex' (see detailed logs for full traceback)"})
The only change I made in the Code Library Example "umd.py" file is the Database and Universe.
class UpMinusDownDemo(UpMinusDown):
CODE = "umd-demo"
DB = "usstock-1min"
UNIVERSES = "nq100cal"
TOP_N_PCT = 50
COMMISSION_CLASS = USStockCommission
The DB is a Zipline Bundle which I see from other case notes previously created problems with MultiIndex Errors when using Moonshot but I understand that was corrected with the QuantRocket 2.6 release.
Any guidance would be appreciated.
Thanks.