mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-17 13:21:15 +00:00
feat: add paused state to telegram commands
This commit is contained in:
@@ -170,7 +170,7 @@ class Telegram(RPCHandler):
|
|||||||
self._keyboard: list[list[str | KeyboardButton]] = [
|
self._keyboard: list[list[str | KeyboardButton]] = [
|
||||||
["/daily", "/profit", "/balance"],
|
["/daily", "/profit", "/balance"],
|
||||||
["/status", "/status table", "/performance"],
|
["/status", "/status table", "/performance"],
|
||||||
["/count", "/start", "/stop", "/help"],
|
["/start", "/pause", "/stop", "/help"],
|
||||||
]
|
]
|
||||||
# do not allow commands with mandatory arguments and critical cmds
|
# do not allow commands with mandatory arguments and critical cmds
|
||||||
# TODO: DRY! - its not good to list all valid cmds here. But otherwise
|
# TODO: DRY! - its not good to list all valid cmds here. But otherwise
|
||||||
@@ -178,6 +178,7 @@ class Telegram(RPCHandler):
|
|||||||
# problem in _help()).
|
# problem in _help()).
|
||||||
valid_keys: list[str] = [
|
valid_keys: list[str] = [
|
||||||
r"/start$",
|
r"/start$",
|
||||||
|
r"/pause$",
|
||||||
r"/stop$",
|
r"/stop$",
|
||||||
r"/status$",
|
r"/status$",
|
||||||
r"/status table$",
|
r"/status table$",
|
||||||
@@ -1244,6 +1245,18 @@ class Telegram(RPCHandler):
|
|||||||
msg = self._rpc._rpc_start()
|
msg = self._rpc._rpc_start()
|
||||||
await self._send_msg(f"Status: `{msg['status']}`")
|
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
|
@authorized_only
|
||||||
async def _stop(self, update: Update, context: CallbackContext) -> None:
|
async def _stop(self, update: Update, context: CallbackContext) -> None:
|
||||||
"""
|
"""
|
||||||
@@ -1829,6 +1842,7 @@ class Telegram(RPCHandler):
|
|||||||
"_Bot Control_\n"
|
"_Bot Control_\n"
|
||||||
"------------\n"
|
"------------\n"
|
||||||
"*/start:* `Starts the trader`\n"
|
"*/start:* `Starts the trader`\n"
|
||||||
|
"*/pause:* `Pause the new entries for trader, but handles open trades gracefully`\n"
|
||||||
"*/stop:* `Stops the trader`\n"
|
"*/stop:* `Stops the trader`\n"
|
||||||
"*/stopentry:* `Stops entering, but handles open trades gracefully` \n"
|
"*/stopentry:* `Stops entering, but handles open trades gracefully` \n"
|
||||||
"*/forceexit <trade_id>|all:* `Instantly exits the given trade or all trades, "
|
"*/forceexit <trade_id>|all:* `Instantly exits the given trade or all trades, "
|
||||||
|
|||||||
Reference in New Issue
Block a user