Exchange plugin for bt_api framework — Japanese cryptocurrency exchange.
English | 中文
Zaif is a Japanese cryptocurrency exchange licensed by the Japan Financial Services Agency (FSA), offering JPY trading pairs for Bitcoin and other cryptocurrencies. This plugin integrates Zaif into the bt_api unified trading framework, supporting SPOT markets.
- REST API — market data queries, order management, account queries
- JPY trading pairs — supports JPY (Japanese Yen) trading pairs
- Japanese market focus — licensed exchange compliant with Japanese regulations
- Simple API key auth — standard API key + secret authentication
| Code | Description | Asset Type |
|---|---|---|
ZAIF___SPOT | Zaif spot markets | SPOT |
pip install bt_api_zaifOr install from source:
git clone https://github.com/cloudQuant/bt_api_zaif
cd bt_api_zaif
pip install -e .frombt_apiimportBtApiapi=BtApi(
exchange_kwargs={
"ZAIF___SPOT": {
"api_key": "your_api_key",
"secret": "your_secret",
}
}
)
# Get ticker dataticker=api.get_tick("ZAIF___SPOT", "BTC_JPY")
print(ticker)
# Get order bookdepth=api.get_depth("ZAIF___SPOT", "BTC_JPY", count=20)
print(depth)
# Get klinesbars=api.get_kline("ZAIF___SPOT", "BTC_JPY", period="1h", count=100)
print(bars)| Operation | Status | Description |
|---|---|---|
| Ticker | ✅ | Real-time price and 24h statistics |
| OrderBook/Depth | ✅ | Market depth and order book |
| Klines/Bars | ✅ | Historical OHLCV data |
| Exchange Info | ✅ | Trading rules and symbol info |
| Balance | ✅ | Account balance queries |
| Account | ✅ | Account information |
| Make Order | ✅ | Place limit/market orders |
| Cancel Order | ✅ | Cancel existing orders |
Inherits from ZaifRequestData. Access via BtApi.
api.get_tick("ZAIF___SPOT", "BTC_JPY") # Tickerapi.get_depth("ZAIF___SPOT", "BTC_JPY") # Order bookapi.get_kline("ZAIF___SPOT", "BTC_JPY") # Klinesapi.get_exchange_info("ZAIF___SPOT") # Exchange infoExchange metadata and configuration.
frombt_api_zaifimportZaifExchangeDataSpotinfo=ZaifExchangeDataSpot()
print(info.get_rest_url()) # https://api.zaif.jpprint(info.get_wss_url()) # wss://ws.zaif.jp:8888print(info.get_kline_periods()) # { "1m": "1", "5m": "5", ... }| Action | Path | Method |
|---|---|---|
| ticker | /api/1/ticker/{symbol} | GET |
| depth | /api/1/depth/{symbol} | GET |
| trades | /api/1/trades/{symbol} | GET |
| candles | /api/1/candles/{symbol} | GET |
| markets | /api/1/markets | GET |
| balance | /api/1/account_balance | GET |
bt_api_zaif/
├── src/bt_api_zaif/
│ ├── containers/ # ZaifExchangeDataSpot
│ ├── feeds/ # ZaifRequestDataSpot
│ ├── exchange_data/ # Exchange metadata
│ ├── errors/ # Error translation
│ └── plugin.py # register_zaif()
└── docs/
└── index.md # Bilingual API docs
- Python 3.9+
- bt_api_base >= 0.15
| Resource | Link |
|---|---|
| Full Docs | https://bt-api-zaif.readthedocs.io/ |
| Chinese Docs | https://bt-api-zaif.readthedocs.io/zh/latest/ |
| GitHub Repository | https://github.com/cloudQuant/bt_api_zaif |
| Issue Tracker | https://github.com/cloudQuant/bt_api_zaif/issues |
MIT License — see LICENSE for details.
Zaif 是一家受 日本金融厅 (FSA) 许可的 日本加密货币交易所,提供比特币和其他加密货币的日元(JPY)交易对。本插件将 Zaif 接入 bt_api 统一交易框架,支持 现货 (SPOT) 市场。
- REST API — 行情查询、订单管理、账户查询
- 日元交易对 — 支持 JPY(日本円)交易对
- 日本市场监管 — 合规持牌交易所
- 简单 API Key 认证 — 标准 API Key + Secret 认证方式
| 代码 | 描述 | 资产类型 |
|---|---|---|
ZAIF___SPOT | Zaif 现货市场 | SPOT |
pip install bt_api_zaif或从源码安装:
git clone https://github.com/cloudQuant/bt_api_zaif
cd bt_api_zaif
pip install -e .frombt_apiimportBtApiapi=BtApi(
exchange_kwargs={
"ZAIF___SPOT": {
"api_key": "your_api_key",
"secret": "your_secret",
}
}
)
# 获取行情ticker=api.get_tick("ZAIF___SPOT", "BTC_JPY")
print(ticker)
# 获取订单簿depth=api.get_depth("ZAIF___SPOT", "BTC_JPY", count=20)
print(depth)
# 获取K线bars=api.get_kline("ZAIF___SPOT", "BTC_JPY", period="1h", count=100)
print(bars)| 操作 | 状态 | 说明 |
|---|---|---|
| 行情 (Ticker) | ✅ | 实时价格和24小时统计 |
| 订单簿 (OrderBook) | ✅ | 市场深度和挂单 |
| K线 (Klines) | ✅ | 历史OHLCV数据 |
| 交易所信息 | ✅ | 交易规则和交易对信息 |
| 余额 (Balance) | ✅ | 账户余额查询 |
| 账户 (Account) | ✅ | 账户信息 |
| 下单 (Make Order) | ✅ | 限价/市价下单 |
| 撤单 (Cancel Order) | ✅ | 取消现有订单 |
继承自 ZaifRequestData,通过 BtApi 访问。
api.get_tick("ZAIF___SPOT", "BTC_JPY") # 行情api.get_depth("ZAIF___SPOT", "BTC_JPY") # 订单簿api.get_kline("ZAIF___SPOT", "BTC_JPY") # K线api.get_exchange_info("ZAIF___SPOT") # 交易所信息交易所元数据和配置。
frombt_api_zaifimportZaifExchangeDataSpotinfo=ZaifExchangeDataSpot()
print(info.get_rest_url()) # https://api.zaif.jpprint(info.get_wss_url()) # wss://ws.zaif.jp:8888print(info.get_kline_periods()) # { "1m": "1", "5m": "5", ... }| 动作 | 路径 | 方法 |
|---|---|---|
| ticker | /api/1/ticker/{symbol} | GET |
| depth | /api/1/depth/{symbol} | GET |
| trades | /api/1/trades/{symbol} | GET |
| candles | /api/1/candles/{symbol} | GET |
| markets | /api/1/markets | GET |
| balance | /api/1/account_balance | GET |
bt_api_zaif/
├── src/bt_api_zaif/
│ ├── containers/ # ZaifExchangeDataSpot
│ ├── feeds/ # ZaifRequestDataSpot
│ ├── exchange_data/ # 交易所元数据
│ ├── errors/ # 错误翻译
│ └── plugin.py # register_zaif()
└── docs/
└── index.md # 中英文API文档
- Python 3.9+
- bt_api_base >= 0.15
| 资源 | 链接 |
|---|---|
| 完整文档 | https://bt-api-zaif.readthedocs.io/ |
| 中文文档 | https://bt-api-zaif.readthedocs.io/zh/latest/ |
| GitHub 仓库 | https://github.com/cloudQuant/bt_api_zaif |
| 问题反馈 | https://github.com/cloudQuant/bt_api_zaif/issues |
MIT 许可证 — 详见 LICENSE。