Skip to main content

helper functions of huobi rest api

Project description

HuobiApi

Huobi REST API Package(source https://github.com/MJeremy2017/HuobiApi)

Note: This is not an official package. For more info, please resort to official docs

Installation

pip install huobiApi

Get Accounts ID

import os
from huobiApi.service import HuobiSVC

ACCESS_KEY = os.getenv('ACCESS_KEY')
SECRET_KEY = os.getenv('SECRET_KEY')

svc = HuobiSVC(ACCESS_KEY, SECRET_KEY)

svc.get_accounts()

{'status': 'ok',
 'data': [{'id': 01, 'type': 'spot', 'subtype': '', 'state': 'working'},
  {'id': 02, 'type': 'margin', 'subtype': 'btcusdt', 'state': 'working'},
  {'id': 03, 'type': 'margin', 'subtype': 'eosusdt', 'state': 'working'},
  {'id': 04, 'type': 'margin', 'subtype': 'ethusdt', 'state': 'working'},
  {'id': 05, 'type': 'margin', 'subtype': 'neousdt', 'state': 'working'},
  {'id': 06, 'type': 'otc', 'subtype': '', 'state': 'working'},
  {'id': 07, 'type': 'super-margin', 'subtype': '', 'state': 'working'}]}

Get Kline Data

symbol = 'btcusdt'
res = svc.get_kline(symbol, '60min', size=50)

{'status': 'ok',
 'ch': 'market.btcusdt.kline.60min',
 'ts': 1580378774791,
 'data': [{'amount': 66.60260811521935,
   'open': 9364.89,
   'close': 9366.58,
   'high': 9376.21,
   'id': 1580378400,
   'count': 1080,
   'low': 9364.89,
   'vol': 624201.8357696668},
   ...

Place an Order

data = svc.send_order(
                acct_id='01',
                amount='0.001',
                price='7999',
                source='api',
                symbol='btcusdt',
                _type='sell-stop-limit',
                stop_price='8000',
                operator='lte'
                )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for huobiApi, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size huobiApi-0.0.4-py3-none-any.whl (10.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size huobiApi-0.0.4.tar.gz (10.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page