Skip to content

Latest commit

 

History

History
762 lines (571 loc) · 28.9 KB

File metadata and controls

762 lines (571 loc) · 28.9 KB

gate_api.EarnUniApi

All URIs are relative to https://api.gateio.ws/api/v4

Method HTTP request Description
list_uni_currencies GET /earn/uni/currencies Query lending currency list
get_uni_currency GET /earn/uni/currencies/{currency} Query single lending currency details
list_user_uni_lends GET /earn/uni/lends Query user's lending order list
create_uni_lend POST /earn/uni/lends Create lending or redemption
change_uni_lend PATCH /earn/uni/lends Amend user lending information
list_uni_lend_records GET /earn/uni/lend_records Query lending transaction records
get_uni_interest GET /earn/uni/interests/{currency} Query user's total interest income for specified currency
list_uni_interest_records GET /earn/uni/interest_records Query user dividend records
get_uni_interest_status GET /earn/uni/interest_status/{currency} Query currency interest compounding status
list_uni_chart GET /earn/uni/chart UniLoan currency annualized trend chart
list_uni_rate GET /earn/uni/rate Currency estimated annualized interest rate

list_uni_currencies

list[UniCurrency] list_uni_currencies()

Query lending currency list

Example

from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.EarnUniApi(api_client)

try:
    # Query lending currency list
    api_response = api_instance.list_uni_currencies()
    print(api_response)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling EarnUniApi->list_uni_currencies: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

list[UniCurrency]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Query successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_uni_currency

UniCurrency get_uni_currency(currency)

Query single lending currency details

Example

from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.EarnUniApi(api_client)
currency = 'btc' # str | Currency

try:
    # Query single lending currency details
    api_response = api_instance.get_uni_currency(currency)
    print(api_response)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling EarnUniApi->get_uni_currency: %s\n" % e)

Parameters

Name Type Description Notes
currency str Currency

Return type

UniCurrency

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Query successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_user_uni_lends

list[UniLend] list_user_uni_lends(currency=currency, page=page, limit=limit)

Query user's lending order list

Example

  • Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure APIv4 key authorization
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4",
    key = "YOU_API_KEY",
    secret = "YOUR_API_SECRET"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.EarnUniApi(api_client)
currency = 'BTC' # str | Query by specified currency name (optional)
page = 1 # int | Page number (optional) (default to 1)
limit = 100 # int | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 (optional) (default to 100)

try:
    # Query user's lending order list
    api_response = api_instance.list_user_uni_lends(currency=currency, page=page, limit=limit)
    print(api_response)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling EarnUniApi->list_user_uni_lends: %s\n" % e)

Parameters

Name Type Description Notes
currency str Query by specified currency name [optional]
page int Page number [optional] [default to 1]
limit int Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 [optional] [default to 100]

Return type

list[UniLend]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Query successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_uni_lend

create_uni_lend(create_uni_lend)

Create lending or redemption

Lending: When lending, a minimum lending rate must be set. After successful lending is determined on an hourly basis, earnings will be calculated based on the determined rate. Earnings for each hour will be settled at the top of the hour. If lending fails due to an excessively high interest rate, no interest will be earned for that hour. If funds are redeemed before the hourly for that hour. Priority: Under the same interest rate, wealth management products created or modified earlier will be prioritized for lending. Redemption: For funds that failed to be lent, redemption will be credited immediately. For funds successfully lent, they are entitled to the earnings for that hour, and redemption will be credited in the next hourly interval. Note: The two minutes before and after the hourly mark are the settlement period, during which lending and redemption are prohibited.

Example

  • Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure APIv4 key authorization
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4",
    key = "YOU_API_KEY",
    secret = "YOUR_API_SECRET"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.EarnUniApi(api_client)
create_uni_lend = gate_api.CreateUniLend() # CreateUniLend | 

try:
    # Create lending or redemption
    api_instance.create_uni_lend(create_uni_lend)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling EarnUniApi->create_uni_lend: %s\n" % e)

Parameters

Name Type Description Notes
create_uni_lend CreateUniLend

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 Operation successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

