Skip to main content

Buenbit API client.

Project description

Python SDK for Buenbit public API

This client library is designed to interact with Buenbit's public API. It can be used to fetch market data, placing orders and manage investments.

Installation

$ pip install buenbit

Getting started

This SDK is build on top of requests-openapi which creates an HTTP client from buenbit's openapi specification. It uses the Python library Requests underneath. The client generates dynamically a method for each API endpoint operation exposed in the spec. You make HTTP requests by doing Python methods calls in the form of client.operation_id(operation_parameters).

from buenbit import BuenbitApiClient
client = BuenbitApiClient.new_with(api_key=<YOUR_API_KEY>, api_secret=<YOUR_API_SECRET>)
response = client.get_investment_status(currency='dai')
response.status_code  # 200
dai_investment_status = response.json()['object']
dai_investment_status  # {'object': {'is_investing': True, 'aggregated_interests': '0.0', ...}, 'errors': []}

To see all defined operations you can do client.operations

Examples

You can find more examples in examples.py

Get market tickers

Get bid/ask prices for each market:

response = client.market_tickers()
response.status_code  # 200
response_json = response.json()  # {"object": {"daiars": {"ask_currency": "ars", "bid_currency":"dai", "purchase_price":"... 
market_tickers = response_json['object']

daiars_market = market_tickers['daiars']
daiars_market['ask_currency']  # 'ars'
daiars_market['bid_currency']  # 'dai'
daiars_market['purchase_price']  # '119.5'
daiars_market['selling_price']  # '124.1'

Place order

Create an order for a market

market_identifier = 'daiars'
volume = '5'
operation = 'buy'

request_body = {'market_identifier': market_identifier, 'volume': volume}
response = self.client.create_order(operation=operation, data=request_body)
response.status_code  # 201
response_json = response.json()  # {'object': {'side': 'buy', 'volume': '5.00', 'created_at': '07/08/2020 18:07',...}, 'errors': []}

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

buenbit-0.0.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

buenbit-0.0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file buenbit-0.0.1.tar.gz.

File metadata

  • Download URL: buenbit-0.0.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.4

File hashes

Hashes for buenbit-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6266c22f19ec2da5b1cff56e49e8ddc12f2b6e6fba40e4a52bfa0d1fced7ce45
MD5 9d86ba02cff28e7480b3616b8779decd
BLAKE2b-256 3c0c757d07d18f4ffeab6f1a7ab6ff9dfc6e1d31a13449d4616cfb8548dc1e3c

See more details on using hashes here.

File details

Details for the file buenbit-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: buenbit-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.4

File hashes

Hashes for buenbit-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7f3ef0ee5dd3ede95c235dd8a8ff49d37d9a47ef967ba89cfb6861cef2b5a2f
MD5 72318a564adf07fa17de4d370598a556
BLAKE2b-256 2012f1e626c982a62d2594f50c83a17568a2b58710ac19e1c5eca89ae61b1e49

See more details on using hashes here.

Supported by

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