Wallet
The Wallet Page handles the buying, selling, sending and receiving of cryptocurrencies.
To get started with using the Wallet class, import it from the buycoins package:
from buycoins import WalletYou can use the class directly using Wallet().method_name or instantiate the class into a variable and use:
wallet = Wallet()
wallet.method_name(**args)buy_crypto(currency, coin_amount)
This method is used to buy an amount coin_amount of the supplied currency.
Example:
from buycoins import Wallet
wallet = Wallet()
buy_bitcoin = wallet.buy_crypto(currency="bitcoin", coin_amount=0.05)
print(buy_bitcoin)This printed response:
{
"id": "QnV5Y29pbnNQcmljZS05NjNmZTExOS02ZGVhLTRlMDItYTc3NC1lZjViYjk3YWZiNGE=",
"cryptocurrency": "bitcoin",
"status": "processing",
"totalCoinAmount": 0.05,
"side": "buy",
}sell_ crypto(currency, coin_amount)
This method sells an amount coin_amount of the suppliedcurrency at the current BuyCoin's price.
Example:
The printed response:
get_network_fee(currency, coin_amount)
This method calculates and returns the network fee for an amount coin_amount of the supplied currency.
Example:
The response printed:
create_address(currency)
This method creates a wallet address for the given currency.
Example:
The printed response:
send_crypto(currency, coin_amount, address)
This method sends an amountcoin_amountof the specified currency to the supplied address.
Example
The printed response:
Sending cryptocurrencies via the API is currently not supported. You need to contact BuyCoin's support to lift the restriction.
get_balances()
This gets all cryptocurrency balance available to the user.
Example:
The printed response:
Errors
Appropriate error responses are sent in the event of an unsuccessful request or insufficient data to complete or execute requests.
Last updated
Was this helpful?