From cd2bccd44198e29ade6932be23b6617dca4a5899 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 12 Jan 2019 13:45:43 +0100 Subject: [PATCH] Have backtest use the same logic to get the ROI entry --- freqtrade/optimize/backtesting.py | 2 +- freqtrade/tests/optimize/test_backtesting.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index e96a91856..80dc9a443 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -221,7 +221,7 @@ class Backtesting(object): elif sell.sell_type == (SellType.ROI): # get next entry in min_roi > to trade duration # Interface.py skips on trade_duration <= duration - roi_entry = max(list(filter(lambda x: trade_dur > x, + roi_entry = max(list(filter(lambda x: trade_dur >= x, self.strategy.minimal_roi.keys()))) roi = self.strategy.minimal_roi[roi_entry] diff --git a/freqtrade/tests/optimize/test_backtesting.py b/freqtrade/tests/optimize/test_backtesting.py index 6e0ab24a4..5ab44baad 100644 --- a/freqtrade/tests/optimize/test_backtesting.py +++ b/freqtrade/tests/optimize/test_backtesting.py @@ -530,10 +530,10 @@ def test_backtest(default_conf, fee, mocker) -> None: 'open_time': [Arrow(2018, 1, 29, 18, 40, 0).datetime, Arrow(2018, 1, 30, 3, 30, 0).datetime], 'close_time': [Arrow(2018, 1, 29, 22, 35, 0).datetime, - Arrow(2018, 1, 30, 4, 15, 0).datetime], + Arrow(2018, 1, 30, 4, 10, 0).datetime], 'open_index': [78, 184], - 'close_index': [125, 193], - 'trade_duration': [235, 45], + 'close_index': [125, 192], + 'trade_duration': [235, 40], 'open_at_end': [False, False], 'open_rate': [0.104445, 0.10302485], 'close_rate': [0.104969, 0.103541],