From d93913b8282cbf34d57b179cddc9b8c7b10bad7c Mon Sep 17 00:00:00 2001 From: enenn Date: Sun, 4 Feb 2018 10:40:39 +0100 Subject: [PATCH] Fix race condition in checking should_sell when no time has passed between buy and sell order. Only affects tests. --- freqtrade/main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/freqtrade/main.py b/freqtrade/main.py index 3994eaee4..91336bcbb 100755 --- a/freqtrade/main.py +++ b/freqtrade/main.py @@ -303,7 +303,7 @@ def min_roi_reached(trade: Trade, current_rate: float, current_time: datetime) - # Check if time matches and current rate is above threshold time_diff = (current_time - trade.open_date).total_seconds() / 60 for duration, threshold in sorted(strategy.minimal_roi.items()): - if time_diff > float(duration) and current_profit > threshold: + if time_diff >= float(duration) and current_profit > threshold: return True logger.debug('Threshold not reached. (cur_profit: %1.2f%%)', float(current_profit) * 100.0) @@ -470,8 +470,7 @@ def gen_pair_whitelist(base_currency: str, key: str = 'BaseVolume') -> List[str] """ pairs = sorted( - (s['symbol'] for s in exchange.get_markets() if s['quote'] == base_currency), - key=lambda s: s.get(key) or 0.0, + [s['symbol'] for s in exchange.get_markets() if s['quote'] == base_currency], reverse=True )