BingX exchange plugin for bt_api — Unified REST API for Spot trading with real-time market data.
bt_api_bingx is a runtime plugin for bt_api that connects to BingX exchange. It depends on bt_api_base for core infrastructure.
| Resource | Link |
|---|---|
| English Docs | https://bt-api-bingx.readthedocs.io/ |
| Chinese Docs | https://bt-api-bingx.readthedocs.io/zh/latest/ |
| GitHub | https://github.com/cloudQuant/bt_api_bingx |
| PyPI | https://pypi.org/project/bt_api_bingx/ |
| Issues | https://github.com/cloudQuant/bt_api_bingx/issues |
| bt_api_base | https://bt-api-base.readthedocs.io/ |
| Main Project | https://github.com/cloudQuant/bt_api_py |
| Asset Type | Code | REST | WebSocket | Description |
|---|---|---|---|---|
| Spot | BINGX___SPOT | ✅ | — | Spot trading |
- Synchronous REST — Polling for order management, balance queries, historical data
- HMAC SHA256 signature — Secure API authentication
Auto-registers at import time via ExchangeRegistry. Works seamlessly with BtApi:
frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BINGX___SPOT": {
"api_key": "your_key",
"secret": "your_secret",
}
})
ticker=api.get_tick("BINGX___SPOT", "BTCUSDT")
balance=api.get_balance("BINGX___SPOT")
order=api.make_order(exchange_name="BINGX___SPOT", symbol="BTCUSDT", volume=0.001, price=50000, order_type="limit")All exchange responses normalized to bt_api_base container types:
TickContainer— 24hr rolling tickerOrderBookContainer— Order book depthBarContainer— K-line/candlestickOrderContainer— Order status and fillsAccountBalanceContainer— Asset balances
pip install bt_api_bingxgit clone https://github.com/cloudQuant/bt_api_bingx
cd bt_api_bingx
pip install -e .- Python
3.9–3.14 bt_api_base >= 0.15
pip install bt_api_bingxfrombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={})
ticker=api.get_tick("BINGX___SPOT", "BTCUSDT")
print(f"BTCUSDT price: {ticker}")frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BINGX___SPOT": {
"api_key": "your_api_key",
"secret": "your_secret",
}
})
order=api.make_order(
exchange_name="BINGX___SPOT",
symbol="BTCUSDT",
volume=0.001,
price=50000,
order_type="LIMIT",
)
print(f"Order placed: {order}")frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BINGX___SPOT": {"api_key": "key", "secret": "secret"}
})
# REST callsticker=api.get_tick("BINGX___SPOT", "BTCUSDT")
balance=api.get_balance("BINGX___SPOT")
depth=api.get_depth("BINGX___SPOT", "BTCUSDT", count=20)
klines=api.get_kline("BINGX___SPOT", "BTCUSDT", period="1h", count=100)bt_api_bingx/
├── src/bt_api_bingx/
│ ├── __init__.py # Package entry
│ ├── plugin.py # register_plugin() — bt_api plugin entry point
│ ├── registry_registration.py # register_bingx() — feeds / exchange_data registration
│ ├── exchange_data/
│ │ └── __init__.py # BingXExchangeData, BingXExchangeDataSpot
│ ├── feeds/
│ │ └── live_bingx/
│ │ ├── __init__.py
│ │ ├── request_base.py # BingXRequestData base class
│ │ └── spot.py # BingXRequestDataSpot
│ └── errors/
│ └── __init__.py
├── tests/
├── docs/
└── pyproject.toml
| Category | Operation | Notes |
|---|---|---|
| Market Data | get_ticker | 24hr rolling ticker |
get_depth | Order book depth | |
get_kline | Intervals: 1m/3m/5m/15m/30m/1h/2h/4h/6h/12h/1d/3d/1w/1M | |
get_exchange_info | Exchange trading rules and symbol info | |
| Account | get_balance | All asset balances |
get_account | Full account info | |
| Trading | make_order | LIMIT orders |
cancel_order | Cancel single order | |
query_order | Query order by ID | |
get_open_orders | All open orders |
All BingX Spot trading pairs are supported, including:
- USDT pairs:
BTCUSDT,ETHUSDT,SOLUSDT,XRPUSDT,BNBUSDT... - USD pairs:
BTCUSD,ETHUSD,SOLUSD... - BTC pairs:
ETHBTC,BNBBTC... - ETH pairs:
BNBETH... - EUR pairs:
BTCEUR,ETHEUR...
| Endpoint | Limit |
|---|---|
| Public endpoints | 200 requests/minute |
| Trade endpoints | 100 requests/minute |
| Doc | Link |
|---|---|
| English | https://bt-api-bingx.readthedocs.io/ |
| 中文 | https://bt-api-bingx.readthedocs.io/zh/latest/ |
| bt_api_base | https://bt-api-base.readthedocs.io/ |
| Main Project | https://cloudquant.github.io/bt_api_py/ |
MIT — see LICENSE.
- GitHub Issues — bug reports, feature requests
- Email: yunjinqi@gmail.com
bt_api 的 BingX 交易所插件 — 为现货交易提供统一的 REST API 和实时市场数据。
bt_api_bingx 是 bt_api 的运行时插件,连接 BingX 交易所。依赖 bt_api_base 提供核心基础设施。
| 资产类型 | 代码 | REST | WebSocket | 说明 |
|---|---|---|---|---|
| 现货 | BINGX___SPOT | ✅ | — | 现货交易 |
- 同步 REST — 轮询方式处理订单管理、余额查询、历史数据
- HMAC SHA256 签名 — 安全的 API 认证
通过 ExchangeRegistry 在导入时自动注册,与 BtApi 无缝协作:
frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BINGX___SPOT": {
"api_key": "your_key",
"secret": "your_secret",
}
})
ticker=api.get_tick("BINGX___SPOT", "BTCUSDT")
balance=api.get_balance("BINGX___SPOT")
order=api.make_order(exchange_name="BINGX___SPOT", symbol="BTCUSDT", volume=0.001, price=50000, order_type="limit")所有交易所响应规范化为 bt_api_base 容器类型:
TickContainer— 24小时滚动行情OrderBookContainer— 订单簿深度BarContainer— K线/蜡烛图OrderContainer— 订单状态和成交AccountBalanceContainer— 资产余额
pip install bt_api_bingxgit clone https://github.com/cloudQuant/bt_api_bingx
cd bt_api_bingx
pip install -e .- Python
3.9–3.14 bt_api_base >= 0.15
pip install bt_api_bingxfrombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={})
ticker=api.get_tick("BINGX___SPOT", "BTCUSDT")
print(f"BTCUSDT 价格: {ticker}")frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BINGX___SPOT": {
"api_key": "your_api_key",
"secret": "your_secret",
}
})
order=api.make_order(
exchange_name="BINGX___SPOT",
symbol="BTCUSDT",
volume=0.001,
price=50000,
order_type="LIMIT",
)
print(f"订单已下单: {order}")frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BINGX___SPOT": {"api_key": "key", "secret": "secret"}
})
# REST 调用ticker=api.get_tick("BINGX___SPOT", "BTCUSDT")
balance=api.get_balance("BINGX___SPOT")
depth=api.get_depth("BINGX___SPOT", "BTCUSDT", count=20)
klines=api.get_kline("BINGX___SPOT", "BTCUSDT", period="1h", count=100)bt_api_bingx/
├── src/bt_api_bingx/
│ ├── __init__.py # 包入口
│ ├── plugin.py # register_plugin() — bt_api 插件入口点
│ ├── registry_registration.py # register_bingx() — feeds / exchange_data 注册
│ ├── exchange_data/
│ │ └── __init__.py # BingXExchangeData, BingXExchangeDataSpot
│ ├── feeds/
│ │ └── live_bingx/
│ │ ├── __init__.py
│ │ ├── request_base.py # BingXRequestData 基类
│ │ └── spot.py # BingXRequestDataSpot
│ └── errors/
│ └── __init__.py
├── tests/
├── docs/
└── pyproject.toml
| 类别 | 操作 | 说明 |
|---|---|---|
| 行情数据 | get_ticker | 24小时滚动行情 |
get_depth | 订单簿深度 | |
get_kline | 周期: 1m/3m/5m/15m/30m/1h/2h/4h/6h/12h/1d/3d/1w/1M | |
get_exchange_info | 交易所交易规则和交易对信息 | |
| 账户 | get_balance | 所有资产余额 |
get_account | 完整账户信息 | |
| 交易 | make_order | 限价单 |
cancel_order | 撤销单笔订单 | |
query_order | 按ID查询订单 | |
get_open_orders | 所有挂单 |
全部 BingX 现货交易对均支持,包括:
- USDT 交易对:
BTCUSDT,ETHUSDT,SOLUSDT,XRPUSDT,BNBUSDT... - USD 交易对:
BTCUSD,ETHUSD,SOLUSD... - BTC 交易对:
ETHBTC,BNBBTC... - ETH 交易对:
BNBETH... - EUR 交易对:
BTCEUR,ETHEUR...
| 端点 | 限制 |
|---|---|
| 公开接口 | 200 请求/分钟 |
| 交易接口 | 100 请求/分钟 |
| 文档 | 链接 |
|---|---|
| 英文文档 | https://bt-api-bingx.readthedocs.io/ |
| 中文文档 | https://bt-api-bingx.readthedocs.io/zh/latest/ |
| bt_api_base | https://bt-api-base.readthedocs.io/ |
| 主项目 | https://cloudquant.github.io/bt_api_py/ |
MIT — 详见 LICENSE。
- GitHub Issues — bug 报告、功能请求
- 邮箱: yunjinqi@gmail.com