Skip to content

Commit

Permalink
Guarantee exit date symbol exists in DataFrame.
Browse files Browse the repository at this point in the history
  • Loading branch information
edtechre committed Mar 17, 2023
1 parent 6902781 commit e589f1c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pybroker/strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e589f1c

Please sign in to comment.