Skip to main content

Welcome to Broker-Python

An official Python implementation of the lastest Open API for Broker.

Install

pip install bhex

or download from github

Usage

REST API

Init broker client:

b = BrokerClient(entry_point='', api_key='', secret='')

Init broker options client:

b = BrokerOptionClient(entry_point='', api_key='', secret='')

Init broker contract client:

b = BrokerContractClient(entry_point='', api_key='', secret='')

Request with proxies:

proxies = {
  "http": "http://ip:port",
  "https": "http://ip:port",
}

b = BrokerClient(entry_point='', api_key='', secret='', proxies=proxies)

Web Socket

Init

Init broker websocket client:

client = BrokerWss(entry_point='', rest_entry_point='', api_key='', secret='')
Subscribe

Subscribe trades:

client.subscribe_to_trades(symbol='BTCUSDT', callback=handler)

Subscribe Kline/Candlestick:

client.subscribe_to_kline(symbol='BTCUSDT', interval='5m', callback=handler)

Subscribe market tickers:

client.subscribe_to_realtimes(symbol='BTCUSDT,ETHUSDT', callback=handler)

Subscribe book depth tickers:

client.subscribe_to_depth(symbol='BTCUSDT', callback=handler)

Subscribe user data:

client.user_data_stream(callback=handler)
Start

Start websocket thread

client.start()

API List

Public API

ping

b.ping()

time

b.time()

broker info

b.broker_info()

depth

b.depth('BTCUSDT')

trades

b.trades('BTCUSDT')

klines

b.klines('BTCUSDT')

ticker 24hr

b.ticker_24hr('BTCUSDT')

Private API

new order

 b.order_new(symbol='BTCUSDT', side='BUY', type='LIMIT', quantity='0.01', price='1000', timeInForce='GTC')

get order

b.order_get(order_id='')

cancel order

b.order_cancel(order_id='')

open orders

b.open_orders()

history orders

b.history_orders()

account

b.account()

my trades

b.my_trades()

deposit orders

b.deposit_orders()

Examples

Download files

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

Source Distribution

bhex-2.0.14.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

bhex-2.0.14-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file bhex-2.0.14.tar.gz.

File metadata

  • Download URL: bhex-2.0.14.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for bhex-2.0.14.tar.gz
Algorithm Hash digest
SHA256 1873e77d8cc037e173cf20f4b69e47505ae57137158bbd4fad077015fc7df22a
MD5 1279883ccb8813a0399b15e0faf6cef1
BLAKE2b-256 2c4268f83ddaa95942ea497a3fd640def5e16154059abe9521e55e7ee237962c

See more details on using hashes here.

File details

Details for the file bhex-2.0.14-py3-none-any.whl.

File metadata

  • Download URL: bhex-2.0.14-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for bhex-2.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 2038cbfdc3df776102acd5e2ac6b169161915dfbc83ca3a528eac322b19939ab
MD5 4748d1739db0cc33d43b4e3f8cfd03ac
BLAKE2b-256 9863dc7f1ab5f63c94ed8c792ef35c8c096a1ca17bd4e0443077f6796b2f00dc

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.14 This release

2 files

2.0.10

2 files

2.0.9

2 files

2.0.8

2 files

2.0.7

2 files

2.0.6

2 files

2.0.5

2 files

2.0.4

2 files

2.0.2

2 files

2.0.1

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0

2 files

0.0.1

2 files

Supported by

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