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

21
app/bybit/__init__.py Normal file
View File

@@ -0,0 +1,21 @@
import logging.config
from pybit.unified_trading import HTTP
from app.bybit.logger_bybit.logger_bybit import LOGGING_CONFIG
from database import request as rq
logging.config.dictConfig(LOGGING_CONFIG)
logger = logging.getLogger("bybit")
async def get_bybit_client(tg_id: int) -> HTTP | None:
"""
Get bybit client
"""
try:
api_key, api_secret = await rq.get_user_api(tg_id=tg_id)
return HTTP(api_key=api_key, api_secret=api_secret)
except Exception as e:
logger.error("Error getting bybit client for user %s: %s", tg_id, e)
return None