Skip to content

Commit d710c85

Browse files
committed
chore: simplify profit-callback logic
1 parent 978f9c8 commit d710c85

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

freqtrade/rpc/telegram.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,6 @@ async def _profit_handler(
11091109
update: Update,
11101110
context: CallbackContext,
11111111
direction: str | None = None,
1112-
callback_path: str = "update_profit",
11131112
) -> None:
11141113
"""
11151114
Common handler for profit commands.
@@ -1154,7 +1153,7 @@ async def _profit_handler(
11541153
await self._send_msg(
11551154
markdown_msg,
11561155
reload_able=True,
1157-
callback_path=callback_path,
1156+
callback_path="update_profit" if not direction else f"update_profit_{direction}",
11581157
query=update.callback_query,
11591158
)
11601159

@@ -1167,27 +1166,23 @@ async def _profit(self, update: Update, context: CallbackContext) -> None:
11671166
:param update: message update
11681167
:return: None
11691168
"""
1170-
await self._profit_handler(update, context, callback_path="update_profit")
1169+
await self._profit_handler(update, context)
11711170

11721171
@authorized_only
11731172
async def _profit_long(self, update: Update, context: CallbackContext) -> None:
11741173
"""
11751174
Handler for /profit_long.
11761175
Returns cumulative profit statistics for long trades.
11771176
"""
1178-
await self._profit_handler(
1179-
update, context, direction="long", callback_path="update_profit_long"
1180-
)
1177+
await self._profit_handler(update, context, direction="long")
11811178

11821179
@authorized_only
11831180
async def _profit_short(self, update: Update, context: CallbackContext) -> None:
11841181
"""
11851182
Handler for /profit_short.
11861183
Returns cumulative profit statistics for short trades.
11871184
"""
1188-
await self._profit_handler(
1189-
update, context, direction="short", callback_path="update_profit_short"
1190-
)
1185+
await self._profit_handler(update, context, direction="short")
11911186

11921187
@authorized_only
11931188
async def _stats(self, update: Update, context: CallbackContext) -> None:

0 commit comments

Comments
 (0)