Skip to main content

Cryptoexchange asynchronous python client

Project description

cryptoxlib-aio 3.4.0

cryptoxlib-aio is a compact Python library providing access to REST and WEBSOCKET API of selected crypto exchanges.

cryptoxlib-aio is designed as an asynchronous library utilizing modern features of Python and those of supporting asynchronous libraries (mainly aiohttp).

What's new in version 3.4.0

  • new TRADING subscription added into bitpanda. The channel delivers minimal, low-latency updates on user's order changes.
  • new ORDERS subscription added into bitpanda. User can create or cancel orders directly via websocket which provides superior performance to standard REST API.

For the history of changes see CHANGELOG.

Main mission

Today there are numerous existing libraries targeting similar audience as cryptoxlib-aio. In order to achieve the broadest coverage of exchanges the supported API is often limited, the most apparent example being lack of websockets.

The mission of cryptoxlib-aio is to:

  • serve as a single entry point for various crypto exchanges
  • provide full REST API as well as full implementation of exchange's websockets. For free and without subscription plans.

Full support of websockets is the corner stone of cryptoxlib-aio which attempts to set cryptoxlib-aio apart from existing solutions which either do not provide websocket support or do not provide it for free.

You will also find out that our subject of interest are often exchanges not enjoying a seat in the mainstream crypto libraries and this is a way for them to reach developers community.

Disclaimer: By no means we are suggesting that existing libraries are inferior to cryptoxlib-aio, they just appeal to different endusers.

Features

  • access to REST API as well as full support of websockets for selected exchanges (given websockets are provided by the exchange)
  • automatic connection management (reconnecting after remote termination, ...)
  • bundling of channels
  • lean architecture making it straightforward to implement API of a new exchange
  • fully asynchronous design aiming for the best performance

List of supported exchanges

As mentioned earlier, all exchanges listed below include full support for websockets.

Name Docs
aax AAX API
bibox Bibox API
bibox_europe BiboxEurope API
binance Binance API
bitforex Bitforex API
bitpanda Bitpanda Pro API
bitvavo Bitvavo API
btse BTSE API
hitbtc HitBTC API
liquid Liquid API

Unlike REST API which is rather uniform across crypto exchanges websockets are often very exchange-specific and hence very time consuming to implement (which is the reason why they are not offered so broadly). Therefore cryptoxlib-aio comes at the cost of the number of exchanges it covers. This is in line with our ideology quality over quantity.

The list of supported exchanges will grow without any specific pattern, usually driven by personal needs. If there is a high demand for a new exchange/feature to be added, there is a high chance for it to happen (but not guranteed). For business related inquiries concerning customized changes tailored for the client please reach out via e-mail mentioned in the contacts.

Installation

pip install cryptoxlib-aio

In case you want to install the latest version from the repo, use

pip install git+https://github.com/nardew/cryptoxlib-aio.git@master

Examples

BITPANDA
bitpanda = CryptoXLib.create_bitpanda_client(api_key)

print("Account balance:")
await bitpanda.get_account_balances()

print("Order book:")
await bitpanda.get_order_book(Pair("BTC", "EUR"))

print("Create limit order:")
await bitpanda.create_limit_order(Pair("BTC", "EUR"), OrderSide.BUY, "10000", "1")

# Create first bundle of subscriptions
bitpanda.compose_subscriptions([
    AccountSubscription(),
    PricesSubscription([Pair("BTC", "EUR")]),
    OrderbookSubscription([Pair("BTC", "EUR")], "50", callbacks = [order_book_update]),
    CandlesticksSubscription([CandlesticksSubscriptionParams(Pair("BTC", "EUR"), TimeUnit.MINUTES, 1)]),
    MarketTickerSubscription([Pair("BTC", "EUR")])
])

# Bundle another subscriptions into a separate websocket
bitpanda.compose_subscriptions([
    OrderbookSubscription([Pair("ETH", "EUR")], "3", callbacks = [order_book_update]),
])

# Execute all websockets asynchronously
await bitpanda.start_websockets()
BITFOREX
bitforex = CryptoXLib.create_bitforex_client(api_key, sec_key)

print("Order book:")
await bitforex.get_order_book(pair = Pair('ETH', 'BTC'), depth = "1")

print("Create order:")
await bitforex.create_order(Pair("ETH", "BTC"), side = enums.OrderSide.SELL, quantity = "1", price = "1")

# First bundle of subscriptions
bitforex.compose_subscriptions([
    OrderBookSubscription(pair = Pair('ETH', 'BTC'), depth = "0", callbacks = [order_book_update]),
    TradeSubscription(pair = Pair('ETH', 'BTC'), size = "2", callbacks = [trade_update]),
])

# Another bundle of subscriptions
bitforex.compose_subscriptions([
    TickerSubscription(pair = Pair('BTC', 'USDT'), size = "2", interval = enums.CandelstickInterval.I_1MIN, callbacks = [ticker_update]),
    Ticker24hSubscription(pair = Pair('BTC', 'USDT'), callbacks = [ticker24_update])
])

# Execute all websockets asynchronously
await bitforex.start_websockets()

Examples for every exchange can be found in the folder examples.

Contact

  • to report issues, bugs, docu corrections or to propose new features use preferably Github Issues
  • for topics requiring more personal approach feel free to send an e-mail to

Support

If you like the library and you feel like you want to support its further development, enhancements and bugfixing, then it will be of great help and most appreciated if you:

  • file bugs, proposals, pull requests, ...
  • spread the word
  • donate an arbitrary tip
    • BTC: 15JUgVq3YFoPedEj5wgQgvkZRx5HQoKJC4
    • ETH: 0xf29304b6af5831030ba99aceb290a3a2129b993d
    • ADA: DdzFFzCqrhshyLV3wktXFvConETEr9mCfrMo9V3dYz4pz6yNq9PjJusfnn4kzWKQR91pWecEbKoHodPaJzgBHdV2AKeDSfR4sckrEk79
    • XRP: rhVWrjB9EGDeK4zuJ1x2KXSjjSpsDQSaU6 + tag 599790141

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

cryptoxlib-aio-3.4.0.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

cryptoxlib_aio-3.4.0-py3-none-any.whl (57.8 kB view details)

Uploaded Python 3

File details

Details for the file cryptoxlib-aio-3.4.0.tar.gz.

File metadata

  • Download URL: cryptoxlib-aio-3.4.0.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for cryptoxlib-aio-3.4.0.tar.gz
Algorithm Hash digest
SHA256 7ef48e621348cddc0a5289455072df34a63a6f8881aa590f65ff62749efd6724
MD5 93154195614a5b5a73a4ed1a76cb3c07
BLAKE2b-256 4f8e8474dd7d58d782347433f31f21518334156f244d93f09c9568585d36496e

See more details on using hashes here.

File details

Details for the file cryptoxlib_aio-3.4.0-py3-none-any.whl.

File metadata

  • Download URL: cryptoxlib_aio-3.4.0-py3-none-any.whl
  • Upload date:
  • Size: 57.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for cryptoxlib_aio-3.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f5ef5912b785ded36cfebf27c745c159044dbff4260e577bf286070bb53c0ed2
MD5 2b4c37dbccf2c98e55f5701e8056b607
BLAKE2b-256 46b547fcee084751a7ae7ae95f4c2aad2a7e013dec51e51df1a8153784a2b2a2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page