Added get user trades
This commit is contained in:
@@ -14,6 +14,7 @@ from app.telegram.database.models import User_Additional_Settings as UAS
|
||||
from app.telegram.database.models import Trading_Mode
|
||||
from app.telegram.database.models import Margin_type
|
||||
from app.telegram.database.models import Trigger
|
||||
from app.telegram.database.models import USER_DEALS
|
||||
|
||||
import app.telegram.functions.functions as func # functions
|
||||
|
||||
@@ -133,6 +134,13 @@ async def get_symbol(tg_id):
|
||||
symbol = await session.scalar(select(User_Symbol.symbol).where(User_Symbol.tg_id == tg_id))
|
||||
return symbol
|
||||
|
||||
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)
|
||||
result = await session.execute(query)
|
||||
trades = result.all()
|
||||
return trades
|
||||
|
||||
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))
|
||||
@@ -303,3 +311,5 @@ async def update_commission_fee(tg_id, num):
|
||||
await session.execute(update(URMS).where(URMS.tg_id == tg_id).values(commission_fee = num))
|
||||
|
||||
await session.commit()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user