uJhin / upbit-client

Upbit(업비트) Cryptocurrency Exchange Open API Client of Multi-Programming Language Support
https://ujhin.github.io/upbit-client-docs/
MIT License
55 stars 43 forks source link
api api-client api-connector api-rest bitcoin client crypto cryptocurrency cryptocurrency-exchanges exchange http-client market-data open-api python sdk trading ujhin upbit upbit-api upbit-client



Upbit Client Documents

Support




Upbit Client

Upbit(업비트) Cryptocurrency Exchange API Client

Description

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

Swagger Generated Support Languages

Install

Quick Start

REST Client

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
```python
# /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'])

WebSocket Client

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
<div align="left">
  <img alt="uJhin's BTC" src="https://img.shields.io/badge/BTC-3NVw2seiTQddGQwc1apqudKxuTqebpyL3s-blue?style=flat-square&logo=bitcoin">
  <br/>
  <img alt="uJhin's ETH" src="https://img.shields.io/badge/ETH-0x60dd373f59862d9df776596889b997e24bee42eb-blue?style=flat-square&logo=ethereum">
</div>