Skip to main content

Bitbay Exchange API python implementation for automated trading

Project description

BitBay REST API for Python3

See full description at https://docs.bitbay.net/v1.0.1-en/reference

Update History

0.1.2 - add webscoket implementations

Installation

  > pip install python-bitbay

Usage

The constructor receive public and private key using to authentication.

from python_bitbay import bitbay

bitbay_client = bitbay.Bitbay(api_key='32345f3f-1b1d-1234-a943-a10b1bddfa1b1', api_secret='4d539fe0-e3b0-4e4e-7c86-70b36aa93d4f')

Public Endpoints

# Get ticker
bitbay_client.get_ticker('BTC-EUR')

# Get orderbook from LSK-PLN market
bitbay_client.get_orderbook('LSK-PLN')

# Get last 10 transactions on BTC-USD market from last 3 minutes
bitbay_client.get_trades('BTC-USD', limit=10, fromTime=1531407461)

# Get 30 minutes candles from last 4 hours
bitbay_client.get_kline(symbol='BTC-PLN', second=1800, fromTime=1544158620, toTime=1544173061)

Private Endpoints

Trading

# Buy 1 Bitcoin for 4000$ on BTC-USD market
bitbay_client.create_order('BTC-USD', amount=1, rate=4000, offerType='buy', mode='limit')      # limit
bitbay_client.create_order('BTC-USD', amount=1, price=100, offerType='buy', mode='market')  # market

# Let's get active offers from every market
bitbay_client.get_active_orders()

# Remove an offer
bitbay_client.cancel_order('BTC-USD', '82ca35da-6eeb-4f30-91bb-165fdcf4d8b2', 'buy', 4000)

# Get our trading fees on BTC-PLN market (default)
bitbay_client.get_config()

# Change default wallets to trade on BTC-USD
bitbay_client.change_config('BTC-USD', first='455b3f25-8d3a-409f-9fe6-8cc40f1ce533', second='455b3f25-8d3a-509f-9fe6-8cc40f1ce542')

Deposit and Withdrawal

# Get our address to deposit cryptocurrency on specified wallet
bitbay_client.get_deposit_address(wallet_id='455b3f25-8d3a-409f-9fe6-8cc40f1ce533')

# Generate new cryptocurrency address on specified wallet
bitbay_client.generate_deposit_address(wallet_id='455b3f25-8d3a-409f-9fe6-8cc40f1ce533', currency='PLN')

# Get all historical addresses from specified wallet
bitbay_client.get_address_history(wallet_id='455b3f25-8d3a-409f-9fe6-8cc40f1ce533')

# Let's send some Bitcoins
bitbay_client.withdraw(wallet_id='455b3f25-8d3a-409f-9fe6-8cc40f1ce533', address='3Qck3sNnAe5YVLe9WDzMp3aK2cgsU7F5Wv', amount=0.5, comment='test')

# Get address to deposit USD
bitbay_client.get_igoria_deposit(symbol='USD')

# Time for withdraw our USD
bitbay_client.fiat_withdraw(wallet_id='455b3f25-8d3a-409f-9fe6-8cc40f1ce655', symbol='USD', { bank_account_number: 'PL82154012872216000073790002', address: '111A/109, 02-707 Warszawa', name: 'Igoria Trade S.A.', title: 'VVVe94d7e43536fVVV', swift: 'EBOSPLPWXXX' }

History

# Get transactions history for buy transactions from BTC-PLN where rate is from 23000 to 25000
bitbay_client.get_trade_transactions(markets=['BTC-PLN'], rateFrom=23000, rateTo=25000, userAction='buy', nextPageCursor='start')

# Get 20 last historical operations on XMR wallets and sort descending by time
bitbay_client.get_operation_transactions(balanceCurrencies=["XMR"], limit="20", sort=[{"order":"DESC","by":"time"}], nextPageCursor="start")

Manage Wallets

# Get balance with list of all wallets
bitbay_client.get_balance()

# Create a new wallet for Bitcoin
bitbay_client.create_wallet(currency='BTC', type='crypto', name='trading')

# Change the wallet name
bitbay_client.change_wallet_name(wallet_id='455b3f25-8d3a-409f-9fe6-8cc40f1ce533', name='arbitration)

# Send some cryptocurrency over our wallets
bitbay_client.internal_transfer(source_id='455b3f25-8d3a-409f-9fe6-8cc40f1ce533', destination_id='455b3f25-8d3a-409f-9fe6-8cc40f1ce534', currency='BTC', funds=0.4)

Donate

If this library helped you out, feel free to donate.

ETH: 0xAbBeE2d8355310Bf61531DD94C086636194A4a54

Update to PYPI

python3 setup.py sdist bdist_wheel
python3 -m twine upload --repository pypi dist/*

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

python-bitbay-0.1.2.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

python_bitbay-0.1.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file python-bitbay-0.1.2.tar.gz.

File metadata

  • Download URL: python-bitbay-0.1.2.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for python-bitbay-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6505c827da626249afbcd2976a0afd670d5a1b1c820a8aeeea74705f701754b0
MD5 577e5740af9cf1dbe3f2259e6245ddd9
BLAKE2b-256 60fd3d4d5fa9a2ec9497f1f6ee96d9e490d9bb69d8b2681ebb6d081d7c5442e7

See more details on using hashes here.

File details

Details for the file python_bitbay-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: python_bitbay-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for python_bitbay-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 96e4a0020e1b40f4c10edd69b46d77306ce3649e390ed6347cb0d8b7fa080633
MD5 2af83e29b217462087b0a8e1dcdddaae
BLAKE2b-256 85b0e36b34b20f9bb0481265a4cf0364300ede15b1cd96d5cbad01eb93067bed

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