feat: enhance cancel_all_orders method to include Algo order cancellation

- Updated the cancel_all_orders method to also cancel all Algo open orders in addition to regular open orders.
- Added error handling to log warnings if the cancellation of Algo orders fails.
This commit is contained in:
21in7
2026-03-02 02:15:49 +09:00
parent 684c8a32b9
commit de2a402bc1

View File

@@ -129,10 +129,20 @@ class BinanceFuturesClient:
return None return None
async def cancel_all_orders(self): async def cancel_all_orders(self):
"""일반 오픈 주문과 Algo 오픈 주문을 모두 취소한다."""
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
return await loop.run_in_executor( await loop.run_in_executor(
None, None,
lambda: self.client.futures_cancel_all_open_orders( lambda: self.client.futures_cancel_all_open_orders(
symbol=self.config.symbol symbol=self.config.symbol
), ),
) )
try:
await loop.run_in_executor(
None,
lambda: self.client.futures_cancel_all_algo_open_orders(
symbol=self.config.symbol
),
)
except BinanceAPIException as e:
logger.warning(f"Algo 주문 전체 취소 실패 (무시): {e}")