Skip to main content

Upbit OPEN API Client

Project description

https://raw.githubusercontent.com/uJhin/upbit-client/main/logo/logo.png

Upbit OPEN API Client

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


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.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

upbit_client-1.1.7.1-py2.py3-none-any.whl (12.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file upbit_client-1.1.7.1.tar.gz.

File metadata

  • Download URL: upbit_client-1.1.7.1.tar.gz
  • Upload date:
  • Size: 11.5 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.57.0 CPython/3.9.1

File hashes

Hashes for upbit_client-1.1.7.1.tar.gz
Algorithm Hash digest
SHA256 b849806cec9ac0e2779f0e996ff43b648bfc333db95961bf41896331ba85e15a
MD5 bf586171b5a29aa02807f940a775731a
BLAKE2b-256 a5299985cdd1fa4ea18e87e5a8bf756584f1fb9e8b6ef0859f0af7e65dd317fe

See more details on using hashes here.

Provenance

File details

Details for the file upbit_client-1.1.7.1-py2.py3-none-any.whl.

File metadata

  • Download URL: upbit_client-1.1.7.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 12.4 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.57.0 CPython/3.9.1

File hashes

Hashes for upbit_client-1.1.7.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 babcb6743c77a9295660657f912e506d39a8fa65213bd331c84b4ed6875e602d
MD5 8162efbebd9c23a4a2131cb469b0a4c6
BLAKE2b-256 90cb9df7bea501a11d3e1398b01e4e01fe742aa1c44e871d3623c847ab8901b4

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page