Skip to content

Repository files navigation

bt_api_bitbank

PyPI VersionPython VersionsLicenseCIDocs


bt_api_bitbank

Bitbank exchange plugin for bt_api — Unified REST API for Spot trading with real-time market data.

bt_api_bitbank is a runtime plugin for bt_api that connects to Bitbank exchange. It depends on bt_api_base for core infrastructure.

ResourceLink
English Docshttps://bt-api-bitbank.readthedocs.io/
Chinese Docshttps://bt-api-bitbank.readthedocs.io/zh/latest/
GitHubhttps://github.com/cloudQuant/bt_api_bitbank
PyPIhttps://pypi.org/project/bt_api_bitbank/
Issueshttps://github.com/cloudQuant/bt_api_bitbank/issues
bt_api_basehttps://bt-api-base.readthedocs.io/
Main Projecthttps://github.com/cloudQuant/bt_api_py

Features

1 Asset Type

Asset TypeCodeRESTWebSocketDescription
SpotBITBANK___SPOTSpot trading

REST API

  • Synchronous REST — Polling for order management, balance queries, historical data
  • HMAC SHA256 signature — Secure API authentication
  • Public endpoints — Market data without authentication
  • Private endpoints — Account and trading operations

Plugin Architecture

Auto-registers at import time via ExchangeRegistry. Works seamlessly with BtApi:

frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BITBANK___SPOT": {
"api_key": "your_key",
"secret": "your_secret",
}
})
ticker=api.get_tick("BITBANK___SPOT", "BTCJPY")
balance=api.get_balance("BITBANK___SPOT")
order=api.make_order(exchange_name="BITBANK___SPOT", symbol="BTCJPY", volume=0.001, price=5000000, order_type="limit")

Unified Data Containers

All exchange responses normalized to bt_api_base container types:

  • TickContainer — 24hr rolling ticker
  • OrderBookContainer — Order book depth
  • BarContainer — K-line/candlestick
  • OrderContainer — Order status and fills
  • AccountBalanceContainer — Asset balances

Installation

From PyPI (Recommended)

pip install bt_api_bitbank

From Source

git clone https://github.com/cloudQuant/bt_api_bitbank
cd bt_api_bitbank
pip install -e .

Requirements

  • Python 3.93.14
  • bt_api_base >= 0.15

Quick Start

1. Install

pip install bt_api_bitbank

2. Get ticker (public — no API key needed)

frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={})
ticker=api.get_tick("BITBANK___SPOT", "BTCJPY")
print(f"BTCJPY price: {ticker}")

3. Place an order (requires API key)

frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BITBANK___SPOT": {
"api_key": "your_api_key",
"secret": "your_secret",
}
})
order=api.make_order(
exchange_name="BITBANK___SPOT",
symbol="BTCJPY",
volume=0.001,
price=5000000,
order_type="limit",
)
print(f"Order placed: {order}")

4. bt_api Plugin Integration

frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BITBANK___SPOT": {"api_key": "key", "secret": "secret"}
})
# REST callsticker=api.get_tick("BITBANK___SPOT", "BTCJPY")
balance=api.get_balance("BITBANK___SPOT")
depth=api.get_depth("BITBANK___SPOT", "BTCJPY", count=20)
klines=api.get_kline("BITBANK___SPOT", "BTCJPY", period="1h", count=100)

Architecture

bt_api_bitbank/
├── src/bt_api_bitbank/
│ ├── __init__.py # Package entry
│ ├── plugin.py # register_plugin() — bt_api plugin entry point
│ ├── registry_registration.py # register_bitbank() — feeds / exchange_data registration
│ ├── exchange_data/
│ │ └── __init__.py # BitbankExchangeData, BitbankExchangeDataSpot
│ ├── feeds/
│ │ └── live_bitbank/
│ │ ├── __init__.py
│ │ ├── request_base.py # BitbankRequestData base class
│ │ └── spot.py # BitbankRequestDataSpot
│ └── errors/
│ └── __init__.py
├── tests/
├── docs/
└── pyproject.toml

Supported Operations

CategoryOperationNotes
Market Dataget_ticker24hr rolling ticker
get_depthOrder book depth
get_klineIntervals: 1m/5m/15m/30m/1h/4h/8h/12h/1d/1w/1month
get_exchange_infoExchange trading rules and symbol info
Accountget_balanceAll asset balances
get_accountFull account info
Tradingmake_orderLIMIT orders
cancel_orderCancel single order
query_orderQuery order by ID
get_open_ordersAll open orders

Supported Bitbank Symbols

All Bitbank Spot trading pairs are supported, including:

  • JPY pairs: BTCJPY, ETHJPY, XRPJPY, LTCJPY, ETHBTC ...
  • BTC pairs: ETHBTC, XRPBTC, LTCBTC ...
  • ETH pairs: XRPETH ...

Rate Limits

Endpoint TypeLimit
Public endpoints500 requests/minute
Private endpoints200 requests/minute

Documentation

DocLink
Englishhttps://bt-api-bitbank.readthedocs.io/
中文https://bt-api-bitbank.readthedocs.io/zh/latest/
bt_api_basehttps://bt-api-base.readthedocs.io/
Main Projecthttps://cloudquant.github.io/bt_api_py/

License

MIT — see LICENSE.


Support



中文

