QuantRocket logo

Account Allocation

Before we can trade, we must allocate the strategy to one or more accounts. Open quantrocket.zipline.allocations.yml, edit the account number to match your live or paper brokerage account, and edit the capital base as desired.

Note: The capital base is mainly relevant for determining the number of shares to order when using order_target_percent(), which is not used in this strategy. However, a value must still must be set.

Then install the file by moving it into the /codeload directory (i.e. top level of the Jupyter file browser).

In [1]:
# move file over unless it already exists
![ -e /codeload/quantrocket.zipline.allocations.y*ml ] && echo 'oops, the file already exists!' || mv quantrocket.zipline.allocations.yml /codeload/

Scheduling

The last step is to schedule data to be collected and Zipline to run at the appropriate times. The commands to run are provided in quantrocket.countdown.crontab.sh. We collect updated data for the 1-minute US stock bundle each morning at 7:30 AM, and we start up the Zipline strategy at 9:29 AM.

All the commands on the provided crontab are intended to be run in New York time. By default, the countdown timezone is UTC:

In [2]:
from quantrocket.countdown import get_timezone, set_timezone
get_timezone()
Out[2]:
{'timezone': 'Etc/UTC'}

So first, set the countdown timezone to New York time:

In [3]:
from quantrocket.countdown import set_timezone
set_timezone("America/New_York")
Out[3]:
{'status': 'successfully set timezone to America/New_York'}

Install the crontab by moving it to the /codeload directory. (First open a flightlog terminal so you can see if it loads successfully.)

In [4]:
# move file over unless it already exists
![ -e /codeload/quantrocket.countdown.crontab* ] && echo 'oops, the file already exists!' || mv quantrocket.countdown.crontab.sh /codeload/

You should see a success message in flightlog:

quantrocket.countdown: INFO Successfully loaded quantrocket.countdown.crontab.sh