Merge pull request #11628 from mrpabloyeah/allow-warning-messages-when-starting-backtesting
Allow warning messages when starting backtesting
This commit is contained in:
@@ -20,12 +20,13 @@ class LoggingMixin:
|
|||||||
self.refresh_period = refresh_period
|
self.refresh_period = refresh_period
|
||||||
self._log_cache: TTLCache = TTLCache(maxsize=1024, ttl=self.refresh_period)
|
self._log_cache: TTLCache = TTLCache(maxsize=1024, ttl=self.refresh_period)
|
||||||
|
|
||||||
def log_once(self, message: str, logmethod: Callable) -> None:
|
def log_once(self, message: str, logmethod: Callable, force_show: bool = False) -> None:
|
||||||
"""
|
"""
|
||||||
Logs message - not more often than "refresh_period" to avoid log spamming
|
Logs message - not more often than "refresh_period" to avoid log spamming
|
||||||
Logs the log-message as debug as well to simplify debugging.
|
Logs the log-message as debug as well to simplify debugging.
|
||||||
:param message: String containing the message to be sent to the function.
|
:param message: String containing the message to be sent to the function.
|
||||||
:param logmethod: Function that'll be called. Most likely `logger.info`.
|
:param logmethod: Function that'll be called. Most likely `logger.info`.
|
||||||
|
:param force_show: If True, sends the message regardless of show_output value.
|
||||||
:return: None.
|
:return: None.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ class LoggingMixin:
|
|||||||
|
|
||||||
# Log as debug first
|
# Log as debug first
|
||||||
self.logger.debug(message)
|
self.logger.debug(message)
|
||||||
# Call hidden function.
|
|
||||||
if self.show_output:
|
# Call hidden function if show_output is True or force_show is True
|
||||||
|
if self.show_output or force_show:
|
||||||
_log_once(message)
|
_log_once(message)
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ class IPairList(LoggingMixin, ABC):
|
|||||||
f"Pair {pair} is not compatible with exchange "
|
f"Pair {pair} is not compatible with exchange "
|
||||||
f"{self._exchange.name}. Removing it from whitelist..",
|
f"{self._exchange.name}. Removing it from whitelist..",
|
||||||
logger.warning,
|
logger.warning,
|
||||||
|
True,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -258,6 +259,7 @@ class IPairList(LoggingMixin, ABC):
|
|||||||
self.log_once(
|
self.log_once(
|
||||||
f"Pair {pair} is not tradable with Freqtrade. Removing it from whitelist..",
|
f"Pair {pair} is not tradable with Freqtrade. Removing it from whitelist..",
|
||||||
logger.warning,
|
logger.warning,
|
||||||
|
True,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -266,13 +268,18 @@ class IPairList(LoggingMixin, ABC):
|
|||||||
f"Pair {pair} is not compatible with your stake currency "
|
f"Pair {pair} is not compatible with your stake currency "
|
||||||
f"{self._config['stake_currency']}. Removing it from whitelist..",
|
f"{self._config['stake_currency']}. Removing it from whitelist..",
|
||||||
logger.warning,
|
logger.warning,
|
||||||
|
True,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Check if market is active
|
# Check if market is active
|
||||||
market = markets[pair]
|
market = markets[pair]
|
||||||
if not market_is_active(market):
|
if not market_is_active(market):
|
||||||
self.log_once(f"Ignoring {pair} from whitelist. Market is not active.", logger.info)
|
self.log_once(
|
||||||
|
f"Ignoring {pair} from whitelist. Market is not active.",
|
||||||
|
logger.info,
|
||||||
|
True,
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
if pair not in sanitized_whitelist:
|
if pair not in sanitized_whitelist:
|
||||||
sanitized_whitelist.append(pair)
|
sanitized_whitelist.append(pair)
|
||||||
|
|||||||
Reference in New Issue
Block a user