U 매수매도 » 이력 » 개정판 6
개정판 5 (이태훈, 2025/02/10 01:43) → 개정판 6/7 (이태훈, 2025/02/10 01:50)
h1. 매수/매도
h3. 소스코드(매수)
<pre>
import pyupbit
access_key = "" # 본인 key값
secret_key = "" # 본인 key값
upbit = pyupbit.Upbit(access_key, secret_key)
ret = upbit.buy_limit_order("KRW-BTC", 130000000, 0.0001)
print(ret)
</pre>
h3. 결과
*[정상]*
<pre>
{'uuid': '0b55c009-aca6-4b5f-a33a-9cf2c84cd6da', 'side': 'bid', 'ord_type': 'limit', 'price': '130000000', 'state': 'wait', 'market': 'KRW-BTC', 'created_at': '2025-02-10T10:40:08+09:00', 'volume': '0.0001', 'remaining_volume': '0.0001', 'reserved_fee': '6.5', 'remaining_fee': '6.5', 'paid_fee': '0', 'locked': '13006.5', 'executed_volume': '0', 'trades_count': 0}
</pre>
*[오류]* %{color:red}※매수 시 비용이 부족한 경우 발생%
<pre>
InsufficientFundsBid
None
</pre>
----------------------------------
h3. 소스코드(매도)
<pre>
import pyupbit
access_key = "" # 본인 key값
secret_key = "" # 본인 key값
upbit = pyupbit.Upbit(access_key, secret_key)
ret = upbit.sell_limit_order("KRW-BTC", 130000000, 0.0001)
print(ret)
</pre>
h3. 결과
*[정상]*
<pre>
{'uuid': '0b55c009-aca6-4b5f-a33a-9cf2c84cd6da', 'side': 'bid', 'ord_type': 'limit', 'price': '130000000', 'state': 'wait', 'market': 'KRW-BTC', 'created_at': '2025-02-10T10:40:08+09:00', 'volume': '0.0001', 'remaining_volume': '0.0001', 'reserved_fee': '6.5', 'remaining_fee': '6.5', 'paid_fee': '0', 'locked': '13006.5', 'executed_volume': '0', 'trades_count': 0}
</pre>
*[오류]* %{color:red}※매도 시 비용이 부족한 경우 발생%
<pre>
InsufficientFundsAsk
None
</pre>