Skip to main content

bitpanda-aio 2.0.2

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


bitpanda-aio is a Python library providing access to Bitpanda Pro API (former Bitpanda Global Exchange). Library implements bitpanda's REST API as well as websockets.

bitpanda-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 complete Bitpanda's REST API (account details, market data, order management, ...) and websockets (account feed, market data feed, orderbook feed, ...)
  • automatic connection management (reconnecting after remote termination, ...)
  • channels bundled in one or multiple websockets processed in parallel
  • lean architecture setting ground for the future extensions and customizations
  • fully asynchronous design aiming for the best performance

Installation

pip install bitpanda-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 bitpanda-aio, it is necessary to take care of downloading your Bitpanda API key from your Bitpanda Pro account.

Examples

REST API

import asyncio
import logging
import datetime

from bitpanda.BitpandaClient import BitpandaClient
from bitpanda.Pair import Pair
from bitpanda.enums import OrderSide, TimeUnit

logger = logging.getLogger("bitpanda")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())

async def run():
	api_key = "<YOUR_API_KEY>"

	client = BitpandaClient(api_key)

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

	print("Account fees:")
	await client.get_account_fees()

	print("Account orders:")
	await client.get_account_orders()

	print("Account order:")
	await client.get_account_order("1")

	print("Create market order:")
	await client.create_market_order(Pair("BTC", "EUR"), OrderSide.BUY, "1")

	print("Create limit order:")
	await client.create_limit_order(Pair("BTC", "EUR"), OrderSide.BUY, "10", "10")

	print("Create stop loss order:")
	await client.create_stop_limit_order(Pair("BTC", "EUR"), OrderSide.BUY, "10", "10", "10")

	print("Delete orders:")
	await client.delete_account_orders(Pair("BTC", "EUR"))

	print("Delete order:")
	await client.delete_account_order("1")

	print("Order trades:")
	await client.get_account_order_trades("1")

	print("Trades:")
	await client.get_account_trades()

	print("Trade:")
	await client.get_account_trade("1")

	print("Trading volume:")
	await client.get_account_trading_volume()

	print("Currencies:")
	await client.get_currencies()

	print("Candlesticks:")
	await client.get_candlesticks(Pair("BTC", "EUR"), TimeUnit.DAYS, "1", datetime.datetime.now() - datetime.timedelta(days=7), datetime.datetime.now())

	print("Fees:")
	await client.get_account_fees()

	print("Instruments:")
	await client.get_instruments()

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

	print("Time:")
	await client.get_time()

	await client.close()

if __name__ == "__main__":
	asyncio.run(run())

WEBSOCKETS

import asyncio
import logging

from bitpanda.BitpandaClient import BitpandaClient
from bitpanda.Pair import Pair
from bitpanda.subscriptions import AccountSubscription, PricesSubscription, OrderbookSubscription, \
	CandlesticksSubscription, MarketTickerSubscription, CandlesticksSubscriptionParams
from bitpanda.enums import TimeUnit

logger = logging.getLogger("bitpanda")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())

async def order_book_update(response : dict) -> None:
	print(f"Callback {order_book_update.__name__}: [{response}]")

async def run():
	api_key = "<YOUR_API_KEY>"

	client = BitpandaClient(api_key)

	# Bundle several subscriptions into a single websocket
	client.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
	client.compose_subscriptions([
		OrderbookSubscription([Pair("ETH", "EUR")], "50", callbacks = [order_book_update]),
	])

	# Execute all websockets asynchronously
	await client.start_subscriptions()

	await client.close()

if __name__ == "__main__":
	asyncio.run(run())

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

  • use Github Issues if it is related to the development, or
  • send an e-mail to

Affiliation

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

Metadata

Release files for bitpanda-aio 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitpanda-aio 2.0.2
File Size Uploaded
bitpanda-aio-2.0.2.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bitpanda-aio 2.0.2
File Interpreter ABI Platform
bitpanda_aio-2.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.3 kB

Release files / bitpanda-aio-2.0.2.tar.gz

Download URL bitpanda-aio-2.0.2.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0ce7340d0a56057ec037b8bf8a1bb06091d5c259440ab1986bccf5a7e36fe6d5
BLAKE2b-256 checksum
How to use checksums
aabdb532e000e60cae90ae346ca42cdd6c9e2c0fb485ee75eebea841ff62c7b5
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / bitpanda_aio-2.0.2-py3-none-any.whl

Download URL bitpanda_aio-2.0.2-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0bf5bbcbc66ab3e1cfd973f451ed61cb52a24b085c06b5f9623dac6ff976ea0
BLAKE2b-256 checksum
How to use checksums
df8d24c7de41c2a2f543b03afa5bfaa8b99f8b7c81e9934bf208b1f65cd51890
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page