forked from kodorvan/stcs
Added API key verification for permissions
This commit is contained in:
@@ -38,7 +38,7 @@ async def get_active_positions(tg_id: int) -> list | None:
|
||||
return None
|
||||
|
||||
|
||||
async def get_active_positions_by_symbol(tg_id: int, symbol: str) -> dict | None:
|
||||
async def get_active_positions_by_symbol(tg_id: int, symbol: str):
|
||||
"""
|
||||
Get active positions for a user by symbol
|
||||
"""
|
||||
@@ -62,8 +62,12 @@ async def get_active_positions_by_symbol(tg_id: int, symbol: str) -> dict | None
|
||||
)
|
||||
return None
|
||||
except Exception as e:
|
||||
logger.error("Error getting active positions for user %s: %s", tg_id, e)
|
||||
return None
|
||||
errors = str(e)
|
||||
if errors.startswith("Permission denied, please check your API key permissions"):
|
||||
return "Invalid API key permissions"
|
||||
else:
|
||||
logger.error("Error getting active positions for user %s: %s", tg_id, e)
|
||||
return None
|
||||
|
||||
|
||||
async def get_active_orders(tg_id: int) -> list | None:
|
||||
|
||||
Reference in New Issue
Block a user