This commit is contained in:
algizn97
2025-10-03 14:19:18 +05:00
parent 4adbd70948
commit 1508629727
15 changed files with 412 additions and 210 deletions

View File

@@ -29,9 +29,14 @@ async def set_tp_sl_handler(callback_query: CallbackQuery, state: FSMContext) ->
"""
try:
await state.clear()
symbol = callback_query.data.split("_", 3)[3]
data = callback_query.data
parts = data.split("_")
symbol = parts[3]
position_idx = int(parts[4])
await state.set_state(SetTradingStopState.take_profit_state)
await state.update_data(symbol=symbol)
await state.update_data(position_idx=position_idx)
msg = await callback_query.message.answer(
text="Введите тейк-профит:", reply_markup=kbi.cancel
)
@@ -142,11 +147,13 @@ async def set_stop_loss_handler(message: Message, state: FSMContext) -> None:
data = await state.get_data()
symbol = data["symbol"]
take_profit = data["take_profit"]
position_idx = data["position_idx"]
res = await set_tp_sl_for_position(
tg_id=message.from_user.id,
symbol=symbol,
take_profit_price=float(take_profit),
stop_loss_price=float(stop_loss),
position_idx=position_idx,
)
if res: