Skip to main content

Python-buycoin

A python SDK for BuyCoins

Update

New features to be added to SDK includes

  1. Type hinting
  2. NGNT manager and transactions
  3. 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

Metadata

Release files for python-buycoins-sdk 0.0.4

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

Source distribution (sdist)

Source distribution for python-buycoins-sdk 0.0.4
File Size Uploaded Provenance Actions
python-buycoins-sdk-0.0.4.tar.gz 7.0 kB Without provenance Details for python-buycoins-sdk-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-buycoins-sdk 0.0.4
File Interpreter ABI Platform Actions
python_buycoins_sdk-0.0.4-py3-none-any.whl Python 3 none any Details for python_buycoins_sdk-0.0.4-py3-none-any.whl

Total release size: 16.3 kB

Release files / python-buycoins-sdk-0.0.4.tar.gz

Download URL python-buycoins-sdk-0.0.4.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8210425453bc125a32e6b9e573d13bd5ac0d35a3b667e5f985e6e941c0a78ac5
BLAKE2b-256 checksum
How to use checksums
5418f08aba31020fa9d942a08bc3bcefdf3b6169366b032f79582601edb9540c
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / python_buycoins_sdk-0.0.4-py3-none-any.whl

Download URL python_buycoins_sdk-0.0.4-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79d7760b1eb2cf7615081731669eb958de60603d88d9f7685976f90f9e984f2d
BLAKE2b-256 checksum
How to use checksums
0e7ae98c68ecc43facdc16b88fd72897d4928b38ae1aacc2b99133ea96de69ad
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for python-buycoins-sdk 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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