2
0
forked from kodorvan/stcs

The entire database has been changed to PostgresSQL. The entire code has been updated.

This commit is contained in:
algizn97
2025-10-01 15:23:21 +05:00
parent e5a3de4ed8
commit 97662081ce
49 changed files with 7916 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import logging.config
from app.bybit import get_bybit_client
from app.bybit.logger_bybit.logger_bybit import LOGGING_CONFIG
logging.config.dictConfig(LOGGING_CONFIG)
logger = logging.getLogger("get_balance")
async def get_balance(tg_id: int) -> bool | dict:
"""
Get balance bybit
"""
client = await get_bybit_client(tg_id=tg_id)
try:
response = client.get_wallet_balance(accountType="UNIFIED")
if response["retCode"] == 0:
info = response["result"]["list"][0]
return info
else:
logger.error(
"Error getting balance for user %s: %s", tg_id, response.get("retMsg")
)
return False
except Exception as e:
logger.error("Error connecting to Bybit for user %s: %s", tg_id, e)
return False