diff --git a/src/pybroker/strategy.py b/src/pybroker/strategy.py index e50702a..c9b0f7f 100644 --- a/src/pybroker/strategy.py +++ b/src/pybroker/strategy.py @@ -1211,8 +1211,9 @@ def _run_walkforward( sym_dates = df[df[DataCol.SYMBOL.value] == sym][ DataCol.DATE.value ].values - sym_dates.sort() - exit_dates[sym] = sym_dates[-1] + if len(sym_dates): + sym_dates.sort() + exit_dates[sym] = sym_dates[-1] for train_idx, test_idx in self.walkforward_split( df=df, windows=windows,