From 3ef8eae997f25fa4204233f1f19fe854425eb81c Mon Sep 17 00:00:00 2001 From: algizn97 Date: Sun, 26 Oct 2025 14:01:55 +0500 Subject: [PATCH] Added the output of the current series number and the transaction --- app/bybit/telegram_message_handler.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/bybit/telegram_message_handler.py b/app/bybit/telegram_message_handler.py index 45699b4..101f4b2 100644 --- a/app/bybit/telegram_message_handler.py +++ b/app/bybit/telegram_message_handler.py @@ -118,6 +118,7 @@ class TelegramMessageHandler: exec_pnl = format_value(execution.get("execPnl")) total_pnl = safe_float(exec_pnl) - safe_float(exec_fee) - fee + header = ( "Сделка закрыта:" if safe_float(closed_size) > 0 else "Сделка открыта:" ) @@ -129,11 +130,26 @@ class TelegramMessageHandler: user_deals_data = await rq.get_user_deal_by_symbol( tg_id=tg_id, symbol=symbol ) - if user_deals_data is not None and auto_trading: + commission_fee = user_deals_data.commission_fee + commission_place = user_deals_data.commission_place + + if commission_fee == "Yes_commission_fee": + if commission_place == "Commission_for_qty": + total_quantity = safe_float(user_deals_data.order_quantity) + safe_float( + total_fee + ) + else: + total_quantity = safe_float(user_deals_data.order_quantity) + else: + total_quantity = safe_float(user_deals_data.order_quantity) + + if user_deals_data is not None and auto_trading and safe_float(closed_size) == 0: await rq.set_total_fee_user_auto_trading( tg_id=tg_id, symbol=symbol, total_fee=total_fee ) - text += f"Текущая ставка: {user_deals_data.order_quantity} USDT\n" + text += f"Текущая ставка: {total_quantity:.2f} USDT\n" + text += f"Серия №: {user_deals_data.current_series}\n" + text += f"Сделка №: {user_deals_data.current_step}\n" text += ( f"Цена исполнения: {exec_price}\n"