diff --git a/libraries/wrappers/__pycache__/earn_binance.cpython-311.pyc b/libraries/wrappers/__pycache__/earn_binance.cpython-311.pyc index 958bd0b..3fed72d 100644 Binary files a/libraries/wrappers/__pycache__/earn_binance.cpython-311.pyc and b/libraries/wrappers/__pycache__/earn_binance.cpython-311.pyc differ diff --git a/libraries/wrappers/__pycache__/earn_gateio.cpython-311.pyc b/libraries/wrappers/__pycache__/earn_gateio.cpython-311.pyc index 4f324ee..e724e5a 100644 Binary files a/libraries/wrappers/__pycache__/earn_gateio.cpython-311.pyc and b/libraries/wrappers/__pycache__/earn_gateio.cpython-311.pyc differ diff --git a/libraries/wrappers/__pycache__/earn_okx.cpython-311.pyc b/libraries/wrappers/__pycache__/earn_okx.cpython-311.pyc index 5211b87..46cbfcd 100644 Binary files a/libraries/wrappers/__pycache__/earn_okx.cpython-311.pyc and b/libraries/wrappers/__pycache__/earn_okx.cpython-311.pyc differ diff --git a/libraries/wrappers/earn_binance.py b/libraries/wrappers/earn_binance.py index b5856dd..9e5f316 100644 --- a/libraries/wrappers/earn_binance.py +++ b/libraries/wrappers/earn_binance.py @@ -60,7 +60,7 @@ class binance_earn: return None - def get_position(self, **kwargs): + def get_position(self, coin=None, **kwargs): ''' asset (str, optional) productId (str, optional) @@ -70,7 +70,7 @@ class binance_earn: ''' try: - response = self.client.get_flexible_product_position(**kwargs) + response = self.client.get_flexible_product_position(asset=coin, **kwargs) return response except ClientError as error: print("Found error. status: {}, error code: {}, error message: {}".format(error.status_code, error.error_code, error.error_message)) diff --git a/libraries/wrappers/earn_gateio.py b/libraries/wrappers/earn_gateio.py index 3ee8e5a..2bdcb39 100644 --- a/libraries/wrappers/earn_gateio.py +++ b/libraries/wrappers/earn_gateio.py @@ -2,68 +2,51 @@ https://www.gate.io/docs/developers/apiv4/#earnuni ''' -from gate_api import ApiClient, Configuration, EarnApi, EarnUniApi +# Implement from scratch, gateio python connector is AWFUL. + from credentials import get_api_key class gateio_earn: def __init__(self): api_key, api_secret = get_api_key("gateio") - config = Configuration(key=api_key, secret=api_secret) - self.earn_api = EarnUniApi(ApiClient(config)) 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) ''' - return 0.0 + return {"Error": "To be implemented"} - def get_available_products(self, coin): - currency_list = self.earn_api.list_uni_currencies() - return_list = [] - for item in currency_list: - if item.to_dict()["currency"] == coin: - return_list.append(item.to_dict()) - return return_list + + def get_available_products(self,coin): + return {"Error": "To be implemented"} + + def get_product_detail(self,coin): + return {"Error": "To be implemented"} - - def subscribe_product(self, product_id, amount, auto_subscribe=True, source_account="SPOT"): - return None - + def subscribe_product(self, coin, amount, rate): + return {"Error": "To be implemented"} def redeem_product(self, product_id, redeem_all=True, amount=0, destination_account="SPOT"): - return None - + return {"Error": "To be implemented"} def get_position(self, **kwargs): - return None - + return {"Error": "To be implemented"} def get_account(self, coin, recv_window=5000): - return_list = [] - earn_list = self.earn_api.list_user_uni_lends() - for item in earn_list: - if item.to_dict["currency"]==coin: - return_list.append(item.to_dict()) - return return_list - + return {"Error": "To be implemented"} def get_personal_left_quota(self, product_id, **kwargs): - return None - + return {"Error": "To be implemented"} def get_subscription_record(self, **kwargs): - return None - - + return {"Error": "To be implemented"} + def get_redemption_record(self, **kwargs): - return None - + return {"Error": "To be implemented"} def get_rewards_history(self, type="ALL", **kwargs): - return None - + return {"Error": "To be implemented"} def get_subscription_preview(self, product_id, amount, **kwargs): - return None - \ No newline at end of file + return {"Error": "To be implemented"} \ No newline at end of file diff --git a/libraries/wrappers/earn_okx.py b/libraries/wrappers/earn_okx.py index 2c16d6d..a2502fb 100644 --- a/libraries/wrappers/earn_okx.py +++ b/libraries/wrappers/earn_okx.py @@ -164,20 +164,20 @@ class okx_earn: def get_personal_left_quota(self, product_id, **kwargs): - return None + return {"Error": "N/A"} def get_subscription_record(self, **kwargs): - return None + return {"Error": "N/A"} def get_redemption_record(self, **kwargs): - return None + return {"Error": "N/A"} def get_rewards_history(self, type="ALL", **kwargs): - return None + return {"Error": "N/A"} def get_subscription_preview(self, product_id, amount, **kwargs): - return None \ No newline at end of file + return {"Error": "N/A"} \ No newline at end of file diff --git a/main.py b/main.py index 14d1613..3db1a07 100644 --- a/main.py +++ b/main.py @@ -12,6 +12,6 @@ gateio = earn_gateio.gateio_earn() if __name__=="__main__": #Available products - print(okx.get_funding_balance("USDT")) + print(gateio.get_product_detail("USDT"))