Fix race condition in checking should_sell when no time has passed

between buy and sell order. Only affects tests.
This commit is contained in:
enenn 2018-02-04 10:40:39 +01:00
parent 85252bc462
commit d93913b828

View File

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