To run the sample strategy we need 1-day bars for a single symbol. Any symbol will work, we will use AAPL. Create a database for free sample data (if it doesn't already exist):
from quantrocket.history import create_usstock_db
create_usstock_db("usstock-free-1d", bar_size="1 day", universe="FREE")
Then collect the data:
from quantrocket.history import collect_history
collect_history("usstock-free-1d")
Use flightlog to monitor the progress:
quantrocket.history: INFO [usstock-free-1d] Collecting FREE history from 2007 to present
quantrocket.history: INFO [usstock-free-1d] Collecting updated FREE securities listings
quantrocket.history: INFO [usstock-free-1d] Collecting additional FREE history from 2020-04 to present
quantrocket.history: INFO [usstock-free-1d] Collected 160 monthly files in quantrocket.v2.history.usstock-free-1d.sqlite
Next we look up the Sid for AAPL (using the CLI in this example):
!quantrocket master get --symbol 'AAPL' --json | json2yml
We'll use this Sid in our backtrader script.