Refactor try/except: handle DependencyException for each pair separately

This commit is contained in:
hroff-1902 2019-12-29 05:03:10 +03:00
parent ce84f74528
commit 04f28ed9bc

View File

@ -463,9 +463,8 @@ class FreqtradeBot:
Tries to execute buy orders for trades in a safe way Tries to execute buy orders for trades in a safe way
""" """
result = False result = False
try:
whitelist = copy.deepcopy(self.active_pair_whitelist)
whitelist = copy.deepcopy(self.active_pair_whitelist)
if not whitelist: if not whitelist:
logger.info("Active pair whitelist is empty.") logger.info("Active pair whitelist is empty.")
else: else:
@ -481,15 +480,16 @@ class FreqtradeBot:
else: else:
# Create entity and execute trade for each pair from whitelist # Create entity and execute trade for each pair from whitelist
for pair in whitelist: for pair in whitelist:
try:
if self.create_trade(pair): if self.create_trade(pair):
result = True result = True
if not result:
logger.debug('Found no buy signals for whitelisted currencies. Trying again...')
except DependencyException as exception: except DependencyException as exception:
logger.warning('Unable to create trade: %s', exception) logger.warning('Unable to create trade: %s', exception)
if not result:
logger.debug("Found no buy signals for whitelisted currencies. "
"Trying again...")
def process_maybe_execute_sells(self, trades: List[Any]) -> None: def process_maybe_execute_sells(self, trades: List[Any]) -> None:
""" """
Tries to execute sell orders for trades in a safe way Tries to execute sell orders for trades in a safe way