diff --git a/app/services/Bybit/functions/Futures.py b/app/services/Bybit/functions/Futures.py index 911c22f..875eef2 100644 --- a/app/services/Bybit/functions/Futures.py +++ b/app/services/Bybit/functions/Futures.py @@ -262,6 +262,9 @@ async def handle_execution_message(message, msg): float(martingale_factor) ** current_martingale_step ) await rq.update_martingale_step(tg_id, current_martingale) + await message.answer( + f"❗️ Сделка закрылась в минус, открываю новую сделку с увеличенной ставкой.\n" + ) await open_position( tg_id, message, @@ -391,7 +394,7 @@ async def open_position( await error_max_risk(message) return - if max_martingale_steps == current_martingale: + if max_martingale_steps < current_martingale: await error_max_step(message) return diff --git a/app/services/Bybit/functions/functions.py b/app/services/Bybit/functions/functions.py index 23a5202..d03999f 100644 --- a/app/services/Bybit/functions/functions.py +++ b/app/services/Bybit/functions/functions.py @@ -483,7 +483,7 @@ async def reset_martingale(callback: CallbackQuery) -> None: Сбрасывает шаги мартингейла пользователя. """ tg_id = callback.from_user.id - await rq.update_martingale_step(tg_id, 0) + await rq.update_martingale_step(tg_id, 1) await callback.answer("Сброс шагов выполнен.") await main_settings_message(tg_id, callback.message) diff --git a/app/telegram/database/models.py b/app/telegram/database/models.py index 88c3ec9..c3d6803 100644 --- a/app/telegram/database/models.py +++ b/app/telegram/database/models.py @@ -149,7 +149,7 @@ class User_Main_Settings(Base): size_leverage = mapped_column(Integer(), default=1) starting_quantity = mapped_column(Integer(), default=1) martingale_factor = mapped_column(Integer(), default=1) - martingale_step = mapped_column(Integer(), default=0) + martingale_step = mapped_column(Integer(), default=1) maximal_quantity = mapped_column(Integer(), default=10) entry_order_type = mapped_column(String(10), default='Market') limit_order_price = mapped_column(Numeric(18, 15), nullable=True) diff --git a/app/telegram/functions/main_settings/settings.py b/app/telegram/functions/main_settings/settings.py index 048af51..1f94590 100644 --- a/app/telegram/functions/main_settings/settings.py +++ b/app/telegram/functions/main_settings/settings.py @@ -67,7 +67,7 @@ async def main_settings_message(id, message): - Размер кредитного плеча: х{data['size_leverage']} - Начальная ставка: {data['starting_quantity']} - Коэффициент мартингейла: {data['martingale_factor']} - - Количество ставок в серии: {data['martingale_step']} + - Текущий шаг: {data['martingale_step']} - Максимальное количество ставок в серии: {data['maximal_quantity']} - Требуемый бюджет: {total_budget:.2f} USDT