Reverse and fix rangestability conditions

closes #7447
This commit is contained in:
Matthias
2022-09-21 06:51:14 +02:00
parent 8f41f943b4
commit 02f2096fc3
2 changed files with 7 additions and 7 deletions

View File

@@ -100,23 +100,19 @@ class RangeStabilityFilter(IPairList):
if cached_res is not None:
return cached_res
result = False
result = True
if daily_candles is not None and not daily_candles.empty:
highest_high = daily_candles['high'].max()
lowest_low = daily_candles['low'].min()
pct_change = ((highest_high - lowest_low) / lowest_low) if lowest_low > 0 else 0
if pct_change >= self._min_rate_of_change:
result = True
else:
if pct_change < self._min_rate_of_change:
self.log_once(f"Removed {pair} from whitelist, because rate of change "
f"over {self._days} {plural(self._days, 'day')} is {pct_change:.3f}, "
f"which is below the threshold of {self._min_rate_of_change}.",
logger.info)
result = False
if self._max_rate_of_change:
if pct_change <= self._max_rate_of_change:
result = True
else:
if pct_change > self._max_rate_of_change:
self.log_once(
f"Removed {pair} from whitelist, because rate of change "
f"over {self._days} {plural(self._days, 'day')} is {pct_change:.3f}, "