![https://raw.githubusercontent.com/uJhin/upbit-client/main/logo/logo.png](https://raw.githubusercontent.com/uJhin/upbit-client/main/logo/logo.png)
git clone https://github.com/uJhin/python-upbit-client.git
# /v1/api_keys
from upbit.client import Upbit
access_key = "Your Access Key"
secret_key = "Your Secret Key"
client = Upbit(access_key, secret_key)
api_keys = client.APIKey.APIKey_info()
print(api_keys['result'])
# /v1/orders
from upbit.client import Upbit
access_key = "Your Access Key"
secret_key = "Your Secret Key"
client = Upbit(access_key, secret_key)
order = client.Order.Order_new(
market='KRW-BTC',
side='bid',
volume='0.1',
price='3000000',
ord_type='limit'
)
print(order['result'])
# /v1/orders
from upbit.client import Upbit
access_key = "Your Access Key"
secret_key = "Your Secret Key"
client = Upbit(access_key, secret_key)
order = client.Order.Order_new(
market='KRW-BTC',
side='ask',
volume='0.1',
price='3000000',
ord_type='limit'
)
print(order['result'])
# Using WebSocket
import json
import asyncio
from upbit.websocket import UpbitWebSocket
# Definition async function
async def ticker(sock, payload):
async with sock as conn:
await conn.send(payload)
while True:
recv = await conn.recv()
data = recv.decode('utf8')
result = json.loads(data)
print(result)
sock = UpbitWebSocket()
currencies = ['KRW-BTC', 'KRW-ETH']
type_field = sock.generate_type_field(
type='ticker',
codes=currencies,
)
payload = sock.generate_payload(
type_fields=[type_field]
)
event_loop = asyncio.get_event_loop()
event_loop.run_until_complete( ticker(sock, payload) )
![uJhin's BTC](https://camo.githubusercontent.com/88a8f925ffcef6ee99625882a851cb37fff87af2f9722eacf95d48b65887a7ff/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4254432d334e56773273656954516464475177633161707175644b78755471656270794c33732d626c75653f7374796c653d666c61742d737175617265266c6f676f3d626974636f696e)
![uJhin's ETH](https://camo.githubusercontent.com/a79ad24fe7162dd25e42aecc36463c82ce0b20ecac5ec134a04ca1d526e4e529/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4554482d3078363064643337336635393836326439646637373635393638383962393937653234626565343265622d626c75653f7374796c653d666c61742d737175617265266c6f676f3d657468657265756d)