add Try block to catch the failure on using FullTradesFilter on non-dry/live run

This commit is contained in:
Stefano Ariestasia 2024-01-09 14:17:35 +09:00
parent 6121c7ed86
commit 3b54e1e746

View File

@ -48,8 +48,13 @@ class FullTradesFilter(IPairList):
:return: new allowlist :return: new allowlist
""" """
# Get the number of open trades and max open trades config # Get the number of open trades and max open trades config
num_open = Trade.get_open_trade_count() try:
max_trades = self._config['max_open_trades'] num_open = Trade.get_open_trade_count()
max_trades = self._config['max_open_trades']
except AttributeError:
# Performancefilter does not work in backtesting.
self.log_once("FullTradesFilter is not available in this mode.", logger.warning)
return pairlist
if (num_open >= max_trades) and (max_trades > 0): if (num_open >= max_trades) and (max_trades > 0):
return [] return []