diff --git a/freqtrade/plugins/pairlist/PriceFilter.py b/freqtrade/plugins/pairlist/PriceFilter.py index f007c52d2..da41e9239 100644 --- a/freqtrade/plugins/pairlist/PriceFilter.py +++ b/freqtrade/plugins/pairlist/PriceFilter.py @@ -77,11 +77,13 @@ class PriceFilter(IPairList): "ticker['last'] is empty (Usually no trade in the last 24h).", logger.info) return False + else: + price: float = ticker['last'] # Perform low_price_ratio check. if self._low_price_ratio != 0: - compare = self._exchange.price_get_one_pip(pair, ticker['last']) - changeperc = compare / ticker['last'] + compare = self._exchange.price_get_one_pip(pair, price) + changeperc = compare / price if changeperc > self._low_price_ratio: self.log_once(f"Removed {pair} from whitelist, " f"because 1 unit is {changeperc:.3%}", logger.info) @@ -89,7 +91,6 @@ class PriceFilter(IPairList): # Perform low_amount check if self._max_value != 0: - price = ticker['last'] market = self._exchange.markets[pair] limits = market['limits'] if (limits['amount']['min'] is not None): @@ -114,14 +115,14 @@ class PriceFilter(IPairList): # Perform min_price check. if self._min_price != 0: - if ticker['last'] < self._min_price: + if price < self._min_price: self.log_once(f"Removed {pair} from whitelist, " f"because last price < {self._min_price:.8f}", logger.info) return False # Perform max_price check. if self._max_price != 0: - if ticker['last'] > self._max_price: + if price > self._max_price: self.log_once(f"Removed {pair} from whitelist, " f"because last price > {self._max_price:.8f}", logger.info) return False