An advanced api client for python botters.
Project description
[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用の自動データ保管クラス
- 参照渡しによる高速なデータ参照
- 取引所別データモデルの実装
- ✨ Developer Experience
asyncio
ライブラリを利用した非同期プログラミング- 型ヒントのサポート
🏦 Exchanges
Name | API auth | DataStore | API docs |
---|---|---|---|
Bybit | ✅ | ✅ | Official |
Binance | ✅ | ✅(USDⓈ-M) | Official |
FTX | ✅ | ✅ | Official |
Phemex | ✅ | ✅ | Official |
BitMEX | ✅ | ✅ | Official |
bitFlyer | ✅ | ✅ | Official |
GMO Coin | ✅ | ✅ | Official |
Liquid | ✅ | WIP | Official |
bitbank | ✅ | ✅ | Official |
Coincheck | ✅ | ✅ | Official |
🐍 Requires
Python 3.7+
🛠 Installation
pip install pybotters
🔰 Usage
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', ...: ...})
...
📖 Wiki
詳しい利用方法は👉Wikiページへ
現在こちらにに移行中です👉Read the Docs
🗽 License
MIT
💖 Author
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pybotters-0.10.0.tar.gz
(29.7 kB
view hashes)
Built Distribution
pybotters-0.10.0-py3-none-any.whl
(38.6 kB
view hashes)
Close
Hashes for pybotters-0.10.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d930cdcb1f9649db2d8fe46a5c56c321f27447f08eec2b05ffed9fb6205e041 |
|
MD5 | 540c2a8632b887dff6af0e7e69a2cbd2 |
|
BLAKE2b-256 | 84b1718848ca3dd0a9704f64a19ea03c4892d12eceef626d25b00b49d5ba6fc8 |