Check for and default to 'None'

This commit is contained in:
sauces1313 2021-08-02 02:49:49 +00:00
parent 4675d85b90
commit 059c32b067

View File

@ -26,7 +26,7 @@ class RangeStabilityFilter(IPairList):
self._days = pairlistconfig.get('lookback_days', 10) self._days = pairlistconfig.get('lookback_days', 10)
self._min_rate_of_change = pairlistconfig.get('min_rate_of_change', 0.01) self._min_rate_of_change = pairlistconfig.get('min_rate_of_change', 0.01)
self._max_rate_of_change = pairlistconfig.get('max_rate_of_change', 0.99) self._max_rate_of_change = pairlistconfig.get('max_rate_of_change', None)
self._refresh_period = pairlistconfig.get('refresh_period', 1440) self._refresh_period = pairlistconfig.get('refresh_period', 1440)
self._pair_cache: TTLCache = TTLCache(maxsize=1000, ttl=self._refresh_period) self._pair_cache: TTLCache = TTLCache(maxsize=1000, ttl=self._refresh_period)
@ -106,14 +106,16 @@ class RangeStabilityFilter(IPairList):
f"which is below the threshold of {self._min_rate_of_change}.", f"which is below the threshold of {self._min_rate_of_change}.",
logger.info) logger.info)
result = False result = False
if pct_change <= self._max_rate_of_change: if self._max_rate_of_change:
result = True if pct_change <= self._max_rate_of_change:
else: result = True
self.log_once(f"Removed {pair} from whitelist, because rate of change " else:
f"over {self._days} {plural(self._days, 'day')} is {pct_change:.3f}, " self.log_once(
f"which is above the threshold of {self._max_rate_of_change}.", f"Removed {pair} from whitelist, because rate of change "
logger.info) f"over {self._days} {plural(self._days, 'day')} is {pct_change:.3f}, "
result = False f"which is above the threshold of {self._max_rate_of_change}.",
logger.info)
result = False
self._pair_cache[pair] = result self._pair_cache[pair] = result
return result return result