connectors ready except gateio

This commit is contained in:
Nicolás Sánchez 2025-01-01 18:12:45 -03:00
parent 50fdb40a62
commit 3941a81998
7 changed files with 28 additions and 45 deletions

View File

@ -60,7 +60,7 @@ class binance_earn:
return None return None
def get_position(self, **kwargs): def get_position(self, coin=None, **kwargs):
''' '''
asset (str, optional) asset (str, optional)
productId (str, optional) productId (str, optional)
@ -70,7 +70,7 @@ class binance_earn:
''' '''
try: try:
response = self.client.get_flexible_product_position(**kwargs) response = self.client.get_flexible_product_position(asset=coin, **kwargs)
return response return response
except ClientError as error: except ClientError as error:
print("Found error. status: {}, error code: {}, error message: {}".format(error.status_code, error.error_code, error.error_message)) print("Found error. status: {}, error code: {}, error message: {}".format(error.status_code, error.error_code, error.error_message))

View File

@ -2,68 +2,51 @@
https://www.gate.io/docs/developers/apiv4/#earnuni 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 from credentials import get_api_key
class gateio_earn: class gateio_earn:
def __init__(self): def __init__(self):
api_key, api_secret = get_api_key("gateio") 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): 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) 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() def get_available_products(self,coin):
return_list = [] return {"Error": "To be implemented"}
for item in currency_list:
if item.to_dict()["currency"] == coin: def get_product_detail(self,coin):
return_list.append(item.to_dict()) return {"Error": "To be implemented"}
return return_list
def subscribe_product(self, coin, amount, rate):
def subscribe_product(self, product_id, amount, auto_subscribe=True, source_account="SPOT"): return {"Error": "To be implemented"}
return None
def redeem_product(self, product_id, redeem_all=True, amount=0, destination_account="SPOT"): 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): def get_position(self, **kwargs):
return None return {"Error": "To be implemented"}
def get_account(self, coin, recv_window=5000): def get_account(self, coin, recv_window=5000):
return_list = [] return {"Error": "To be implemented"}
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
def get_personal_left_quota(self, product_id, **kwargs): def get_personal_left_quota(self, product_id, **kwargs):
return None return {"Error": "To be implemented"}
def get_subscription_record(self, **kwargs): def get_subscription_record(self, **kwargs):
return None return {"Error": "To be implemented"}
def get_redemption_record(self, **kwargs): def get_redemption_record(self, **kwargs):
return None return {"Error": "To be implemented"}
def get_rewards_history(self, type="ALL", **kwargs): def get_rewards_history(self, type="ALL", **kwargs):
return None return {"Error": "To be implemented"}
def get_subscription_preview(self, product_id, amount, **kwargs): def get_subscription_preview(self, product_id, amount, **kwargs):
return None return {"Error": "To be implemented"}

View File

@ -164,20 +164,20 @@ class okx_earn:
def get_personal_left_quota(self, product_id, **kwargs): def get_personal_left_quota(self, product_id, **kwargs):
return None return {"Error": "N/A"}
def get_subscription_record(self, **kwargs): def get_subscription_record(self, **kwargs):
return None return {"Error": "N/A"}
def get_redemption_record(self, **kwargs): def get_redemption_record(self, **kwargs):
return None return {"Error": "N/A"}
def get_rewards_history(self, type="ALL", **kwargs): def get_rewards_history(self, type="ALL", **kwargs):
return None return {"Error": "N/A"}
def get_subscription_preview(self, product_id, amount, **kwargs): def get_subscription_preview(self, product_id, amount, **kwargs):
return None return {"Error": "N/A"}

View File

@ -12,6 +12,6 @@ gateio = earn_gateio.gateio_earn()
if __name__=="__main__": if __name__=="__main__":
#Available products #Available products
print(okx.get_funding_balance("USDT")) print(gateio.get_product_detail("USDT"))