-
Notifications
You must be signed in to change notification settings - Fork 697
Open
Description
신규 거래중, 아직 대기 주문 남은게 있으면 취소하기 위해 그동안 for 문을 돌리면서 uuid 얻어서 취소했었는데...
업비트 api 중 일괄취소가 생겼길래...
아래와 같이 주문 일괄 취소 함수 만들어 보았습니다.
테스트해보시고 별 문제 없으면 일괄취소기능도 추가되면 좋겠습니다.
- 현재 취소할 주문이 없으면 exception 떨어지네요... ㅠㅠ
일괄 취소
def cancel_order_all(self, cancel_side='all', contain_req=False):
"""
일괄 취소
:param cancel_side: - all : 매수, 매도 전체 (default).- ask : 매도 - bid : 매수
:return:
"""
try:
url = "https://api.upbit.com/v1/orders/open"
data = {"cancel_side": cancel_side}
headers = self._request_headers(data)
result = _send_delete_request(url, headers=headers, data='')
if contain_req:
return result
else:
return result[0]
except Exception as x:
print(x.__class__.__name__)
return None
Metadata
Metadata
Assignees
Labels
No labels