From cb4889398be8e3f2e9c3cd4afa80900313412faf Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 25 Aug 2021 07:03:48 +0200 Subject: [PATCH] Fix backtesting bug --- freqtrade/optimize/backtesting.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 3bd7f178c..0ebb36b7c 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -233,9 +233,12 @@ class Backtesting: if not pair_data.empty: # Cleanup from prior runs - pair_data.loc[:, 'enter_long'] = 0 + # TODO-lev: The below is not 100% compatible with the interface compatibility layer + if 'enter_long' in pair_data.columns: + pair_data.loc[:, 'enter_long'] = 0 pair_data.loc[:, 'enter_short'] = 0 - pair_data.loc[:, 'exit_long'] = 0 + if 'exit_long' in pair_data.columns: + pair_data.loc[:, 'exit_long'] = 0 pair_data.loc[:, 'exit_short'] = 0 pair_data.loc[:, 'long_tag'] = None pair_data.loc[:, 'short_tag'] = None