Util¶
- exception binanceSpotEasyT.util.CredentialsNotFound[source]¶
Raise this error when the key or the BINANCE_API_SECRET are not found, it does not prevent if the key or the BINANCE_API_SECRET are wrong.
- binanceSpotEasyT.util.get_account(log: supportLibEasyT.log_manager.LogManager, url_base: str, key: str, secret: str) dict[source]¶
This functions returns User’s account information. :param log: The log receives a log handler to be able to log the information :param url_base: url_base is the parameter containing the principal URL to call the endpoint.
There are many kind of url_base, usually one for test and the other for real transaction.
- Parameters
key – It is the key used to authenticate transaction for Binance
secret – It is the secret used to authenticate transaction for Binance
- Returns
The return is a JSON object that contains account information
- binanceSpotEasyT.util.get_price_last(url_base: str, symbol: str) str[source]¶
This function is used to get the last price of a determined symbol, the last price is the most recent one. :param url_base: url_base is the parameter containing the principal URL to call the endpoint.
There are many kind of url_base, usually one for test and the other for real transaction.
- Parameters
symbol – The symbol you want the most recent price.
- Returns
It returns the price in a string format
- binanceSpotEasyT.util.get_symbol_asset_balance(log: supportLibEasyT.log_manager.LogManager, url_base: str, key: str, secret: str, symbol: str) float[source]¶
- Parameters
log – The log receives a log handler to be able to log the information
url_base – url_base is the parameter containing the principal URL to call the endpoint. There are many kind of url_base, usually one for test and the other for real transaction.
key – It is the key used to authenticate transaction for Binance
secret – It is the secret used to authenticate transaction for Binance
symbol – The symbol you want to know how much of that currency you have.
- Returns
A float number with the amount of a specific currency asked for
- binanceSpotEasyT.util.setup_environment(log) -> (<class 'str'>, <class 'str'>, <class 'str'>)[source]¶
This function are responsible to check if the credentials are available, it is used to prevent future problems.
- Parameters
log – Receives the log handler to handle this support function.
- Raises
CredentialsNotFound – This error returns when the key is missing, empty or invalid.
Returns: