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,12 +175,12 @@ 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) take_profit_truncated = await truncate_float(take_profit_price, 6)
stop_loss_truncated = await truncate_float(stop_loss_price, 6) stop_loss_truncated = await truncate_float(stop_loss_price, 6)
@@ -190,6 +188,10 @@ class TelegramMessageHandler:
f"Тейк-профит: {take_profit_truncated}\n" f"Тейк-профит: {take_profit_truncated}\n"
f"Стоп-лосс: {stop_loss_truncated}\n" f"Стоп-лосс: {stop_loss_truncated}\n"
) )
else:
text += (f"Движение: {side_rus}\n"
"Не удалось установить ТП и СЛ\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(