Skip to content

Upbit(업비트) Cryptocurrency Exchange Open API Client of Multi-Programming Language Support

License

Notifications You must be signed in to change notification settings

nashorstyle/upbit-client

 
 

Repository files navigation

Upbit Client

Upbit(업비트) Cryptocurrency Exchange API Client

Description

Upbit(업비트) Cryptocurrency Exchange Open API Client of Multi-Programming Language Support

Swagger Generated Support Languages

Install

  • pip command
pip install upbit-client
  • git command
git clone https://github.com/uJhin/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

uJhin's BTC
uJhin's ETH

About

Upbit(업비트) Cryptocurrency Exchange Open API Client of Multi-Programming Language Support

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 23.8%
  • C# 18.5%
  • Java 15.3%
  • Python 9.0%
  • JavaScript 6.7%
  • Objective-C 4.4%
  • Other 22.3%