U 매수매도 » 이력 » 버전 6
이태훈, 2025/02/10 01:50
| 1 | 5 | h1. 매수/매도 |
|
|---|---|---|---|
| 2 | |||
| 3 | h3. 소스코드(매수) |
||
| 4 | |||
| 5 | <pre> |
||
| 6 | import pyupbit |
||
| 7 | |||
| 8 | access_key = "" # 본인 key값 |
||
| 9 | secret_key = "" # 본인 key값 |
||
| 10 | |||
| 11 | upbit = pyupbit.Upbit(access_key, secret_key) |
||
| 12 | ret = upbit.buy_limit_order("KRW-BTC", 130000000, 0.0001) |
||
| 13 | print(ret) |
||
| 14 | </pre> |
||
| 15 | |||
| 16 | h3. 결과 |
||
| 17 | |||
| 18 | *[정상]* |
||
| 19 | |||
| 20 | <pre> |
||
| 21 | {'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} |
||
| 22 | </pre> |
||
| 23 | |||
| 24 | *[오류]* %{color:red}※매수 시 비용이 부족한 경우 발생% |
||
| 25 | |||
| 26 | <pre> |
||
| 27 | InsufficientFundsBid |
||
| 28 | None |
||
| 29 | </pre> |
||
| 30 | 6 | 이태훈 | |
| 31 | ---------------------------------- |
||
| 32 | |||
| 33 | h3. 소스코드(매도) |
||
| 34 | |||
| 35 | <pre> |
||
| 36 | import pyupbit |
||
| 37 | |||
| 38 | access_key = "" # 본인 key값 |
||
| 39 | secret_key = "" # 본인 key값 |
||
| 40 | |||
| 41 | upbit = pyupbit.Upbit(access_key, secret_key) |
||
| 42 | ret = upbit.sell_limit_order("KRW-BTC", 130000000, 0.0001) |
||
| 43 | print(ret) |
||
| 44 | </pre> |
||
| 45 | |||
| 46 | h3. 결과 |
||
| 47 | |||
| 48 | *[정상]* |
||
| 49 | |||
| 50 | <pre> |
||
| 51 | {'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} |
||
| 52 | </pre> |
||
| 53 | |||
| 54 | *[오류]* %{color:red}※매도 시 비용이 부족한 경우 발생% |
||
| 55 | |||
| 56 | <pre> |
||
| 57 | InsufficientFundsAsk |
||
| 58 | None |
||
| 59 | </pre> |