Async trading library based on asyncio
Project description
Introduction
Crypto exchange APIs are often callback-oriented. This makes coding a nightmare and will distract you from your most important goal of developing a winning strategy.
aiotrading is here to solve this problem. Using it, interacting with exchanges will be as much fun as the following example:
from aiotrading import CandleStream
from aiotrading.exchange import BinanceFutures
async with BinanceFutures() as exchange:
async with CandleStream(exchange, 'btcusdt', '3m') as stream:
for i in range(10):
candle = await stream.read()
log.info(candle)
Sample output of this code example is:
connecting to exchange: binance-futures
opening candle stream btcusdt@3m
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.00, l:33789.99, c:33795.18, v:4.164
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.00, l:33789.99, c:33799.76, v:4.481
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.00, l:33789.99, c:33797.73, v:4.741
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.00, l:33789.99, c:33797.47, v:5.132
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.89, l:33789.99, c:33797.39, v:5.520
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.89, l:33789.99, c:33797.38, v:5.605
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33800.89, l:33789.99, c:33797.39, v:6.000
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33807.99, l:33789.99, c:33806.80, v:16.562
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33807.99, l:33789.99, c:33797.70, v:16.590
candle btcusdt, 3m, t:2021-01-30 11:39:00, o:33795.69, h:33807.99, l:33789.99, c:33794.60, v:17.342
closing candle stream btcusdt@3m
disconnecting from exchange: binance-futures
Installation
pip3 install aiotrading
Design Principles
- Thin portable API. Lots of exchanges exist in the wild and developers like to migrate from exchange to exchange with no hassle.
- Easy concurrency. No callbacks as they distract from the goal and introduce errors.
Status
aiotrading is at its early stage of development. It currently supports a subset of Binance exchange API services. More services will be supported in the future. It is designed in a way that other exchanges can be supported easily.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aiotrading-0.0.4.tar.gz
.
File metadata
- Download URL: aiotrading-0.0.4.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e020c8916cdf159bf385403fcf80ef9653adece461150c4e19b8102ce3305168 |
|
MD5 | f5825e10e6db44a8afc5f2b09d8cfc84 |
|
BLAKE2b-256 | 952ac98f83c2e204e83799d1cf5c34a814bc4aaa9ae69f2eeb33ea72b28cfe00 |
File details
Details for the file aiotrading-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: aiotrading-0.0.4-py3-none-any.whl
- Upload date:
- Size: 31.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad52db00889e74a3c6370fa3cf60d36e1f5752be4fe445497ad83e7cef182fcc |
|
MD5 | c972f9cb24fa08464930f9f8f79731c6 |
|
BLAKE2b-256 | 7061043318ce082346baaa78dd6ceeb8d5277c5c8760ad3e740643848257599f |