From 28cd48c7e7341b1308dacf411f403d543ef833d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20S=C3=A1nchez?= Date: Wed, 1 Jan 2025 22:28:27 -0300 Subject: [PATCH] docstrings --- libraries/wrappers/earn_binance.py | 5 ++++- libraries/wrappers/earn_gateio.py | 6 +++++- libraries/wrappers/earn_kucoin.py | 6 +++++- libraries/wrappers/earn_okx.py | 13 ++++++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/libraries/wrappers/earn_binance.py b/libraries/wrappers/earn_binance.py index 3195580..2368c4a 100644 --- a/libraries/wrappers/earn_binance.py +++ b/libraries/wrappers/earn_binance.py @@ -14,7 +14,10 @@ class binance_earn: def get_trading_balance(self, coin): ''' - Returns the free available balance of a coin in the trading account (or the equivalent account in the exchange) + Args: + coin (str): The coin to get the balance of + Returns: + dict: The free available balance of the coin in the trading account (or the equivalent account in the exchange) ''' account = self.client.account() for item in account["balances"]: diff --git a/libraries/wrappers/earn_gateio.py b/libraries/wrappers/earn_gateio.py index 9339d2f..e9ff208 100644 --- a/libraries/wrappers/earn_gateio.py +++ b/libraries/wrappers/earn_gateio.py @@ -36,8 +36,12 @@ class gateio_earn: def get_trading_balance(self, coin): ''' - Returns the free available balance of a coin in the trading account (or the equivalent account in the exchange) + Args: + coin (str): The coin to get the balance of + Returns: + dict: The free available balance of the coin in the trading account (or the equivalent account in the exchange) ''' + url = f"/spot/accounts" query_param = "" headers = {"Accept": "application/json", "Content-Type": "application/json"} diff --git a/libraries/wrappers/earn_kucoin.py b/libraries/wrappers/earn_kucoin.py index d4cf826..49b4741 100644 --- a/libraries/wrappers/earn_kucoin.py +++ b/libraries/wrappers/earn_kucoin.py @@ -46,8 +46,12 @@ class kucoin_earn: def get_trading_balance(self, coin): ''' - Returns the free available balance of a coin in the trading account (or the equivalent account in the exchange) + Args: + coin (str): The coin to get the balance of + Returns: + dict: The free available balance of the coin in the trading account (or the equivalent account in the exchange) ''' + request = GetSpotAccountListReqBuilder().set_currency(coin).set_type("trade").build() response = self.account_api().get_spot_account_list(request) balance = response.to_dict()["data"][0]["available"] diff --git a/libraries/wrappers/earn_okx.py b/libraries/wrappers/earn_okx.py index 97721a7..6f34927 100644 --- a/libraries/wrappers/earn_okx.py +++ b/libraries/wrappers/earn_okx.py @@ -21,8 +21,12 @@ class okx_earn: def get_trading_balance(self, coin): ''' - Returns the free available balance of a coin in the trading account (or the equivalent account in the exchange) + Args: + coin (str): The coin to get the balance of + Returns: + dict: The free available balance of the coin in the trading account (or the equivalent account in the exchange) ''' + balances = self.account_api.get_account_balance() for item in balances["data"][0]["details"]: if item["ccy"] == coin: @@ -31,6 +35,13 @@ class okx_earn: def get_funding_balance(self, coin): + ''' + Args: + coin (str): The coin to get the balance of + Returns: + dict: The free available balance of the coin in the funding account (or the equivalent account in the exchange) + ''' + balances = self.funding_api.get_balances() for item in balances["data"]: if item["ccy"] == coin: