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:
parent
85252bc462
commit
d93913b828
@ -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
|
# Check if time matches and current rate is above threshold
|
||||||
time_diff = (current_time - trade.open_date).total_seconds() / 60
|
time_diff = (current_time - trade.open_date).total_seconds() / 60
|
||||||
for duration, threshold in sorted(strategy.minimal_roi.items()):
|
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
|
return True
|
||||||
|
|
||||||
logger.debug('Threshold not reached. (cur_profit: %1.2f%%)', float(current_profit) * 100.0)
|
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(
|
pairs = sorted(
|
||||||
(s['symbol'] for s in exchange.get_markets() if s['quote'] == base_currency),
|
[s['symbol'] for s in exchange.get_markets() if s['quote'] == base_currency],
|
||||||
key=lambda s: s.get(key) or 0.0,
|
|
||||||
reverse=True
|
reverse=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user