docstrings

This commit is contained in:
Nicolás Sánchez 2025-01-01 22:28:27 -03:00
parent bc6932a79e
commit 28cd48c7e7
4 changed files with 26 additions and 4 deletions

View File

@ -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"]:

View File

@ -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"}

View File

@ -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"]

View File

@ -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: