I have been trying to run the example on Zipline called momentum_pipeline.py
. It is just not running properly, I'm calling the following on terminal:
python -m zipline run -f momentum_pipeline.py --start 2000-1-1 --end 2014-1-1 --output pipeline.pickle
The output is an error on Terminal saying TypeError: a float is required.
This is the error log on the screenshot:
The error seems to relate to this line in the file:
File "momentum_pipeline.py", line 68, in before_trading_start
context.pipeline_data = pipeline_output('my_pipeline')
Not sure why it refers to a TypeError related to a float. That line should return a panda dataFrame. You can view the file on github here: https://github.com/quantopian/zipline/blob/master/zipline/examples/momentum_pipeline.py
How do I run this example successfully?
I think the date range I was using was too long (from 2000 - 2014) therefore some of the data was not available. I think Quantopian only has stock market data from 2002 only. If you change the date range to the ones found on the test_args, the example will work:
return {
# We run through october of 2013 because DELL is in the test data and
# it went private on 2013-10-29.
'start': pd.Timestamp('2013-10-07', tz='utc'),
'end': pd.Timestamp('2013-11-30', tz='utc'),
'capital_base': 100000,
}