Python binance API wrapper
Project description
This is an asynchronous Python wrapper for Binance exchange API.
Features
- Implementation of all general, market, spot and websocket endpoints
- Easy to contribute and use
- Fully typed
Installation
pip install -U binance4py
Quick Start
import asyncio
from binance4py import Binance
async def handle_kline(k):
print(k)
async def main():
client = Binance("<API_KEY>", "<API_SECRET>", testnet=True)
async with client:
print(await client.general.server_time())
await client.ws.start()
await client.ws.kline(handle_kline, "btcbusd", "1m")
print(await client.ws.subscriptions())
await client.ws.wait_stop()
asyncio.run(main())
Using a different TLD and Cluster
This example will change all binance urls that support this from https://api.binance.com
to https://api2.binance.jp
client = Binance(
tld="jp",
cluster=2
)
Using a different json dumper/loader
import ujson
client = Binance(
json_dumps=ujson.dumps,
json_loads=ujson.loads
)
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
binance4py-1.0.2.tar.gz
(10.4 kB
view hashes)
Built Distribution
binance4py-1.0.2-py3-none-any.whl
(12.5 kB
view hashes)
Close
Hashes for binance4py-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90b3b9a9ee6372288285356383e9fcc8db58a698d051253705e951f8035c42a7 |
|
MD5 | d8ecf640ee4c4547b5076b1d3423f5e3 |
|
BLAKE2b-256 | 5d30dc15b0cb7c32d5d0fd9333c3ba2690c8a93104588ef7b703d783c952b0c3 |