mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-14 04:03:55 +00:00
Use proper logging (using the Filter's logger)
This commit is contained in:
parent
e96e28df07
commit
696c7e87f2
|
@ -86,14 +86,14 @@ class IPairList(ABC):
|
||||||
:return: new whitelist
|
:return: new whitelist
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def verify_blacklist(self, pairlist: List[str]) -> List[str]:
|
def verify_blacklist(self, pairlist: List[str], logmethod) -> List[str]:
|
||||||
"""
|
"""
|
||||||
Proxy method to verify_blacklist for easy access for child classes.
|
Proxy method to verify_blacklist for easy access for child classes.
|
||||||
Uses `aswarning=False`, as it should be for Pairlist Handlers.
|
|
||||||
:param pairlist: Pairlist to validate
|
:param pairlist: Pairlist to validate
|
||||||
|
:param logmethod: Function that'll be called, `logger.info` or `logger.warning`.
|
||||||
:return: pairlist - blacklisted pairs
|
:return: pairlist - blacklisted pairs
|
||||||
"""
|
"""
|
||||||
return self._pairlistmanager.verify_blacklist(pairlist, aswarning=False)
|
return self._pairlistmanager.verify_blacklist(pairlist, logmethod)
|
||||||
|
|
||||||
def _whitelist_for_active_markets(self, pairlist: List[str]) -> List[str]:
|
def _whitelist_for_active_markets(self, pairlist: List[str]) -> List[str]:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -115,7 +115,7 @@ class VolumePairList(IPairList):
|
||||||
|
|
||||||
# Validate whitelist to only have active market pairs
|
# Validate whitelist to only have active market pairs
|
||||||
pairs = self._whitelist_for_active_markets([s['symbol'] for s in sorted_tickers])
|
pairs = self._whitelist_for_active_markets([s['symbol'] for s in sorted_tickers])
|
||||||
pairs = self.verify_blacklist(pairs)
|
pairs = self.verify_blacklist(pairs, logger.info)
|
||||||
# Limit pairlist to the requested number of pairs
|
# Limit pairlist to the requested number of pairs
|
||||||
pairs = pairs[:self._number_pairs]
|
pairs = pairs[:self._number_pairs]
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ class PairListManager():
|
||||||
|
|
||||||
# Validation against blacklist happens after the chain of Pairlist Handlers
|
# Validation against blacklist happens after the chain of Pairlist Handlers
|
||||||
# to ensure blacklist is respected.
|
# to ensure blacklist is respected.
|
||||||
pairlist = self.verify_blacklist(pairlist, True)
|
pairlist = self.verify_blacklist(pairlist, logger.warning)
|
||||||
|
|
||||||
self._whitelist = pairlist
|
self._whitelist = pairlist
|
||||||
|
|
||||||
|
@ -110,21 +110,19 @@ class PairListManager():
|
||||||
|
|
||||||
return pairlist
|
return pairlist
|
||||||
|
|
||||||
def verify_blacklist(self, pairlist: List[str], aswarning: bool) -> List[str]:
|
def verify_blacklist(self, pairlist: List[str], logmethod) -> List[str]:
|
||||||
"""
|
"""
|
||||||
Verify and remove items from pairlist - returning a filtered pairlist.
|
Verify and remove items from pairlist - returning a filtered pairlist.
|
||||||
Logs a warning or info depending on `aswarning`.
|
Logs a warning or info depending on `aswarning`.
|
||||||
Pairlist Handlers explicitly using this method shall use `aswarning=False`!
|
Pairlist Handlers explicitly using this method shall use
|
||||||
|
`logmethod=logger.info` to avoid spamming with warning messages
|
||||||
:param pairlist: Pairlist to validate
|
:param pairlist: Pairlist to validate
|
||||||
:param aswarning: Log message as Warning or Info
|
:param logmethod: Function that'll be called, `logger.info` or `logger.warning`.
|
||||||
:return: pairlist - blacklisted pairs
|
:return: pairlist - blacklisted pairs
|
||||||
"""
|
"""
|
||||||
for pair in deepcopy(pairlist):
|
for pair in deepcopy(pairlist):
|
||||||
if pair in self._blacklist:
|
if pair in self._blacklist:
|
||||||
if aswarning:
|
logmethod(f"Pair {pair} in your blacklist. Removing it from whitelist...")
|
||||||
logger.warning(f"Pair {pair} in your blacklist. Removing it from whitelist...")
|
|
||||||
else:
|
|
||||||
logger.info(f"Pair {pair} in your blacklist. Removing it from whitelist...")
|
|
||||||
pairlist.remove(pair)
|
pairlist.remove(pair)
|
||||||
return pairlist
|
return pairlist
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user