change_uni_lend

change_uni_lend(patch_uni_lend)

Amend user lending information

Currently only supports amending minimum interest rate (hourly)

Example

  • Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure APIv4 key authorization
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4",
    key = "YOU_API_KEY",
    secret = "YOUR_API_SECRET"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.EarnUniApi(api_client)
patch_uni_lend = gate_api.PatchUniLend() # PatchUniLend | 

try:
    # Amend user lending information
    api_instance.change_uni_lend(patch_uni_lend)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling EarnUniApi->change_uni_lend: %s\n" % e)

Parameters

Name Type Description Notes
patch_uni_lend PatchUniLend

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 Updated successfully -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_uni_lend_records

list[UniLendRecord] list_uni_lend_records(currency=currency, page=page, limit=limit, _from=_from, to=to, type=type)

Query lending transaction records

Example

  • Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure APIv4 key authorization
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4",
    key = "YOU_API_KEY",
    secret = "YOUR_API_SECRET"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.EarnUniApi(api_client)
currency = 'BTC' # str | Query by specified currency name (optional)
page = 1 # int | Page number (optional) (default to 1)
limit = 100 # int | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 (optional) (default to 100)
_from = 1547706332 # int | Start timestamp  Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)
to = 1547706332 # int | Termination Timestamp  Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)
type = 'lend' # str | Operation type: lend - Lend, redeem - Redeem (optional)

try:
    # Query lending transaction records
    api_response = api_instance.list_uni_lend_records(currency=currency, page=page, limit=limit, _from=_from, to=to, type=type)
    print(api_response)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling EarnUniApi->list_uni_lend_records: %s\n" % e)

Parameters

Name Type Description Notes
currency str Query by specified currency name [optional]
page int Page number [optional] [default to 1]
limit int Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 [optional] [default to 100]
_from int Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) [optional]
to int Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp [optional]
type str Operation type: lend - Lend, redeem - Redeem [optional]

Return type

list[UniLendRecord]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Query successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_uni_interest

UniLendInterest get_uni_interest(currency)

Query user's total interest income for specified currency

Example

  • Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure APIv4 key authorization
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4",
    key = "YOU_API_KEY",
    secret = "YOUR_API_SECRET"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.EarnUniApi(api_client)
currency = 'btc' # str | Currency

try:
    # Query user's total interest income for specified currency
    api_response = api_instance.get_uni_interest(currency)
    print(api_response)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling EarnUniApi->get_uni_interest: %s\n" % e)

Parameters

Name Type Description Notes
currency str Currency

Return type

UniLendInterest

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Query successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_uni_interest_records

list[UniInterestRecord] list_uni_interest_records(currency=currency, page=page, limit=limit, _from=_from, to=to)

Query user dividend records

Example

  • Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure APIv4 key authorization
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4",
    key = "YOU_API_KEY",
    secret = "YOUR_API_SECRET"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.EarnUniApi(api_client)
currency = 'BTC' # str | Query by specified currency name (optional)
page = 1 # int | Page number (optional) (default to 1)
limit = 100 # int | Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 (optional) (default to 100)
_from = 1547706332 # int | Start timestamp  Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) (optional)
to = 1547706332 # int | Termination Timestamp  Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)

try:
    # Query user dividend records
    api_response = api_instance.list_uni_interest_records(currency=currency, page=page, limit=limit, _from=_from, to=to)
    print(api_response)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling EarnUniApi->list_uni_interest_records: %s\n" % e)

Parameters

Name Type Description Notes
currency str Query by specified currency name [optional]
page int Page number [optional] [default to 1]
limit int Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 [optional] [default to 100]
_from int Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit) [optional]
to int Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp [optional]

Return type

list[UniInterestRecord]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Query successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_uni_interest_status

UniCurrencyInterest get_uni_interest_status(currency)

Query currency interest compounding status

Example

  • Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure APIv4 key authorization
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4",
    key = "YOU_API_KEY",
    secret = "YOUR_API_SECRET"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.EarnUniApi(api_client)
currency = 'btc' # str | Currency

