mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 18:23:55 +00:00
Introduce self._enabled in pairlist handlers
This commit is contained in:
parent
7e43574382
commit
4f0d928145
|
@ -26,6 +26,8 @@ class IPairList(ABC):
|
|||
:param pairlistconfig: Configuration for this Pairlist Handler - can be empty.
|
||||
:param pairlist_pos: Position of the Pairlist Handler in the chain
|
||||
"""
|
||||
self._enabled = True
|
||||
|
||||
self._exchange = exchange
|
||||
self._pairlistmanager = pairlistmanager
|
||||
self._config = config
|
||||
|
@ -103,11 +105,12 @@ class IPairList(ABC):
|
|||
:param tickers: Tickers (from exchange.get_tickers()). May be cached.
|
||||
:return: new whitelist
|
||||
"""
|
||||
# Copy list since we're modifying this list
|
||||
for p in deepcopy(pairlist):
|
||||
# Filter out assets
|
||||
if not self._validate_pair(tickers[p]):
|
||||
pairlist.remove(p)
|
||||
if self._enabled:
|
||||
# Copy list since we're modifying this list
|
||||
for p in deepcopy(pairlist):
|
||||
# Filter out assets
|
||||
if not self._validate_pair(tickers[p]):
|
||||
pairlist.remove(p)
|
||||
|
||||
return pairlist
|
||||
|
||||
|
|
|
@ -17,8 +17,11 @@ class PrecisionFilter(IPairList):
|
|||
pairlist_pos: int) -> None:
|
||||
super().__init__(exchange, pairlistmanager, config, pairlistconfig, pairlist_pos)
|
||||
|
||||
self._stoploss = self._config['stoploss']
|
||||
self._enabled = self._stoploss != 0
|
||||
|
||||
# Precalculate sanitized stoploss value to avoid recalculation for every pair
|
||||
self._stoploss = 1 - abs(self._config['stoploss'])
|
||||
self._stoploss = 1 - abs(self._stoploss)
|
||||
|
||||
@property
|
||||
def needstickers(self) -> bool:
|
||||
|
|
|
@ -18,6 +18,7 @@ class PriceFilter(IPairList):
|
|||
super().__init__(exchange, pairlistmanager, config, pairlistconfig, pairlist_pos)
|
||||
|
||||
self._low_price_ratio = pairlistconfig.get('low_price_ratio', 0)
|
||||
self._enabled = self._low_price_ratio != 0
|
||||
|
||||
@property
|
||||
def needstickers(self) -> bool:
|
||||
|
@ -40,9 +41,6 @@ class PriceFilter(IPairList):
|
|||
:param ticker: ticker dict as returned from ccxt.load_markets()
|
||||
:return: True if the pair can stay, false if it should be removed
|
||||
"""
|
||||
if not self._low_price_ratio:
|
||||
return True
|
||||
|
||||
if ticker['last'] is None:
|
||||
self.log_on_refresh(logger.info,
|
||||
f"Removed {ticker['symbol']} from whitelist, because "
|
||||
|
|
|
@ -18,6 +18,7 @@ class SpreadFilter(IPairList):
|
|||
super().__init__(exchange, pairlistmanager, config, pairlistconfig, pairlist_pos)
|
||||
|
||||
self._max_spread_ratio = pairlistconfig.get('max_spread_ratio', 0.005)
|
||||
self._enabled = self._max_spread_ratio != 0
|
||||
|
||||
@property
|
||||
def needstickers(self) -> bool:
|
||||
|
|
Loading…
Reference in New Issue
Block a user