I moechte gerne meine manuellen Tradingstrategien automatisieren mit Zipline. Um mich einzuarbeiten in Zipline habe ich das auf der Webseite zur Verfuegung stehende Beispiel uebernommen und wollte es mittels run_algorithm() starten. Da habe ich nun eine Fehlermeldung bekommen. Ich habe es auch ueber Terminal und IPython versucht. Da kam der gleiche Fehler.
Ich nutze Python 3.6 auf MAC OSX und Zipline 1.1.1
Das ist der Code:
Code: Alles auswählen
import zipline as zl
from zipline.api import order, record, symbol
def initialize(context): pass
def handle_data(context, data): order(symbol('AAPL'), 10) record(AAPL=data.current(symbol('AAPL'), 'price'))
zl.run_algorithm(start=2015-1-1, end=2017-1-1, initialize=initialize, capital_base=10000)
Traceback (most recent call last): File "/Users/SOL/Desktop/Python/backtest.py", line 13, in zl.run_algorithm(start=2015-1-1, end=2017-1-1, initialize=initialize, capital_base=10000) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zipline/utils/run_algo.py", line 360, in run_algorithm environ=environ, File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zipline/utils/run_algo.py", line 132, in _run env = TradingEnvironment(asset_db_path=connstr, environ=environ) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zipline/finance/trading.py", line 99, in init self.bm_symbol, File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zipline/data/loader.py", line 173, in load_market_data environ, File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zipline/data/loader.py", line 287, in ensure_treasury_data if not has_data_for_dates(data, first_date, last_date): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zipline/data/loader.py", line 87, in has_data_for_dates dts = series_or_df.index AttributeError: 'NoneType' object has no attribute 'index'