try:
    # Query currency interest compounding status
    api_response = api_instance.get_uni_interest_status(currency)
    print(api_response)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling EarnUniApi->get_uni_interest_status: %s\n" % e)

Parameters

Name Type Description Notes
currency str Currency

Return type

UniCurrencyInterest

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Query successful -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_uni_chart

list[InlineResponse200] list_uni_chart(_from, to, asset)

UniLoan currency annualized trend chart

Project-Id-Version: GateApiTools 1.0.0 Report-Msgid-Bugs-To: EMAIL@ADDRESS POT-Creation-Date: 2025-07-17 21:35+0800 PO-Revision-Date: 2019-01-02 17:30+0800 Last-Translator: FULL NAME EMAIL@ADDRESS Language: en Language-Team: en L@li.org Plural-Forms: nplurals=2; plural=(n !=1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Generated-By: Babel 2.8.0

Example

  • Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure APIv4 key authorization
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4",
    key = "YOU_API_KEY",
    secret = "YOUR_API_SECRET"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.EarnUniApi(api_client)
_from = 1719763200 # int | Start timestamp in seconds, maximum span 30 days
to = 1722441600 # int | End timestamp in seconds, maximum span 30 days
asset = 'BTC' # str | Currency name

try:
    # UniLoan currency annualized trend chart
    api_response = api_instance.list_uni_chart(_from, to, asset)
    print(api_response)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling EarnUniApi->list_uni_chart: %s\n" % e)

Parameters

Name Type Description Notes
_from int Start timestamp in seconds, maximum span 30 days
to int End timestamp in seconds, maximum span 30 days
asset str Currency name

Return type

list[InlineResponse200]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Project-Id-Version: GateApiTools 1.0.0 Report-Msgid-Bugs-To: EMAIL@ADDRESS POT-Creation-Date: 2025-07-17 21:35+0800 PO-Revision-Date: 2019-01-02 17:30+0800 Last-Translator: FULL NAME <EMAIL@ADDRESS> Language: en Language-Team: en <L@li.org> Plural-Forms: nplurals=2; plural=(n !=1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Generated-By: Babel 2.8.0 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_uni_rate

list[InlineResponse2001] list_uni_rate()

Currency estimated annualized interest rate

Project-Id-Version: GateApiTools 1.0.0 Report-Msgid-Bugs-To: EMAIL@ADDRESS POT-Creation-Date: 2025-07-17 21:35+0800 PO-Revision-Date: 2019-01-02 17:30+0800 Last-Translator: FULL NAME EMAIL@ADDRESS Language: en Language-Team: en L@li.org Plural-Forms: nplurals=2; plural=(n !=1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Generated-By: Babel 2.8.0

Example

  • Api Key Authentication (apiv4):
from __future__ import print_function
import gate_api
from gate_api.exceptions import ApiException, GateApiException
# Defining the host is optional and defaults to https://api.gateio.ws/api/v4
# See configuration.py for a list of all supported configuration parameters.
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure APIv4 key authorization
configuration = gate_api.Configuration(
    host = "https://api.gateio.ws/api/v4",
    key = "YOU_API_KEY",
    secret = "YOUR_API_SECRET"
)

api_client = gate_api.ApiClient(configuration)
# Create an instance of the API class
api_instance = gate_api.EarnUniApi(api_client)

try:
    # Currency estimated annualized interest rate
    api_response = api_instance.list_uni_rate()
    print(api_response)
except GateApiException as ex:
    print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message))
except ApiException as e:
    print("Exception when calling EarnUniApi->list_uni_rate: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

list[InlineResponse2001]

Authorization

apiv4

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Project-Id-Version: GateApiTools 1.0.0 Report-Msgid-Bugs-To: EMAIL@ADDRESS POT-Creation-Date: 2025-07-17 21:35+0800 PO-Revision-Date: 2019-01-02 17:30+0800 Last-Translator: FULL NAME <EMAIL@ADDRESS> Language: en Language-Team: en <L@li.org> Plural-Forms: nplurals=2; plural=(n !=1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Generated-By: Babel 2.8.0 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]