asynchronous binance client based on asyncio and aiohttp
Project description
asynchronous_binance_client(asyncio and aiohttp)
This is an asynchronous library that is written for using binance services.
You need aiohttp and asyncio for delealing with methods and properties.
1- First instantiate from BinanceFuturesClient:
from binance_aiohttp.client import BinanceFuturesClient
binance_client = BinanceFuturesClient(api_key, secret_key, testnet=False)
2 - Then from aiohttp.ClientSession:
async with aiohttp.ClientSession(json_serialize=ujson.dumps) as session:
3- Finally await methods:
await binance_client.candlestick_data(session, 'BTCUSDT', interval='4h', limit=300)
Example:
import asyncio
import aiohttp
import ujson
from binance_aiohttp.client import BinanceFuturesClient
binance_client = BinanceFuturesClient(api_key, secret_key, testnet=False)
async def fetch():
async with aiohttp.ClientSession(json_serialize=ujson.dumps) as session:
result = await asyncio.create_task(binance_client.candlestick_data(session, 'BTCUSDT', interval='4h', limit=300))
print(result)
asyncio.run(fetch())
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
binance_aiohttp-0.0.5.tar.gz
(6.9 kB
view details)
Built Distribution
File details
Details for the file binance_aiohttp-0.0.5.tar.gz
.
File metadata
- Download URL: binance_aiohttp-0.0.5.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2b05b8f146e519c5de8ee1879de8659d39bf2e6f9a92889c8ae75bb37cd0448 |
|
MD5 | 9252c8f3ae67c8d9c2940954ef225a38 |
|
BLAKE2b-256 | 3bd6122563417e0a40ec924f266edc6c5205c4b47eabcda895a8a32e51948cfd |
File details
Details for the file binance_aiohttp-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: binance_aiohttp-0.0.5-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bf56f408878a6328389ab6815cdbbe0ffe179277e80a745546e27436c118d6a |
|
MD5 | b0b30e629254afaad6eaf8130a7954ea |
|
BLAKE2b-256 | 4de6ad6a8595d5b31b1a5f7d4e6385d18def402883c787a6bc605e4dcab2627f |