프로젝트

일반

사용자정보

Actions

주문취소

소스코드

import pyupbit

access_key = "" # 본인 key값
secret_key = "" # 본인 key값

upbit = pyupbit.Upbit(access_key, secret_key)
ret = upbit.cancel_order('85cb8127-ce8a-4e6b-9e80-2f86021252f0')
print(ret)

결과

[정상]

{'uuid': '85cb8127-ce8a-4e6b-9e80-2f86021252f0', 'side': 'ask', 'ord_type': 'limit', 'price': '170000000', 'state': 'wait', 'market': 'KRW-BTC', 'created_at': '2025-02-10T10:58:53+09:00', 'volume': '0.0011', 'remaining_volume': '0.0011', 'reserved_fee': '0', 'remaining_fee': '0', 'paid_fee': '0', 'locked': '0.0011', 'executed_volume': '0', 'trades_count': 0}

[오류]

※이미 취소된 주문

{'error': {'name': 'canceled_order', 'message': '이미 취소된 주문입니다.'}}

※uuid가 맞지 않는 경우

UpbitError
None

이태훈이(가) 10달 전에 변경 · 2 revisions