diff --git a/app/telegram/Keyboards/inline_keyboards.py b/app/telegram/Keyboards/inline_keyboards.py index b913353..8dff646 100644 --- a/app/telegram/Keyboards/inline_keyboards.py +++ b/app/telegram/Keyboards/inline_keyboards.py @@ -60,7 +60,7 @@ main_settings_markup = InlineKeyboardMarkup(inline_keyboard=[ InlineKeyboardButton(text='Начальная ставка', callback_data='clb_change_starting_quantity')], [InlineKeyboardButton(text='Коэффициент Мартингейла', callback_data='clb_change_martingale_factor'), - InlineKeyboardButton(text='Максимльное кол-во ставок', callback_data='clb_change_maximum_quantity')], + InlineKeyboardButton(text='Максимальное кол-во ставок', callback_data='clb_change_maximum_quantity')], back_btn_list_settings, back_btn_to_main diff --git a/app/telegram/database/models.py b/app/telegram/database/models.py index 9b444d9..a690214 100644 --- a/app/telegram/database/models.py +++ b/app/telegram/database/models.py @@ -150,5 +150,4 @@ class USER_DEALS(Base): tg_id = mapped_column(ForeignKey("user_telegram_id.tg_id")) symbol = mapped_column(String(18), default='PENGUUSDT') - open_price = mapped_column(Integer(), default=1) side = mapped_column(String(10), nullable=False) \ No newline at end of file diff --git a/app/telegram/database/requests.py b/app/telegram/database/requests.py index 917d983..59f58de 100644 --- a/app/telegram/database/requests.py +++ b/app/telegram/database/requests.py @@ -136,11 +136,18 @@ async def get_symbol(tg_id): async def get_user_trades(tg_id): async with async_session() as session: - query = select(USER_DEALS.symbol, USER_DEALS.side, USER_DEALS.open_price).where(USER_DEALS.tg_id == tg_id) + query = select(USER_DEALS.symbol, USER_DEALS.side).where(USER_DEALS.tg_id == tg_id) result = await session.execute(query) trades = result.all() return trades + +async def update_user_trades(tg_id, symbol, side): + async with async_session() as session: + await session.execute(update(USER_DEALS).where(USER_DEALS.tg_id == tg_id).values(symbol = symbol, side = side)) + + await session.commit() + async def get_for_registration_trading_mode(): async with async_session() as session: mode = await session.scalar(select(Trading_Mode.mode).where(Trading_Mode.id == 1))