Alpaca Data Bundle¶
How To Use It¶
zipline ingest -b alpaca_api
The bundle is defined in this file:
zipline/data/bundles/alpaca_api.py
There is a method called
initialize_client()
, it relies on the fact that you define your alpaca credentials in a file calledalpaca.yaml
in your root directory. it should look like this:key_id: "<YOUR-KEY>" secret: "<YOUR-SECRET>" base_url: https://paper-api.alpaca.markets
you need to define your zipline root in an environment variable (This is where the ingested data will be stored). It should be something like this:
ZIPLINE_ROOT=~/.zipline
It means you could basically put it anywhere you want as long as you always use that as your zipline root.It also means that different bundles could have different locations.By defauilt the bundle ingests 30 days backwards, but you can change that under the
__main__
section ofzipline/data/bundles/alpaca_api.py
.
Notes¶
You are ready to research, backtest or paper trade using the pipeline functionality.
You should repeat this process daily since every day you will have new price data.
This data doesn’t include Fundamental data, only price data so we’ll need to handle it separately.