Bug in moonshot when importing pyfinance module


i type quantrocket moonshot backtest "kkkkkk" in the terminal. Output below

msg: 'strategy kkkkk does not exist, registered strategies are: dma-etf, dma, dma-tech,
hml, sfb-lrg, qmom, trend-day, umd, umd-demo'
status: error

I then add the following row to line 14 in the “dual_moving_average.py” file
from pyfinance import ols

and again run quantrocket moonshot backtest "kkkkkk" . I then get this output.

msg: 'strategy kkkkk does not exist, registered strategies are: hml, sfb-lrg, qmom,
trend-day, umd, umd-demo'
status: error

So somehow importing pyfinance makes moonshot unable to find my strategy.


pyfinance isn’t installed by default, you would need to install it yourself. Flightlog is likely displaying an ImportError when you try to run the backtest.

To install a package in Moonshot, you need to enter the container and install it. (Installing packages on the satellite service, if you did so, doesn’t install the package in Moonshot).


Thanks for the reply. I installed pyfinance from the terminal in jupyterlab. That seems to make It available in notebooks but not in moonshot then. What service does a package end up in when I install like this?

Also Is there somewhere I can read about what the satellite service does?


I go in my quant rocket dir and run docker-compose exec moonshot bash and get the following.

ERROR: No container found for moonshot_1

Any suggestions?

Edit, I ran docker-compose up -d --force-recreate moonshot and after that I could go into bash in the service. I installed pyfinance and restarted the moonshot service with docker-compose restart moonshot. I can go into the moonshot service and run python and confirm that pyfinance is installed there. However if I try to run QuantRocket from jupyterlab it sill cannot find pyfinance.

2019-05-03 17:41:37 quantrocket.moonshot: ERROR Unable to import /codeload/moonshot/dual_moving_average.py due to error: No module named 'pyfinance'

I think the issue is that I somehow get two moonshot containers goin on at the same time and in jupyterlab I use the old one.

Below is output of docker ps

Edit 2, I found and followed this Error on running moonshot backtest: FileNotFoundError: [Errno 2] No such file or directory: ‘/codeload/moonshot/__init__.py’

I think it works now.