Skip to content

Commit

Permalink
Merge pull request #1 from seunggabi/feature/#54_cancel_all
Browse files Browse the repository at this point in the history
(uJhin#54) feat: Order_cancel_all
  • Loading branch information
seunggabi authored May 13, 2023
2 parents 10d4604 + 0e2defd commit e0e9fe9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions client/python/upbit/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,28 @@ def Order_cancel(self, **kwargs) -> dict:
future = self.__client.Order.Order_cancel(**kwargs)
return HTTPFutureExtractor.future_extraction(future)

def Order_cancel_all(self) -> dict:
result = []

while True:
waits = HTTPFutureExtractor.future_extraction(
self.__client.Order.Order_info_all(state="wait")
)["result"]

if len(waits) == 0:
break

result += waits

for w in waits:
HTTPFutureExtractor.future_extraction(
self.__client.Order.Order_cancel(uuid=w["uuid"])
)

return {
"result": result
}


class Trade:
"""
Expand Down

0 comments on commit e0e9fe9

Please sign in to comment.