From 47151e77e14f3f08b1187ebf25f22e544cec5ca9 Mon Sep 17 00:00:00 2001 From: Axel-CH Date: Fri, 21 Mar 2025 19:02:48 -0400 Subject: [PATCH] feat: add paused state to telegram commands --- freqtrade/rpc/telegram.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index 739a2af86..6149f2511 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -170,7 +170,7 @@ class Telegram(RPCHandler): self._keyboard: list[list[str | KeyboardButton]] = [ ["/daily", "/profit", "/balance"], ["/status", "/status table", "/performance"], - ["/count", "/start", "/stop", "/help"], + ["/start", "/pause", "/stop", "/help"], ] # do not allow commands with mandatory arguments and critical cmds # TODO: DRY! - its not good to list all valid cmds here. But otherwise @@ -178,6 +178,7 @@ class Telegram(RPCHandler): # problem in _help()). valid_keys: list[str] = [ r"/start$", + r"/pause$", r"/stop$", r"/status$", r"/status table$", @@ -1244,6 +1245,18 @@ class Telegram(RPCHandler): msg = self._rpc._rpc_start() await self._send_msg(f"Status: `{msg['status']}`") + @authorized_only + async def _pause(self, update: Update, context: CallbackContext) -> None: + """ + Handler for /pause. + pauses entry positions on TradeThread + :param bot: telegram bot + :param update: message update + :return: None + """ + msg = self._rpc._rpc_pause() + await self._send_msg(f"Status: `{msg['status']}`") + @authorized_only async def _stop(self, update: Update, context: CallbackContext) -> None: """ @@ -1829,6 +1842,7 @@ class Telegram(RPCHandler): "_Bot Control_\n" "------------\n" "*/start:* `Starts the trader`\n" + "*/pause:* `Pause the new entries for trader, but handles open trades gracefully`\n" "*/stop:* `Stops the trader`\n" "*/stopentry:* `Stops entering, but handles open trades gracefully` \n" "*/forceexit |all:* `Instantly exits the given trade or all trades, "