simplify some code

This commit is contained in:
Matthias 2018-10-30 20:23:31 +01:00
parent fe2c158e59
commit 8c93760a6d
2 changed files with 3 additions and 3 deletions

View File

@ -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]

View File

@ -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', {})