Trend following strategy BUG
-
Hi!
Trend based strategy yields
ValueError Traceback (most recent call last) <ipython-input-8-2c74c3293472> in <module> 72 lookback_period=5 * 365, 73 start_date='2006-01-01', ---> 74 strategy=strategy 75 ) ~/book/qnt/backtester.py in backtest(competition_type, strategy, load_data, lookback_period, test_period, start_date, window, step, analyze, build_plots, collect_all_states) 86 log_info("Load data for cleanup...") 87 data = qndata.load_data_by_type(competition_type, assets=result.asset.values.tolist(), tail=60) ---> 88 result = qnout.clean(result, data) 89 result.name = competition_type 90 log_info("Write result...") ~/book/qnt/output.py in clean(output, data, kind, debug) 61 if single_day: 62 output = output.drop(ds.TIME, errors='ignore') ---> 63 output = xr.concat([output], pd.Index([data.coords[ds.TIME].values.max()], name=ds.TIME)) 64 else: 65 log_info("ffill if the current price is None...") /usr/local/lib/python3.7/site-packages/numpy/core/_methods.py in _amax(a, axis, out, keepdims, initial, where) 37 def _amax(a, axis=None, out=None, keepdims=False, 38 initial=_NoValue, where=True): ---> 39 return umr_maximum(a, axis, None, out, keepdims, initial, where) 40 41 def _amin(a, axis=None, out=None, keepdims=False, ValueError: zero-size array to reduction operation maximum which has no identity
-
@magenta-grimer trend following strategy created on 27 nov 2020
-
Hello.
I confirm this bug.
It is fixed now.
If you clone this template again, it will work ok.Thank you very much for your report.