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:
while True:
await conn.send(payload)
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
BTC: 3NVw2seiTQddGQwc1apqudKxuTqebpyL3s
ETH: 0x60dd373f59862d9df776596889b997e24bee42eb
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.1.7.4.tar.gz
(11.9 kB
view details)
Built Distribution
File details
Details for the file upbit-client-1.1.7.4.tar.gz
.
File metadata
- Download URL: upbit-client-1.1.7.4.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f4e95eebfb2ad8b0d9b96dd1ba4847364e7e44c12cbd547c5775d05166d59d3 |
|
MD5 | ec28fe2880fd1a7fb22b5e048f49e75c |
|
BLAKE2b-256 | 1743bb501a50676f4e2f2298b3defc177bbeb406017130534996b6fe949361a2 |
Provenance
File details
Details for the file upbit_client-1.1.7.4-py2.py3-none-any.whl
.
File metadata
- Download URL: upbit_client-1.1.7.4-py2.py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9dd28338f6f1e0cb08f5bac7c6e83749a1efa1640b1119f19adfd793c461500c |
|
MD5 | bccaba07c9eb84bfcdc04015e6c12c0f |
|
BLAKE2b-256 | 453117536c773013ee3b088e3388165bf02183ed56d515c2aa004a381715b632 |