Skip to main content

Bitforex asynchronous python client

Project description

bitforex-aio 1.0.1

Announcement:bitforex-aio has been replaced by a new library cryptolib-aio. cryptolib-aio offers the very same functionality as bitforex-aio but on top it provides access to multiple cryptoexchanges and other (mostly technical) new features. You can keep using bitforex-aio but please note no new features/bugfixes will be implemented. We recommend to migrate to cryptolib-aio.


bitforex-aio is a Python library providing access to Bitforex crypto exchange. Library implements Bitforex's REST API as well as websockets.

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

For changes see CHANGELOG.

Features

  • access to full Bitforex's REST API (account details, market data, order management, ...) and websockets
  • channels bundled in one or multiple websockets processed in parallel
  • transparent connection management (automated heartbeats, ...)
  • lean architecture setting ground for the future extensions and customizations
  • fully asynchronous design aiming for the best performance

Installation

pip install bitforex-aio

Prerequisites

Due to dependencies and Python features used by the library please make sure you use Python 3.6 or 3.7.

Before starting using bitforex-aio, it is necessary to take care of downloading your Bitforex API and SECRET key from your Bitforex account.

Examples

REST API

client = BitforexClient(api_key, sec_key)

# REST api calls
print("REST API")

print("\nExchange info:")
await client.get_exchange_info()

print("\nOrder book:")
await client.get_order_book(pair = Pair('ETH', 'BTC'), depth = "1")

print("\nTicker:")
await client.get_ticker(pair = Pair('ETH', 'BTC'))

print("\nSingle fund:")
await client.get_single_fund(currency = "NOBS")

print("\nFunds:")
await client.get_funds()

print("\nTrades:")
await client.get_trades(pair = Pair('ETH', 'BTC'), size = "1")

print("\nCandelsticks:")
await client.get_candlesticks(pair = Pair('ETH', 'BTC'), interval = enums.CandelstickInterval.I_1W, size = "5")

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

print("\nCreate multiple orders:")
await client.create_multi_order(Pair("ETH", "BTC"),
                                orders = [("1", "1", enums.OrderSide.SELL), ("2", "1", enums.OrderSide.SELL)])

print("\nCancel order:")
await client.cancel_order(pair = Pair('ETH', 'BTC'), order_id = "10")

print("\nCancel multiple orders:")
await client.cancel_multi_order(pair = Pair('ETH', 'BTC'), order_ids = ["10", "20"])

print("\nCancel all orders:")
await client.cancel_all_orders(pair = Pair('ETH', 'BTC'))

print("\nGet order:")
await client.get_order(pair = Pair('ETH', 'BTC'), order_id = "1")

print("\nGet orders:")
await client.get_orders(pair = Pair('ETH', 'BTC'), order_ids = ["1", "2"])

print("\nFind orders:")
await client.find_order(pair = Pair('ETH', 'BTC'), state = enums.OrderState.PENDING)

WEBSOCKETS

client = BitforexClient(api_key, sec_key)

client.compose_subscriptions([
    OrderBookSubscription(pair = Pair('ETH', 'BTC'), depth = "0", callbacks = [order_book_update]),
    TradeSubscription(pair = Pair('ETH', 'BTC'), size = "20", callbacks = [trade_update]),
])

# Execute all websockets asynchronously
await client.start_subscriptions()

await client.close()

All examples can be found in client-example/client.py in the GitHub repository.

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

Contact

If you feel you want to get in touch, then please

  • preferably use Github Issues, or
  • send an e-mail to

Affiliation

In case you are interested in an automated trading bot, check out our other project creten.

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

bitforex-aio-1.0.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

bitforex_aio-1.0.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file bitforex-aio-1.0.1.tar.gz.

File metadata

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

File hashes

Hashes for bitforex-aio-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fe1085b48edd2bbbb75cd6d1aa6889cc3ae46bad50646e9df3f92abc2ce0f43e
MD5 5b875e16d2b21c39a313086c8c58c440
BLAKE2b-256 a9ca4ebd53927980c1dd96faeb848cc5bedec6f8a8f76a32ce3b38d025957049

See more details on using hashes here.

File details

Details for the file bitforex_aio-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: bitforex_aio-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 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/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for bitforex_aio-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 80baa8367aa902ccd94b424af9fa9635ae24e43a7d81b00c7f26cb93ee33bba2
MD5 bca9ed33efe2819e0d9e35802c0ec9ec
BLAKE2b-256 51a4fccab6d17acbbd6dc906caada16b45bdff839ac1ba2e80aaf7828bea0373

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