Skip to main content

Welcome to Broker-Python

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

Install

pip install broker-client

Usage

REST API

Init broker client:

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

Init broker options client:

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

Init broker contract client:

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

Request with proxies:

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

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

Web Socket

Init

Init broker websocket client:

client = BrokerWss(api_key='', secret='', entry_point='', rest_entry_point='')
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

Metadata

Release files for bhex 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bhex 2.0.2
File Size Uploaded Provenance Actions
bhex-2.0.2.tar.gz 7.8 kB Without provenance Details for bhex-2.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bhex 2.0.2
File Interpreter ABI Platform Actions
bhex-2.0.2-py3-none-any.whl Python 3 none any Details for bhex-2.0.2-py3-none-any.whl

Total release size: 18.0 kB

Release files / bhex-2.0.2.tar.gz

Download URL bhex-2.0.2.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7c7ec9e13074fa23bb7879686ff02d0f0ef37717d2f3c105747f8817cee15950
BLAKE2b-256 checksum
How to use checksums
daa67ff9599899c7d4d6fb3903763fe14a9f966c6cfe95594081e3c1f3d03b11
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / bhex-2.0.2-py3-none-any.whl

Download URL bhex-2.0.2-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e0196ebdbd8979aa256e7fb5f84e3c04efb85103da3f93392ed437e776823c1
BLAKE2b-256 checksum
How to use checksums
12b77b7f53d3be9c7580546ecbc7a6883e6b7bf28b186d5420391bcb83d99d52
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for bhex 2.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page