[Preview] pybotters
An advanced API client for python botters.
📌 Description
pybotters は 仮想通貨 botter 向けの Python ライブラリです。
複数取引所に対応した非同期 I/O の API クライアントであり、bot 開発により素晴らしい DX を提供します。
🚧 In development
pybotters は現在 ** Previewバージョン ** です。
一部機能は開発中です。
開発状況については こちら(Issues) を参照してください。
🚀 Features
- ✨ HTTP / WebSocket Client
- 複数取引所のプライベート API を自動認証
aiohttpライブラリを基盤とした非同期通信- WebSocket の自動再接続、自動ハートビート
- ✨ DataStore
- WebSocket 用のデータ保管クラス
- ピュア Python データモデルによる高速なデータ参照
- 取引所別モデルの実装
- ✨ Developer Experience
asyncioライブラリを利用した非同期プログラミング- 型ヒントのサポート
🏦 Exchanges
| Name | API auth | DataStore | API docs |
|---|---|---|---|
| Bybit | ✅ | ✅ (Futures v2) | Official v5 / Futures v2 |
| Binance | ✅ | ✅ | Official |
| OKX | ✅ | ✅ | Official |
| Phemex | ✅ | ✅ | Official |
| Bitget | ✅ | ✅ | Official |
| MEXC | ✅ | WIP | Official / v3 |
| KuCoin | ✅ | ✅ | Official |
| BitMEX | ✅ | ✅ | Official |
| bitFlyer | ✅ | ✅ | Official |
| GMO Coin | ✅ | ✅ | Official |
| bitbank | ✅ | ✅ | Official |
| Coincheck | ✅ | ✅ | Official |
🐍 Requires
Python 3.7+
🔧 Installation
pip install pybotters
🌏 Quickstart
Single exchange
import asyncio
import pybotters
apis = {
"bybit": ["BYBIT_API_KEY", "BYBIT_API_SECRET"],
}
async def main():
async with pybotters.Client(apis=apis, base_url="https://api.bybit.com") as client:
# REST API
resp = await client.get("/v2/private/position/list", params={"symbol": "BTCUSD"})
data = await resp.json()
print(data)
# WebSocket API (with defautl print handler)
ws = await client.ws_connect(
url="wss://stream.bybit.com/realtime",
send_json={"op": "subscribe", "args": ["trade.BTCUSD", "order", "position"]},
)
await ws # Ctrl+C to break
try:
asyncio.run(main())
except KeyboardInterrupt:
pass
Multiple exchanges
apis = {
"bybit": ["BYBIT_API_KEY", "BYBIT_API_SECRET"],
"binance": ["BINANCE_API_KEY", "BINANCE_API_SECRET"],
}
async def main():
async with pybotters.Client(apis=apis) as client:
await client.post("https://api.bybit.com/v2/private/order/create", data={"symbol": "BTCUSD", ...: ...})
...
await client.post("https://dapi.binance.com/dapi/v1/order", data={"symbol": "BTCUSD_PERP", ...: ...})
...
📖 Documents
🗽 License
MIT
💖 Author
Twitter:
Discord:
Metadata
Release files for pybotters 0.17.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pybotters-0.17.0.tar.gz | 44.8 kB | Without provenance | Details for pybotters-0.17.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pybotters-0.17.0-py3-none-any.whl | Python 3 | none | any | Details for pybotters-0.17.0-py3-none-any.whl |
Total release size: 102.8 kB
Release files / pybotters-0.17.0.tar.gz
| Download URL | pybotters-0.17.0.tar.gz |
|---|---|
| Size | 44.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4e5e18a15c095fda3eebe9e28eaf4d90faa454ece9d51ae12f5987ac9531fef
|
|
BLAKE2b-256 checksum How to use checksums |
0a2eaee6cf99c6795ca4d7ddf5065daf8d150053faf9ee0d3f6c6897025c6597
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / pybotters-0.17.0-py3-none-any.whl
| Download URL | pybotters-0.17.0-py3-none-any.whl |
|---|---|
| Size | 58.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd3050ca98bbe8c31a9b7d33a8644ac62112543dad420bdfe5ef8f3fe9dd2f73
|
|
BLAKE2b-256 checksum How to use checksums |
565ecc73ea813f6e7547a0e89d40e7dfc2c6088e1c18f1fc72c5eb11d31c182c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for pybotters 0.17.0
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.