From 61ea5be7cf3e57b830c2ea164564f7259feeb3e3 Mon Sep 17 00:00:00 2001 From: orehunt Date: Mon, 2 Nov 2020 14:35:10 +0100 Subject: [PATCH] pass the previous date, for stake_amount callback because signals are shifted by 1 --- freqtrade/optimize/backtesting.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index c51c9f87d..daf94d224 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -344,7 +344,8 @@ class Backtesting: and tmp != end_date and row[BUY_IDX] == 1 and row[SELL_IDX] != 1): # Enter trade - stake_amount = get_stake_amount(pair, row[DATE_IDX]) + prev_date = data[pair][indexes[pair] - 1][DATE_IDX] + stake_amount = get_stake_amount(pair, prev_date) trade = Trade( pair=pair, open_rate=row[OPEN_IDX],