BUYCOINS SDK
Project description
Python-buycoin
A python SDK for BuyCoins
Update
New features to be added to SDK includes
- Type hinting
- NGNT manager and transactions
- Extensive tests
Installations
pip install python-buycoins-sdk
Requirements
Python 3.0+
Documentation
You can view the official documentation for the BuyCoins APi can be found here on the BuyCoins developer portal.
Configuration
Create a .env file and set up authentication as follows:
BUYCOIN_PUBLIC_KEY="<BUYCOIN_PUBLIC_KEY>"
BUYCOIN_SECRET_KEY="<BUYCOIN_SECRET_KEY>"
To get public and private key, follow the process set at here
Usage
Most of the library's functionality lies in the managers.py file which contains all the managers required to perform wallet transactions, peer to peer transactions and NGNT transactions.
The Manager classes handle every direct interaction with the BuyCoins API.
Wallet Transactions
This involves direct purchase, sale, transfer orders of cryptocurrencies and creation of cryptocurrencies addresses A sample use-case
from BuyCoin.objects.wallet import Wallet
from BuyCoin.manager import CustomerWalletManager
# Start a purchase transaction and then assign to manager for initialization
purchase_order = Wallet(operation="buy", cryptocurrency="bitcoin", coin_amount=0.01)
wallet_manager = CustomerWalletManager()
wallet_manager.initialize_transaction(purchase_order)
# To get prices for all cryptocurrencies
print(wallet_manager.get_prices())
# To get prices for a specific cryptocurrency for a side ('buy', 'sell')
print(wallet_manager.get_prices(cryptocurrency="bitcoin", side="buy"))
P2P Transactions
P2P Trading lets you trade cryptocurrencies with other users. If you are not familiar with p2p trading on the Buycoins platform, read about it here
A sample use-case
from BuyCoin.objects.p2p import P2P
from BuyCoin.manager import P2PManager
# To place limit orders
limit_order = P2P(operation="plo", side="buy", coin_amount=0.01, cryptocurrency="bitcoin",
price_type="dynamic", dynamic_exchange_rate=3000)
manager = P2PManager()
manager.initialize_transaction(limit_order)
# to post market orders
market_order = P2P(operation="pmo", side="sell", coin_amount=0.01, cryptocurrency="bitcoin")
manager.initialize_transaction(market_order)
# Get market orders
print(manager.get_market_order())
Custom Queries
If by chance, you need to perform queries outside the already provided ones, it can be done by creating an instance of the concerned transaction manager:
from BuyCoin.manager import CustomerWalletManager
query = """
query {
<query>
}
"""
CustomerWalletManager._perform_request(query=query, variables={})
# Variables are arguments to be passed into the query, if none, specify empty bracket
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
Built Distribution
File details
Details for the file python-buycoins-sdk-0.0.4.tar.gz
.
File metadata
- Download URL: python-buycoins-sdk-0.0.4.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8210425453bc125a32e6b9e573d13bd5ac0d35a3b667e5f985e6e941c0a78ac5 |
|
MD5 | ed8cdb254ff84a6fa87e34683af730c0 |
|
BLAKE2b-256 | 5418f08aba31020fa9d942a08bc3bcefdf3b6169366b032f79582601edb9540c |
File details
Details for the file python_buycoins_sdk-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: python_buycoins_sdk-0.0.4-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79d7760b1eb2cf7615081731669eb958de60603d88d9f7685976f90f9e984f2d |
|
MD5 | 024a06b5ee809373a40b9bd128867d61 |
|
BLAKE2b-256 | 0e7ae98c68ecc43facdc16b88fd72897d4928b38ae1aacc2b99133ea96de69ad |