69 lines
1.9 KiB
Python
69 lines
1.9 KiB
Python
'''
|
|
https://www.gate.io/docs/developers/apiv4/#earnuni
|
|
'''
|
|
|
|
from gate_api import ApiClient, Configuration, EarnApi, EarnUniApi
|
|
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
|
|
|
|
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 subscribe_product(self, product_id, amount, auto_subscribe=True, source_account="SPOT"):
|
|
return None
|
|
|
|
|
|
def redeem_product(self, product_id, redeem_all=True, amount=0, destination_account="SPOT"):
|
|
return None
|
|
|
|
|
|
def get_position(self, **kwargs):
|
|
return None
|
|
|
|
|
|
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
|
|
|
|
|
|
def get_personal_left_quota(self, product_id, **kwargs):
|
|
return None
|
|
|
|
|
|
def get_subscription_record(self, **kwargs):
|
|
return None
|
|
|
|
|
|
def get_redemption_record(self, **kwargs):
|
|
return None
|
|
|
|
|
|
def get_rewards_history(self, type="ALL", **kwargs):
|
|
return None
|
|
|
|
|
|
def get_subscription_preview(self, product_id, amount, **kwargs):
|
|
return None
|
|
|