Hi, I tried to do backtest in the research platform but it does not work.
To reproduce the problem, I changed "daily" to "minute" in the tutorial named "Tutorial (Advanced) - Backtesting with Zipline", and changed the body of function "initialize" and "handle_data" to "pass". The minute data was loaded correctly, however, when running "perf_manual = algo_obj.run(data.transpose(2,1,0))", it crashed.
--------------------------------------------------------------------------- IndexError Traceback (most recent call
last) in ()
13
14 # Run algorithm
---> 15 perf_manual = algo_obj.run(data.transpose(2,1,0))/home/qexec/src/qexec_repo/zipline/algorithm.pyc in run(self, source,
overwrite_sim_params, benchmark_return_source)
471 # perf dictionary
472 perfs = []
--> 473 for perf in self.gen:
474 perfs.append(perf)
475/home/qexec/src/qexec_repo/zipline/gens/tradesimulation.pyc in
transform(self, stream_in)
109 date,
110 snapshot,
--> 111 self.algo.instant_fill,
112 )
113 # Perf messages are only emitted if the snapshot contained/home/qexec/src/qexec_repo/zipline/gens/tradesimulation.pyc in
process_snapshot(self, dt, snapshot, instant_fill)
249
250 if any_trade_occurred:
--> 251 new_orders = self.call_handle_data()
252 for order in new_orders:
253 perf_process_order(order)/home/qexec/src/qexec_repo/zipline/gens/tradesimulation.pyc in
call_handle_data(self)
278 self.algo,
279 self.current_data,
--> 280 self.simulationdt,
281 )
282 orders = self.algo.blotter.new_orders/home/qexec/src/qexec_repo/zipline/utils/events.pyc in
handle_data(self, context, data, dt)
192 def handle_data(self, context, data, dt):
193 for event in self._events:
--> 194 event.handle_data(context, data, dt)
195
196/home/qexec/src/qexec_repo/zipline/utils/events.pyc in
handle_data(self, context, data, dt)
210 """
211 if self.rule.should_trigger(dt):
--> 212 self.callback(context, data)
213
214/home/qexec/src/qexec_repo/zipline/algorithm.pyc in handle_data(self,
data)
275 self.history_container.update(data, self.datetime)
276
--> 277 self._handle_data(self, data)
278
279 # Unlike trading controls which remain constant unless placing anin handle_data(context, data)
22 # history() has to be called with the same params
23 # from above and returns a pandas dataframe.
---> 24 short_mavg = history(100, '1d', 'price').mean()
25 long_mavg = history(300, '1d', 'price').mean()
26/home/qexec/src/qexec_repo/zipline/utils/api_support.pyc in
wrapped(args, **kwargs)
49 def wrapped(*args, **kwargs):
50 # Get the instance and call the method
---> 51 return getattr(get_algo_instance(), f.__name__)(args, **kwargs)
52 # Add functor to zipline.api
53 setattr(zipline.api, f.__name__, wrapped)/home/qexec/src/qexec_repo/zipline/algorithm.pyc in history(self,
bar_count, frequency, field, ffill) 1010 ffill, 1011
)
-> 1012 return self.history_container.get_history(history_spec, self.datetime)
1013 1014 ####################/home/qexec/src/qexec_repo/zipline/history/history_container.pyc in
get_history(self, history_spec, algo_dt)
916 digest_frame,
917 self.last_known_prior_values,
--> 918 raw=True
919 )
920 last_period = self.frame_to_series(field, buffer_frame, self.sids)/home/qexec/src/qexec_repo/zipline/history/history_container.pyc in
ffill_buffer_from_prior_values(freq, field, buffer_frame,
digest_frame, pv_frame, raw)
55 buffer_values = buffer_frame.values
56
---> 57 nan_sids = pd.isnull(buffer_values[0])
58 if np.any(nan_sids) and len(digest_values):
59 # If we have any leading nans in the buffer and we have a non-emptyIndexError: index 0 is out of bounds for axis 0 with size 0