from pandas import Timestamp
from zipline import run_algorithm
from zipline.api import order, symbol
def initialize(context):
print("hello world")
def handle_data(context, data):
order(symbol('AAPL'), 1)
results = run_algorithm(
Timestamp('2013', tz='UTC'),
Timestamp('2015', tz='UTC'),
capital_base=10000,
initialize=initialize,
handle_data=handle_data,
bundle='quantopian-quandl',
data_frequency='minute'
)
--
You received this message because you are subscribed to the Google Groups "Zipline Python Opensource Backtester" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zipline+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to zipline+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--BR,
Ed
To unsubscribe from this group and stop receiving emails from it, send an email to zipline+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to zipline+unsubscribe@googlegroups.com.
Here's another example along the lines of Ed's :
http://quant.prokopyshen.com/Use-minute-bar-data-in-zipline-custom-data-bundle
$ find ./csvdir
./csvdir
./csvdir/daily/
./csvdir/daily/AAL.csv
./csvdir/daily/AAPL.csv
./csvdir/daily/ABBV.csv
./csvdir/daily/ABT.csv
./csvdir/daily/ACN.csv
./csvdir/daily/ADI.csv
./csvdir/daily/AVGO.csv
./csvdir/minute
./csvdir/minute/AAL.csv
./csvdir/minute/AAPL.csv
./csvdir/minute/ABBV.csv
./csvdir/minute/ABT.csv
./csvdir/minute/ACN.csv
./csvdir/minute/ADI.csv
./csvdir/minute/AVGO.csv
...
csv files are expected to have this header: date,open,high,low,close,volume
btw, if you don't have daily data it's quite easy to prepare by downsampling minute data using pandas resample API.
2. put these lines into ~/.zipline/extension.py:
from zipline.data.bundles import register, csvdir_equities
register('csvdir', csvdir_equities(['daily', 'minute']))
3. Ingest your data using csvdir bundle:
CSVDIR=./csvdir/ zipline ingest -b csvdir
4. run your algo:
zipline run -b csvdir -f <path to your algo> -s <start date> -e <end date> --data-frequency minute
I hope it helps,
Regards,
Ed
To unsubscribe from this group and stop receiving emails from it, send an email to zipline+unsubscribe@googlegroups.com.
date,open,high,low,close,volume
2014-09-30 00:00:00,379.02,379.02,379.02,379.02,3.35
2014-09-30 00:01:00,378.59,378.59,378.59,378.59,8.24
2014-09-30 00:02:00,378.6,378.6,378.57,378.57,1.77
2014-09-30 00:03:00,378.6,378.6,378.6,378.6,9.5
2014-09-30 00:04:00,378.39,378.39,378.39,378.39,3.743
2014-09-30 00:05:00,378.37,378.37,378.37,378.37,7.217
2014-09-30 00:06:00,378.52,378.52,378.12,378.12,33.561
2014-09-30 00:07:00,378.14,378.14,378.14,378.14,2.68
To unsubscribe from this group and stop receiving emails from it, send an email to zipline+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TypeError: write() got an unexpected keyword argument 'symbols'