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, url_type='normal')  # or aws

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.

Source Distribution

huobiApi-0.0.5.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

huobiApi-0.0.5-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file huobiApi-0.0.5.tar.gz.

File metadata

  • Download URL: huobiApi-0.0.5.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for huobiApi-0.0.5.tar.gz
Algorithm Hash digest
SHA256 36cfeea9e1ff1c8dac12705f83795ea3b01fcfe705cc4c4d37d30889913be24b
MD5 6df5d5b763f1dd745ae285a5624d8d98
BLAKE2b-256 3d305908eb3651156827ba0f5c7299b0f0469b13dac78b811c0622d2cc2daf9b

See more details on using hashes here.

File details

Details for the file huobiApi-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: huobiApi-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7

File hashes

Hashes for huobiApi-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8c38bb8f8cbd7b3a87925518ffbbdf46f43a03f56e09615039682ab2d70b3da7
MD5 6b92d13dd5b3556b8a77a02ac6199fe6
BLAKE2b-256 3fd59ae927bd6aa9f67f881e1a018ec9f2f72ef0f800cc95785d88224d3da7c3

See more details on using hashes here.

Supported by

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