Added output in case of installation error TP and SL

This commit is contained in:
algizn97
2025-10-30 13:21:22 +05:00
parent 29c168e31d
commit 6416bd6dc9

View File

@@ -89,8 +89,6 @@ class TelegramMessageHandler:
tg_id=tg_id, symbol=symbol, fee=safe_float(exec_fee) tg_id=tg_id, symbol=symbol, fee=safe_float(exec_fee)
) )
get_total_fee = user_auto_trading.total_fee get_total_fee = user_auto_trading.total_fee
total_fee = safe_float(exec_fee) + safe_float(get_total_fee) total_fee = safe_float(exec_fee) + safe_float(get_total_fee)
@@ -177,19 +175,23 @@ class TelegramMessageHandler:
take_profit_price = max(take_profit_price, 0) take_profit_price = max(take_profit_price, 0)
stop_loss_price = max(stop_loss_price, 0) stop_loss_price = max(stop_loss_price, 0)
await set_tp_sl_for_position(tg_id=tg_id, ress = await set_tp_sl_for_position(tg_id=tg_id,
symbol=symbol, symbol=symbol,
take_profit_price=take_profit_price, take_profit_price=take_profit_price,
stop_loss_price=stop_loss_price, stop_loss_price=stop_loss_price,
position_idx=0) position_idx=0)
if ress:
take_profit_truncated = await truncate_float(take_profit_price, 6)
stop_loss_truncated = await truncate_float(stop_loss_price, 6)
take_profit_truncated = await truncate_float(take_profit_price, 6) text += (f"Движение: {side_rus}\n"
stop_loss_truncated = await truncate_float(stop_loss_price, 6) f"Тейк-профит: {take_profit_truncated}\n"
f"Стоп-лосс: {stop_loss_truncated}\n"
)
else:
text += (f"Движение: {side_rus}\n"
"Не удалось установить ТП и СЛ\n")
text += (f"Движение: {side_rus}\n"
f"Тейк-профит: {take_profit_truncated}\n"
f"Стоп-лосс: {stop_loss_truncated}\n"
)
else: else:
new_pnl = safe_float(pnl_series) + total_pnl new_pnl = safe_float(pnl_series) + total_pnl
await rq.set_pnl_series_by_symbol( await rq.set_pnl_series_by_symbol(
@@ -205,9 +207,9 @@ class TelegramMessageHandler:
user_symbols = user_auto_trading.symbol if user_auto_trading else None user_symbols = user_auto_trading.symbol if user_auto_trading else None
if ( if (
auto_trading auto_trading
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(pnl) > 0: if safe_float(pnl) > 0:
profit_text = "📈 Начинаю новую серию с базовой ставки\n" profit_text = "📈 Начинаю новую серию с базовой ставки\n"