From de2a402bc1f99f2a33a21124b8960fb1f6a44461 Mon Sep 17 00:00:00 2001 From: 21in7 Date: Mon, 2 Mar 2026 02:15:49 +0900 Subject: [PATCH] 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. --- src/exchange.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/exchange.py b/src/exchange.py index b0ba178..d447739 100644 --- a/src/exchange.py +++ b/src/exchange.py @@ -129,10 +129,20 @@ class BinanceFuturesClient: return None async def cancel_all_orders(self): + """일반 오픈 주문과 Algo 오픈 주문을 모두 취소한다.""" loop = asyncio.get_event_loop() - return await loop.run_in_executor( + await loop.run_in_executor( None, lambda: self.client.futures_cancel_all_open_orders( 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}")