This commit is contained in:
algizn97
2025-10-04 09:33:18 +05:00
parent 8e73dcf81f
commit 086c7c8170
2 changed files with 30 additions and 15 deletions

View File

@@ -7,7 +7,9 @@ logging.config.dictConfig(LOGGING_CONFIG)
logger = logging.getLogger("close_positions")
async def close_position(tg_id: int, symbol: str, side: str, position_idx: int, qty: float) -> bool:
async def close_position(
tg_id: int, symbol: str, side: str, position_idx: int, qty: float
) -> bool:
"""
Closes all positions
:param tg_id: Telegram user ID
@@ -38,12 +40,17 @@ async def close_position(tg_id: int, symbol: str, side: str, position_idx: int,
logger.info("All positions closed for %s for user %s", symbol, tg_id)
return True
else:
logger.error("Error closing all positions for %s for user %s", symbol, tg_id)
logger.error(
"Error closing all positions for %s for user %s", symbol, tg_id
)
return False
except Exception as e:
logger.error("Error closing all positions for %s for user %s: %s", symbol, tg_id, e)
logger.error(
"Error closing all positions for %s for user %s: %s", symbol, tg_id, e
)
return False
async def cancel_order(tg_id: int, symbol: str, order_id: str) -> bool:
"""
Cancel order by order id