Merge pull request 'adjusted profit' (#24) from Alex/stcs:devel into stable

Reviewed-on: #24
This commit is contained in:
2025-10-26 21:18:20 +07:00

View File

@@ -117,7 +117,7 @@ class TelegramMessageHandler:
fee = 0 fee = 0
exec_pnl = format_value(execution.get("execPnl")) exec_pnl = format_value(execution.get("execPnl"))
total_pnl = safe_float(exec_pnl) - safe_float(exec_fee) - fee # total_pnl = safe_float(exec_pnl) - safe_float(exec_fee) - fee
header = ( header = (
"Сделка закрыта:" if safe_float(closed_size) > 0 else "Сделка открыта:" "Сделка закрыта:" if safe_float(closed_size) > 0 else "Сделка открыта:"
@@ -159,7 +159,7 @@ class TelegramMessageHandler:
if safe_float(closed_size) == 0: if safe_float(closed_size) == 0:
text += f"Движение: {side_rus}\n" text += f"Движение: {side_rus}\n"
else: else:
text += f"\nРеализованная прибыль: {total_pnl:.7f}\n" text += f"\nРеализованная прибыль: {exec_pnl:.7f}\n"
await self.telegram_bot.send_message( await self.telegram_bot.send_message(
chat_id=tg_id, text=text, reply_markup=kbi.profile_bybit chat_id=tg_id, text=text, reply_markup=kbi.profile_bybit
@@ -172,8 +172,8 @@ class TelegramMessageHandler:
and safe_float(closed_size) > 0 and safe_float(closed_size) > 0
and user_symbols is not None and user_symbols is not None
): ):
if safe_float(total_pnl) > 0: if safe_float(exec_pnl) > 0:
profit_text = "📈 Прибыль достигнута. Начинаем новую серию с базовой ставки\n" profit_text = "📈 Начинаю новую серию с базовой ставки\n"
await self.telegram_bot.send_message( await self.telegram_bot.send_message(
chat_id=tg_id, text=profit_text, reply_markup=kbi.profile_bybit chat_id=tg_id, text=profit_text, reply_markup=kbi.profile_bybit
) )
@@ -225,7 +225,7 @@ class TelegramMessageHandler:
reply_markup=kbi.profile_bybit, reply_markup=kbi.profile_bybit,
) )
else: else:
open_order_text = "\n❗️ Сделка закрылась в минус, открываю новую сделку с увеличенной ставкой.\n" open_order_text = "\n❗️ Открываю новую сделку с увеличенной ставкой.\n"
await self.telegram_bot.send_message( await self.telegram_bot.send_message(
chat_id=tg_id, text=open_order_text chat_id=tg_id, text=open_order_text
) )