The entire database has been changed to PostgresSQL. The entire code has been updated.
This commit is contained in:
21
app/bybit/__init__.py
Normal file
21
app/bybit/__init__.py
Normal 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
|
Reference in New Issue
Block a user