From 72af47e7f30e00ca6fa433c5f571279026e2aaff Mon Sep 17 00:00:00 2001 From: seunggabi Date: Sun, 14 May 2023 01:38:12 +0900 Subject: [PATCH] (#54) feat: Order_cancel_all --- client/python/upbit/models.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/client/python/upbit/models.py b/client/python/upbit/models.py index 83bfa72..81597a9 100644 --- a/client/python/upbit/models.py +++ b/client/python/upbit/models.py @@ -523,6 +523,23 @@ def Order_cancel(self, **kwargs) -> dict: future = self.__client.Order.Order_cancel(**kwargs) return HTTPFutureExtractor.future_extraction(future) + def Order_cancel_all(self, **kwargs) -> list: + l = [] + + while True: + future = self.__client.Order.Order_info_all(state="wait") + waits = HTTPFutureExtractor.future_extraction(future) + + if len(waits) == 0: + break + + l.append(waits) + + for w in waits: + future = self.__client.Order.Order_cancel(uuid=w["uuid"]) + + return l + class Trade: """