From 8c93760a6dda1eecdb4ec4276dea5cc04106eec2 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 30 Oct 2018 20:23:31 +0100 Subject: [PATCH] simplify some code --- freqtrade/optimize/backtesting.py | 2 +- freqtrade/strategy/interface.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index b5c883d4f..1f02b9793 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -217,7 +217,7 @@ class Backtesting(object): elif sell.sell_type == (SellType.ROI): # get entry in min_roi >= to trade duration roi_entry = max(list(filter(lambda x: trade_dur >= x, - list(self.strategy.minimal_roi.keys())))) + self.strategy.minimal_roi.keys()))) # set close-rate to min-roi closerate = trade.open_rate + trade.open_rate * \ self.strategy.minimal_roi[roi_entry] diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 710a4e8f1..27da6147c 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -210,14 +210,14 @@ class IStrategy(ABC): :return: True if trade should be sold, False otherwise """ # Set current rate to low for backtesting sell - current_rate = rate if not low else low + current_rate = low or rate current_profit = trade.calc_profit_percent(current_rate) stoplossflag = self.stop_loss_reached(current_rate=current_rate, trade=trade, current_time=date, current_profit=current_profit) if stoplossflag.sell_flag: return stoplossflag # Set current rate to low for backtesting sell - current_rate = rate if not high else high + current_rate = high or rate current_profit = trade.calc_profit_percent(current_rate) experimental = self.config.get('experimental', {})