BYDFi exchange plugin for bt_api — Unified REST API for Spot trading with real-time WebSocket support.
bt_api_bydfi is a runtime plugin for bt_api that connects to BYDFi exchange. It depends on bt_api_base for core infrastructure.
| Resource | Link |
|---|---|
| English Docs | https://bt-api-bydfi.readthedocs.io/ |
| Chinese Docs | https://bt-api-bydfi.readthedocs.io/zh/latest/ |
| GitHub | https://github.com/cloudQuant/bt_api_bydfi |
| PyPI | https://pypi.org/project/bt_api_bydfi/ |
| Issues | https://github.com/cloudQuant/bt_api_bydfi/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 | BYDFI___SPOT |
✅ | — | Spot trading |
- REST API — Synchronous polling for order management, balance queries, historical data
- WebSocket API — Real-time streaming for ticker, order book, k-lines, trades (planned)
Auto-registers at import time via ExchangeRegistry. Works seamlessly with BtApi:
from bt_api_py import BtApi
api = BtApi(exchange_kwargs={
"BYDFI___SPOT": {
"api_key": "your_key",
"secret": "your_secret",
}
})
ticker = api.get_tick("BYDFI___SPOT", "BTCUSDT")
balance = api.get_balance("BYDFI___SPOT")
order = api.make_order(exchange_name="BYDFI___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/candlestickTradeContainer— Individual tradesOrderContainer— Order status and fillsAccountBalanceContainer— Asset balances
pip install bt_api_bydfigit clone https://github.com/cloudQuant/bt_api_bydfi
cd bt_api_bydfi
pip install -e .- Python
3.9–3.14 bt_api_base >= 0.15httpxfor HTTP client
pip install bt_api_bydfifrom bt_api_py import BtApi
api = BtApi()
ticker = api.get_tick("BYDFI___SPOT", "BTCUSDT")
print(f"BTCUSDT price: {ticker.last_price}")from bt_api_py import BtApi
api = BtApi(exchange_kwargs={
"BYDFI___SPOT": {
"api_key": "your_api_key",
"secret": "your_secret",
}
})
order = api.make_order(
exchange_name="BYDFI___SPOT",
symbol="BTCUSDT",
volume=0.001,
price=50000,
order_type="limit",
)
print(f"Order placed: {order}")from bt_api_py import BtApi
api = BtApi(exchange_kwargs={
"BYDFI___SPOT": {
"api_key": "your_api_key",
"secret": "your_secret",
}
})
balance = api.get_balance("BYDFI___SPOT")
print(f"Balance: {balance}")bt_api_bydfi/
├── src/bt_api_bydfi/
│ ├── __init__.py # Package exports
│ ├── registry_registration.py # BYDFi feed/exchange_data registration
│ ├── containers/
│ │ ├── __init__.py
│ │ ├── exchanges/
│ │ │ ├── __init__.py
│ │ │ └── bydfi_exchange_data.py # BYDFiExchangeData, BYDFiExchangeDataSpot
│ │ └── tickers/
│ │ ├── __init__.py
│ │ └── bydfi_ticker.py # BYDFiRequestTickerData
│ └── feeds/
│ ├── __init__.py
│ ├── request_base.py # BYDFiRequestData base class
│ └── spot.py # BYDFiRequestDataSpot
├── tests/
├── docs/
├── pyproject.toml
└── README.md
| Category | Operation | Notes |
|---|---|---|
| Market Data | get_ticker |
24hr rolling ticker |
get_orderbook |
Depth up to 100 | |
get_bars |
Intervals: 1m/5m/15m/30m/1h/4h/1d/1w | |
get_trades |
Recent trade history | |
get_exchange_info |
Trading rules and symbol info | |
| Account | get_balance |
All asset balances |
get_account |
Full account info | |
| Trading | make_order |
LIMIT/MARKET orders |
cancel_order |
Cancel single order | |
query_order |
Query order by ID | |
get_open_orders |
All open orders |
BYDFi uses HMAC-SHA256 authentication:
signature = HMAC-SHA256(accessKey + timestamp + queryString + body)
Required headers:
X-API-KEY— API keyX-API-TIMESTAMP— Request timestamp (milliseconds)X-API-SIGNATURE— HMAC-SHA256 signature
| Endpoint | Limit |
|---|---|
| Public endpoints | 60 requests/minute |
| Private endpoints | 30 requests/minute |
| Doc | Link |
|---|---|
| English | https://bt-api-bydfi.readthedocs.io/ |
| 中文 | https://bt-api-bydfi.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 的 BYDFi 交易所插件 — 为现货交易提供统一的 REST API 和实时 WebSocket 支持。
bt_api_bydfi 是 bt_api 的运行时插件,连接 BYDFi 交易所。依赖 bt_api_base 提供核心基础设施。
| 资产类型 | 代码 | REST | WebSocket | 说明 |
|---|---|---|---|---|
| 现货 | BYDFI___SPOT |
✅ | — | 现货交易 |
- REST API — 同步轮询:订单管理、余额查询、历史数据
- WebSocket API — 实时流:行情、订单簿、K线、交易(计划中)
通过 ExchangeRegistry 在导入时自动注册,与 BtApi 无缝协作:
from bt_api_py import BtApi
api = BtApi(exchange_kwargs={
"BYDFI___SPOT": {
"api_key": "your_key",
"secret": "your_secret",
}
})
ticker = api.get_tick("BYDFI___SPOT", "BTCUSDT")
balance = api.get_balance("BYDFI___SPOT")
order = api.make_order(exchange_name="BYDFI___SPOT", symbol="BTCUSDT", volume=0.001, price=50000, order_type="limit")所有交易所响应规范化为 bt_api_base 容器类型:
TickContainer— 24小时滚动行情OrderBookContainer— 订单簿深度BarContainer— K线/蜡烛图TradeContainer— 逐笔成交OrderContainer— 订单状态和成交AccountBalanceContainer— 资产余额
pip install bt_api_bydfigit clone https://github.com/cloudQuant/bt_api_bydfi
cd bt_api_bydfi
pip install -e .- Python
3.9–3.14 bt_api_base >= 0.15httpxHTTP 客户端
pip install bt_api_bydfifrom bt_api_py import BtApi
api = BtApi()
ticker = api.get_tick("BYDFI___SPOT", "BTCUSDT")
print(f"BTCUSDT 价格: {ticker.last_price}")from bt_api_py import BtApi
api = BtApi(exchange_kwargs={
"BYDFI___SPOT": {
"api_key": "your_api_key",
"secret": "your_secret",
}
})
order = api.make_order(
exchange_name="BYDFI___SPOT",
symbol="BTCUSDT",
volume=0.001,
price=50000,
order_type="limit",
)
print(f"订单已下单: {order}")from bt_api_py import BtApi
api = BtApi(exchange_kwargs={
"BYDFI___SPOT": {
"api_key": "your_api_key",
"secret": "your_secret",
}
})
balance = api.get_balance("BYDFI___SPOT")
print(f"余额: {balance}")bt_api_bydfi/
├── src/bt_api_bydfi/
│ ├── __init__.py # 包导出
│ ├── registry_registration.py # BYDFi feed/exchange_data 注册
│ ├── containers/
│ │ ├── __init__.py
│ │ ├── exchanges/
│ │ │ ├── __init__.py
│ │ │ └── bydfi_exchange_data.py # BYDFiExchangeData, BYDFiExchangeDataSpot
│ │ └── tickers/
│ │ ├── __init__.py
│ │ └── bydfi_ticker.py # BYDFiRequestTickerData
│ └── feeds/
│ ├── __init__.py
│ ├── request_base.py # BYDFiRequestData 基类
│ └── spot.py # BYDFiRequestDataSpot
├── tests/
├── docs/
├── pyproject.toml
└── README.md
| 类别 | 操作 | 说明 |
|---|---|---|
| 行情数据 | get_ticker |
24小时滚动行情 |
get_orderbook |
深度最高100档 | |
get_bars |
周期: 1m/5m/15m/30m/1h/4h/1d/1w | |
get_trades |
近期成交历史 | |
get_exchange_info |
交易规则和交易对信息 | |
| 账户 | get_balance |
所有资产余额 |
get_account |
完整账户信息 | |
| 交易 | make_order |
限价/市价订单 |
cancel_order |
撤销单笔订单 | |
query_order |
按ID查询订单 | |
get_open_orders |
所有挂单 |
BYDFi 使用 HMAC-SHA256 认证:
signature = HMAC-SHA256(accessKey + timestamp + queryString + body)
必需请求头:
X-API-KEY— API 密钥X-API-TIMESTAMP— 请求时间戳(毫秒)X-API-SIGNATURE— HMAC-SHA256 签名
| 端点 | 限制 |
|---|---|
| 公开接口 | 60 次/分钟 |
| 私有接口 | 30 次/分钟 |
| 文档 | 链接 |
|---|---|
| 英文文档 | https://bt-api-bydfi.readthedocs.io/ |
| 中文文档 | https://bt-api-bydfi.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