Fixed message output for certain conditions

This commit is contained in:
algizn97
2025-10-30 13:47:29 +05:00
parent 6416bd6dc9
commit 78f21e6718

View File

@@ -71,7 +71,7 @@ class TelegramMessageHandler:
auto_trading = (
user_auto_trading.auto_trading if user_auto_trading else False
)
if auto_trading:
side_rus = (
"Покупка"
if side == "Buy"
@@ -193,12 +193,16 @@ class TelegramMessageHandler:
"Не удалось установить ТП и СЛ\n")
else:
if auto_trading:
new_pnl = safe_float(pnl_series) + total_pnl
await rq.set_pnl_series_by_symbol(
tg_id=tg_id, symbol=symbol, pnl_series=new_pnl)
text += f"\nПрибыль без комиссии: {ex_pnl:.4f}\n"
text += f"Реализованная прибыль: {total_pnl:.4f}\n"
text += f"Прибыль серии: {safe_float(new_pnl):.4f}\n"
else:
text += f"\nПрибыль без комиссии: {ex_pnl:.4f}\n"
text += f"Реализованная прибыль: {total_pnl:.4f}\n"
await self.telegram_bot.send_message(
chat_id=tg_id, text=text, reply_markup=kbi.profile_bybit
@@ -308,6 +312,5 @@ class TelegramMessageHandler:
text=error_text,
reply_markup=kbi.profile_bybit,
)
except Exception as e:
logger.error("Error in telegram_message_handler: %s", e, exc_info=True)