2
0
forked from kodorvan/stcs

Fixed the counting of the series, added a request to set the serial number

This commit is contained in:
algizn97
2025-10-26 19:44:16 +05:00
parent a2164853d9
commit a0ef48810a
3 changed files with 95 additions and 68 deletions

View File

@@ -110,14 +110,8 @@ class TelegramMessageHandler:
get_total_fee = user_auto_trading.total_fee
total_fee = safe_float(exec_fee) + safe_float(get_total_fee)
if user_auto_trading is not None and user_auto_trading.fee is not None:
fee = user_auto_trading.fee
else:
fee = 0
exec_pnl = format_value(execution.get("execPnl"))
# total_pnl = safe_float(exec_pnl) - safe_float(exec_fee) - fee
pnl = safe_float(exec_pnl)
header = (
"Сделка закрыта:" if safe_float(closed_size) > 0 else "Сделка открыта:"
@@ -132,6 +126,7 @@ class TelegramMessageHandler:
)
commission_fee = user_deals_data.commission_fee
commission_place = user_deals_data.commission_place
current_series = user_deals_data.current_series
if commission_fee == "Yes_commission_fee":
if commission_place == "Commission_for_qty":
@@ -159,7 +154,7 @@ class TelegramMessageHandler:
if safe_float(closed_size) == 0:
text += f"Движение: {side_rus}\n"
else:
text += f"\nРеализованная прибыль: {exec_pnl:.7f}\n"
text += f"\nПрибыль: {pnl:.7f}\n"
await self.telegram_bot.send_message(
chat_id=tg_id, text=text, reply_markup=kbi.profile_bybit
@@ -172,7 +167,7 @@ class TelegramMessageHandler:
and safe_float(closed_size) > 0
and user_symbols is not None
):
if safe_float(exec_pnl) > 0:
if safe_float(pnl) > 0:
profit_text = "📈 Начинаю новую серию с базовой ставки\n"
await self.telegram_bot.send_message(
chat_id=tg_id, text=profit_text, reply_markup=kbi.profile_bybit
@@ -195,7 +190,10 @@ class TelegramMessageHandler:
res = await trading_cycle_profit(
tg_id=tg_id, symbol=symbol, side=r_side
)
current_series += 1
await rq.set_current_series(
tg_id=tg_id, symbol=symbol, current_series=current_series
)
if res == "OK":
pass
else: