Update warning message open trades

This shouldn't confuse user when just reloading their bot.
This commit is contained in:
Theagainmen 2021-11-05 18:49:10 +01:00 committed by GitHub
parent 781f8a059c
commit 2115a3ed12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -193,21 +193,22 @@ class FreqtradeBot(LoggingMixin):
def check_for_open_trades(self): def check_for_open_trades(self):
""" """
Notify the user when the bot is stopped Notify the user when the bot is stopped (not reloaded)
and there are still open trades active. and there are still open trades active.
""" """
open_trades = Trade.get_trades([Trade.is_open.is_(True)]).all() open_trades = Trade.get_trades([Trade.is_open.is_(True)]).all()
if len(open_trades) != 0: if len(open_trades) != 0:
msg = { if self.state != State.RELOAD_CONFIG:
'type': RPCMessageType.WARNING, msg = {
'status': f"{len(open_trades)} open trades active.\n\n" 'type': RPCMessageType.WARNING,
f"Handle these trades manually on {self.exchange.name}, " 'status': f"{len(open_trades)} open trades active.\n\n"
f"or '/start' the bot again and use '/stopbuy' " f"Handle these trades manually on {self.exchange.name}, "
f"to handle open trades gracefully. \n" f"or '/start' the bot again and use '/stopbuy' "
f"{'Trades are simulated.' if self.config['dry_run'] else ''}", f"to handle open trades gracefully. \n"
} f"{'Note: Trades are simulated (dry run).' if self.config['dry_run'] else ''}",
self.rpc.send_msg(msg) }
self.rpc.send_msg(msg)
def _refresh_active_whitelist(self, trades: List[Trade] = []) -> List[str]: def _refresh_active_whitelist(self, trades: List[Trade] = []) -> List[str]:
""" """