bt_api 的 Bitbank 交易所插件 — 为现货交易提供统一的 REST API 和实时市场数据。

bt_api_bitbankbt_api 的运行时插件,连接 Bitbank 交易所(日本持牌交易所)。依赖 bt_api_base 提供核心基础设施。

资源链接
英文文档https://bt-api-bitbank.readthedocs.io/
中文文档https://bt-api-bitbank.readthedocs.io/zh/latest/
GitHubhttps://github.com/cloudQuant/bt_api_bitbank
PyPIhttps://pypi.org/project/bt_api_bitbank/
问题反馈https://github.com/cloudQuant/bt_api_bitbank/issues
bt_api_basehttps://bt-api-base.readthedocs.io/
主项目https://github.com/cloudQuant/bt_api_py

功能特点

1 种资产类型

资产类型代码RESTWebSocket说明
现货BITBANK___SPOT现货交易

REST API

  • 同步 REST — 轮询方式处理订单管理、余额查询、历史数据
  • HMAC SHA256 签名 — 安全的 API 认证
  • 公开接口 — 无需认证即可获取市场数据
  • 私有接口 — 账户和交易操作

插件架构

通过 ExchangeRegistry 在导入时自动注册,与 BtApi 无缝协作:

frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BITBANK___SPOT": {
"api_key": "your_key",
"secret": "your_secret",
}
})
ticker=api.get_tick("BITBANK___SPOT", "BTCJPY")
balance=api.get_balance("BITBANK___SPOT")
order=api.make_order(exchange_name="BITBANK___SPOT", symbol="BTCJPY", volume=0.001, price=5000000, order_type="limit")

统一数据容器

所有交易所响应规范化为 bt_api_base 容器类型:

  • TickContainer — 24小时滚动行情
  • OrderBookContainer — 订单簿深度
  • BarContainer — K线/蜡烛图
  • OrderContainer — 订单状态和成交
  • AccountBalanceContainer — 资产余额

安装

从 PyPI 安装(推荐)

pip install bt_api_bitbank

从源码安装

git clone https://github.com/cloudQuant/bt_api_bitbank
cd bt_api_bitbank
pip install -e .

系统要求

  • Python 3.93.14
  • bt_api_base >= 0.15

快速开始

1. 安装

pip install bt_api_bitbank

2. 获取行情(公开接口,无需 API key)

frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={})
ticker=api.get_tick("BITBANK___SPOT", "BTCJPY")
print(f"BTCJPY 价格: {ticker}")

3. 下单交易(需要 API key)

frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BITBANK___SPOT": {
"api_key": "your_api_key",
"secret": "your_secret",
}
})
order=api.make_order(
exchange_name="BITBANK___SPOT",
symbol="BTCJPY",
volume=0.001,
price=5000000,
order_type="limit",
)
print(f"订单已下单: {order}")

4. bt_api 插件集成

frombt_api_pyimportBtApiapi=BtApi(exchange_kwargs={
"BITBANK___SPOT": {"api_key": "key", "secret": "secret"}
})
# REST 调用ticker=api.get_tick("BITBANK___SPOT", "BTCJPY")
balance=api.get_balance("BITBANK___SPOT")
depth=api.get_depth("BITBANK___SPOT", "BTCJPY", count=20)
klines=api.get_kline("BITBANK___SPOT", "BTCJPY", period="1h", count=100)

架构

bt_api_bitbank/
├── src/bt_api_bitbank/
│ ├── __init__.py # 包入口
│ ├── plugin.py # register_plugin() — bt_api 插件入口点
│ ├── registry_registration.py # register_bitbank() — feeds / exchange_data 注册
│ ├── exchange_data/
│ │ └── __init__.py # BitbankExchangeData, BitbankExchangeDataSpot
│ ├── feeds/
│ │ └── live_bitbank/
│ │ ├── __init__.py
│ │ ├── request_base.py # BitbankRequestData 基类
│ │ └── spot.py # BitbankRequestDataSpot
│ └── errors/
│ └── __init__.py
├── tests/
├── docs/
└── pyproject.toml

支持的操作

类别操作说明
行情数据get_ticker24小时滚动行情
get_depth订单簿深度
get_kline周期: 1m/5m/15m/30m/1h/4h/8h/12h/1d/1w/1month
get_exchange_info交易所交易规则和交易对信息
账户get_balance所有资产余额
get_account完整账户信息
交易make_order限价单
cancel_order撤销单笔订单
query_order按ID查询订单
get_open_orders所有挂单

支持的 Bitbank 交易对

全部 Bitbank 现货交易对均支持,包括:

  • JPY 交易对: BTCJPY, ETHJPY, XRPJPY, LTCJPY, ETHBTC ...
  • BTC 交易对: ETHBTC, XRPBTC, LTCBTC ...
  • ETH 交易对: XRPETH ...

限流配置

端点类型限制
公开接口500 请求/分钟
私有接口200 请求/分钟

文档

文档链接
英文文档https://bt-api-bitbank.readthedocs.io/
中文文档https://bt-api-bitbank.readthedocs.io/zh/latest/
bt_api_basehttps://bt-api-base.readthedocs.io/
主项目https://cloudquant.github.io/bt_api_py/

许可证

MIT — 详见 LICENSE


技术支持

About

bitbank api for bt_api_py

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages