Upbit OPEN API Client
Project description
Upbit OPEN API Client
@Author: uJhin
@Official Documents: https://ujhin.github.io/upbit-client-docs/
Install
pip command
pip install upbit-client
git command
git clone https://github.com/uJhin/python-upbit-client.git
Quick Start
REST Client
Check Your API Keys
# /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'])
Buy Currency
# /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'])
Sell Currency
# /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'])
WebSocket Client
Get Real-Time Ticker
# 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) )
Donation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
upbit-client-1.3.1.0.tar.gz
(13.1 kB
view details)
Built Distribution
File details
Details for the file upbit-client-1.3.1.0.tar.gz
.
File metadata
- Download URL: upbit-client-1.3.1.0.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 600e6875685339006aedfb2827f92e9ab8952a6a85dd31d5c80ea2a8675b689a |
|
MD5 | 9efcb035487f7a8fbe237073ab831fc9 |
|
BLAKE2b-256 | 6445b50789f3d640f1721f94380973803b3bf7245de0271a29a5c435fcff799d |
Provenance
File details
Details for the file upbit_client-1.3.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: upbit_client-1.3.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d08b118c15c49d925c073a8bc1ed57c1bc4ff9e37fee750d08c2ba0f223f72f |
|
MD5 | 684ea437ef1a02174ad23bd56770af2c |
|
BLAKE2b-256 | 79e5d6c98c74bb48525f09100c1ec874d6c47a4d78815b121ea1157da3d45a33 |