2
0
forked from kodorvan/stcs

Fixed percentages of TP and SL from integers to floats

This commit is contained in:
algizn97
2025-10-10 13:57:29 +05:00
parent fb82f365f2
commit 6bfb816d2a
2 changed files with 17 additions and 10 deletions

View File

@@ -53,7 +53,7 @@ async def cmd_start(message: Message, state: FSMContext) -> None:
await rq.create_user_conditional_settings(tg_id=tg_id)
await message.answer(
text=f"Добро пожаловать, {full_name}!\n\n"
"Чат-робот для трейдинга - ваш надежный помощник для анализа рынка и принятия взвешенных решений.😉",
"Чат-робот для трейдинга - ваш надежный помощник для анализа рынка и принятия взвешенных решений.😉",
reply_markup=kbi.connect_the_platform,
)
logger.debug(
@@ -134,7 +134,7 @@ async def profile_bybit(message: Message, state: FSMContext) -> None:
@router_handlers_main.callback_query(F.data == "profile_bybit")
async def profile_bybit_callback(
callback_query: CallbackQuery, state: FSMContext
callback_query: CallbackQuery, state: FSMContext
) -> None:
"""
Handle callback query with data "profile_bybit".
@@ -279,10 +279,10 @@ async def cmd_help(message: Message, state: FSMContext) -> None:
await state.clear()
await message.answer(
text="Используйте одну из следующих команд:\n"
"/start - Запустить бота\n"
"/profile - Профиль\n"
"/bybit - Панель Bybit\n"
"/connect - Подключиться к платформе\n",
"/start - Запустить бота\n"
"/profile - Профиль\n"
"/bybit - Панель Bybit\n"
"/connect - Подключиться к платформе\n",
reply_markup=kbr.profile,
)
logger.debug(
@@ -378,4 +378,4 @@ async def cmd_cancel(callback_query: CallbackQuery, state: FSMContext) -> None:
e,
)
finally:
await state.clear()
await state.clear()

View File

@@ -98,7 +98,10 @@ async def set_take_profit_percent(message: Message, state: FSMContext) -> None:
)
return
if safe_float(take_profit_percent_value) < 1 or safe_float(take_profit_percent_value) > 100:
if (
safe_float(take_profit_percent_value) < 1
or safe_float(take_profit_percent_value) > 100
):
await message.answer(
text="Ошибка: введите число от 1 до 100.",
reply_markup=kbi.back_to_risk_management,
@@ -219,7 +222,10 @@ async def set_stop_loss_percent(message: Message, state: FSMContext) -> None:
)
return
if safe_float(stop_loss_percent_value) < 1 or safe_float(stop_loss_percent_value) > 100:
if (
safe_float(stop_loss_percent_value) < 1
or safe_float(stop_loss_percent_value) > 100
):
await message.answer(
text="Ошибка: введите число от 1 до 100.",
reply_markup=kbi.back_to_risk_management,
@@ -232,7 +238,8 @@ async def set_stop_loss_percent(message: Message, state: FSMContext) -> None:
return
req = await rq.set_stop_loss_percent(
tg_id=message.from_user.id, stop_loss_percent=safe_float(stop_loss_percent_value)
tg_id=message.from_user.id,
stop_loss_percent=safe_float(stop_loss_percent_value),
)
if req: