Skip to content

Latest commit

History

History
2110 lines (1595 loc) · 75.2 KB

File metadata and controls

2110 lines (1595 loc) · 75.2 KB

gate_api.EarnApi

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

MethodHTTP requestDescription
list_dual_investment_plansGET /earn/dual/investment_planDual Investment product list
list_dual_ordersGET /earn/dual/ordersDual Investment order list
place_dual_orderPOST /earn/dual/ordersPlace Dual Investment order
list_dual_balanceGET /earn/dual/balanceDual-Currency Earning Assets
get_dual_order_refund_previewGET /earn/dual/order-refund-previewDual-currency early redemption preview
place_dual_order_refundPOST /earn/dual/order-refundDual-currency order early redemption
modify_dual_order_reinvestPOST /earn/dual/modify-order-reinvestModify dual-currency order reinvest
get_dual_project_recommendGET /earn/dual/project-recommendDual-currency recommended projects
find_coinGET /earn/staking/coinsStaking coins
swap_staking_coinPOST /earn/staking/swapOn-chain token swap for earned coins
order_listGET /earn/staking/order_listList of on-chain coin-earning orders
award_listGET /earn/staking/award_listOn-chain coin-earning dividend records
asset_listGET /earn/staking/assetsOn-chain coin-earning assets
create_auto_invest_planPOST /earn/autoinvest/plans/createCreate auto invest plan
update_auto_invest_planPOST /earn/autoinvest/plans/updateUpdateAuto invest plan
stop_auto_invest_planPOST /earn/autoinvest/plans/stopStopAuto invest plan
add_position_auto_invest_planPOST /earn/autoinvest/plans/add_positionAdd position immediately
list_auto_invest_coinsGET /earn/autoinvest/coinsQueryCurrencies supporting auto invest
get_auto_invest_min_amountPOST /earn/autoinvest/min_invest_amountGet minimum investment amount
list_auto_invest_plan_recordsGET /earn/autoinvest/plans/recordsList plan execution records
list_auto_invest_ordersGET /earn/autoinvest/ordersList plan execution recordsDetails(OrderDetails)
list_auto_invest_configGET /earn/autoinvest/configList investment currency configuration
get_auto_invest_plan_detailGET /earn/autoinvest/plans/detailQueryAuto invest planDetails
list_auto_invest_plansGET /earn/autoinvest/plans/list_infoQueryAuto invest planList
list_earn_fixed_term_productsGET /earn/fixed-term/productGet product list
list_earn_fixed_term_products_by_assetGET /earn/fixed-term/product/{asset}/listGet product list by single currency
list_earn_fixed_term_lendsGET /earn/fixed-term/user/lendSubscription list
create_earn_fixed_term_lendPOST /earn/fixed-term/user/lendSubscription
create_earn_fixed_term_pre_redeemPOST /earn/fixed-term/user/pre-redeemRedeem
list_earn_fixed_term_historyGET /earn/fixed-term/user/historySubscription history

list_dual_investment_plans

list[DualGetPlans] list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)

Dual Investment product list

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=1# int | Financial project ID (optional)coin='BTC'# str | Investment Token (optional)type='call'# str | Type enum: `put` — buy low; `call` — sell high (optional)quote_currency='quote_currency_example'# str | Settlement currency enum: defaults to USDT; GUSD optional (optional)sort='sort_example'# str | Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first (optional)page=1# int | page number (optional)page_size=3# int | Items per page (optional)try:
# Dual Investment product listapi_response=api_instance.list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_investment_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintFinancial project ID[optional]
coinstrInvestment Token[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
quote_currencystrSettlement currency enum: defaults to USDT; GUSD optional[optional]
sortstrSort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first[optional]
pageintpage number[optional]
page_sizeintItems per page[optional]

Return type

list[DualGetPlans]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_dual_orders

list[DualGetOrders] list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)

Dual Investment order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
_from=1740727000# int | Start settlement time (optional)to=1740729000# int | End settlement time (optional)type='put'# str | Type enum: `put` — buy low; `call` — sell high (optional)status='HOLD'# str | Order status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all (optional)coin='BTC'# str | Investment Token (optional)page=1# int | Page number (optional) (default to 1)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Dual Investment order listapi_response=api_instance.list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
_fromintStart settlement time[optional]
tointEnd settlement time[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
statusstrOrder status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all[optional]
coinstrInvestment Token[optional]
pageintPage number[optional] [default to 1]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[DualGetOrders]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order

PlaceDualInvestmentOrder place_dual_order(place_dual_investment_order_params)

Place Dual Investment order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
place_dual_investment_order_params=gate_api.PlaceDualInvestmentOrderParams() # PlaceDualInvestmentOrderParams | try:
# Place Dual Investment orderapi_response=api_instance.place_dual_order(place_dual_investment_order_params)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
place_dual_investment_order_paramsPlaceDualInvestmentOrderParams

Return type

PlaceDualInvestmentOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order placed successfully-

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

list_dual_balance

DualGetBalance list_dual_balance()

Dual-Currency Earning Assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# Dual-Currency Earning Assetsapi_response=api_instance.list_dual_balance()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_balance: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

DualGetBalance

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_dual_order_refund_preview

DualOrderRefundPreview get_dual_order_refund_preview(order_id)

Dual-currency early redemption preview

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_id='9497'# str | Order IDtry:
# Dual-currency early redemption previewapi_response=api_instance.get_dual_order_refund_preview(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_order_refund_preview: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID

Return type

DualOrderRefundPreview

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order_refund

place_dual_order_refund(dual_order_refund_params)

Dual-currency order early redemption

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_order_refund_params=gate_api.DualOrderRefundParams() # DualOrderRefundParams | try:
# Dual-currency order early redemptionapi_instance.place_dual_order_refund(dual_order_refund_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order_refund: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_order_refund_paramsDualOrderRefundParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

modify_dual_order_reinvest

modify_dual_order_reinvest(dual_modify_order_reinvest_params)

Modify dual-currency order reinvest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_modify_order_reinvest_params=gate_api.DualModifyOrderReinvestParams() # DualModifyOrderReinvestParams | try:
# Modify dual-currency order reinvestapi_instance.modify_dual_order_reinvest(dual_modify_order_reinvest_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->modify_dual_order_reinvest: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_modify_order_reinvest_paramsDualModifyOrderReinvestParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

get_dual_project_recommend

list[DualProjectRecommend] get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)

Dual-currency recommended projects

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
mode='normal'# str | Sort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending (optional)coin='ETH'# str | Investment Token (optional)type='call'# str | `call`: sell high; `put`: buy low (optional)history_pids='110656,110652'# str | Comma-separated project IDs to exclude already recommended items (optional)try:
# Dual-currency recommended projectsapi_response=api_instance.get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_project_recommend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
modestrSort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending[optional]
coinstrInvestment Token[optional]
typestr`call`: sell high; `put`: buy low[optional]
history_pidsstrComma-separated project IDs to exclude already recommended items[optional]

Return type

list[DualProjectRecommend]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

find_coin

list[object] find_coin(cointype=cointype)

Staking coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
cointype='cointype_example'# str | Currency type: swap - voucher; lock - locked position; debt - US Treasury bond. (optional)try:
# Staking coinsapi_response=api_instance.find_coin(cointype=cointype)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->find_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
cointypestrCurrency type: swap - voucher; lock - locked position; debt - US Treasury bond.[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

swap_staking_coin

SwapCoinStruct swap_staking_coin(swap_coin)

On-chain token swap for earned coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
swap_coin=gate_api.SwapCoin() # SwapCoin | try:
# On-chain token swap for earned coinsapi_response=api_instance.swap_staking_coin(swap_coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->swap_staking_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
swap_coinSwapCoin

Return type

SwapCoinStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Swap successful-

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

order_list

OrderListStruct order_list(pid=pid, coin=coin, type=type, page=page)

List of on-chain coin-earning orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)type=0# int | Type 0-staking 1-redemption (optional)page=1# int | Page number (optional) (default to 1)try:
# List of on-chain coin-earning ordersapi_response=api_instance.order_list(pid=pid, coin=coin, type=type, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
typeintType 0-staking 1-redemption[optional]
pageintPage number[optional] [default to 1]

Return type

OrderListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

award_list

AwardListStruct award_list(pid=pid, coin=coin, page=page)

On-chain coin-earning dividend records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)page=1# int | Page number (optional) (default to 1)try:
# On-chain coin-earning dividend recordsapi_response=api_instance.award_list(pid=pid, coin=coin, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->award_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
pageintPage number[optional] [default to 1]

Return type

AwardListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

asset_list

list[object] asset_list(coin=coin)

On-chain coin-earning assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
coin='ETH'# str | Currency name (optional)try:
# On-chain coin-earning assetsapi_response=api_instance.asset_list(coin=coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->asset_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
coinstrCurrency name[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

create_auto_invest_plan

AutoInvestPlanCreateResp create_auto_invest_plan(auto_invest_plan_create)

Create auto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_create=gate_api.AutoInvestPlanCreate() # AutoInvestPlanCreate | try:
# Create auto invest planapi_response=api_instance.create_auto_invest_plan(auto_invest_plan_create)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_createAutoInvestPlanCreate

Return type

AutoInvestPlanCreateResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Created successfully-

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

update_auto_invest_plan

update_auto_invest_plan(auto_invest_plan_update)

UpdateAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_update=gate_api.AutoInvestPlanUpdate() # AutoInvestPlanUpdate | try:
# UpdateAuto invest planapi_instance.update_auto_invest_plan(auto_invest_plan_update)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->update_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_updateAutoInvestPlanUpdate

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

stop_auto_invest_plan

stop_auto_invest_plan(auto_invest_plan_stop)

StopAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_stop=gate_api.AutoInvestPlanStop() # AutoInvestPlanStop | try:
# StopAuto invest planapi_instance.stop_auto_invest_plan(auto_invest_plan_stop)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->stop_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_stopAutoInvestPlanStop

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Stopped successfully-

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

add_position_auto_invest_plan

add_position_auto_invest_plan(auto_invest_plan_add_position)

Add position immediately

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_add_position=gate_api.AutoInvestPlanAddPosition() # AutoInvestPlanAddPosition | try:
# Add position immediatelyapi_instance.add_position_auto_invest_plan(auto_invest_plan_add_position)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->add_position_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_add_positionAutoInvestPlanAddPosition

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Add PositionSuccess-

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

list_auto_invest_coins

list[AutoInvestCoinsItem] list_auto_invest_coins(plan_money=plan_money)

QueryCurrencies supporting auto invest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_money='USDT'# str | Pricing currency,Optional: USDT or BTC,Default: USDT (optional)try:
# QueryCurrencies supporting auto investapi_response=api_instance.list_auto_invest_coins(plan_money=plan_money)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_coins: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_moneystrPricing currency,Optional: USDT or BTC,Default: USDT[optional]

Return type

list[AutoInvestCoinsItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_min_amount

AutoInvestMinInvestAmountResp get_auto_invest_min_amount(auto_invest_min_invest_amount)

Get minimum investment amount

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_min_invest_amount=gate_api.AutoInvestMinInvestAmount() # AutoInvestMinInvestAmount | try:
# Get minimum investment amountapi_response=api_instance.get_auto_invest_min_amount(auto_invest_min_invest_amount)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_min_amount: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_min_invest_amountAutoInvestMinInvestAmount

Return type

AutoInvestMinInvestAmountResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plan_records

AutoInvestPlanRecordsResp list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)

List plan execution records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=141378# int | Plan IDpage=1# int | page number (optional)page_size=10# int | Items per page,Maximum 100 (optional)try:
# List plan execution recordsapi_response=api_instance.list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plan_records: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanRecordsResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_orders

list[AutoInvestOrderItem] list_auto_invest_orders(plan_id, record_id)

List plan execution recordsDetails(OrderDetails)

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142583# int | Plan IDrecord_id=1770805384904919# int | Record IDtry:
# List plan execution recordsDetails(OrderDetails)api_response=api_instance.list_auto_invest_orders(plan_id, record_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
record_idintRecord ID

Return type

list[AutoInvestOrderItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_config

list[AutoInvestConfigItem] list_auto_invest_config()

List investment currency configuration

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# List investment currency configurationapi_response=api_instance.list_auto_invest_config()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_config: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[AutoInvestConfigItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_plan_detail

AutoInvestPlanDetail get_auto_invest_plan_detail(plan_id)

QueryAuto invest planDetails

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142609# int | Plan IDtry:
# QueryAuto invest planDetailsapi_response=api_instance.get_auto_invest_plan_detail(plan_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_plan_detail: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID

Return type

AutoInvestPlanDetail

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plans

AutoInvestPlanListInfoResp list_auto_invest_plans(status, page=page, page_size=page_size)

QueryAuto invest planList

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
status='active'# str | Plan status,History history,Active activepage=56# int | page number (optional)page_size=56# int | Items per page,Maximum 100 (optional)try:
# QueryAuto invest planListapi_response=api_instance.list_auto_invest_plans(status, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrPlan status,History history,Active active
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanListInfoResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_earn_fixed_term_products

ListEarnFixedTermProductsResponse list_earn_fixed_term_products(page, limit, asset=asset, type=type)

Get product list

Query fixed-term earn product list. Supports filtering by currency, product type, status, etc. Returns product interest rate, lock-up period, quota, and reward campaign information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
page=1# int | Page numberlimit=100# int | Page sizeasset='USDT'# str | Currency (optional)type=1# int | Product type: 1 for regular, 2 for VIP (optional)try:
# Get product listapi_response=api_instance.list_earn_fixed_term_products(page, limit, asset=asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pageintPage number
limitintPage size
assetstrCurrency[optional]
typeintProduct type: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermProductsResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Product list retrieved successfully-

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

list_earn_fixed_term_products_by_asset

ListEarnFixedTermProductsByAssetResponse list_earn_fixed_term_products_by_asset(asset, type=type)

Get product list by single currency

Sort by product term in ascending order

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
asset='USDT'# str | Currency name, e.g., USDT, BTCtype='1'# str | Product type: \"\" or 1 for regular product list, 2 for VIP product list, 0 for all products (optional)try:
# Get product list by single currencyapi_response=api_instance.list_earn_fixed_term_products_by_asset(asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products_by_asset: %s\n"%e)

Parameters

NameTypeDescriptionNotes
assetstrCurrency name, e.g., USDT, BTC
typestrProduct type: "" or 1 for regular product list, 2 for VIP product list, 0 for all products[optional]

Return type

ListEarnFixedTermProductsByAssetResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Single currency product list retrieved successfully-

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

list_earn_fixed_term_lends

ListEarnFixedTermLendsResponse list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)

Subscription list

Query the user's fixed-term earn subscription order list. Supports filtering by product, currency, order type, etc. Returns order details, earnings, rewards, and interest rate boost coupon information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_type='1'# str | Order type: 1 for current orders, 2 for historical orderspage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id=56# int | Order ID (optional)asset='asset_example'# str | Currency (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription listapi_response=api_instance.list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_lends: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_typestrOrder type: 1 for current orders, 2 for historical orders
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idintOrder ID[optional]
assetstrCurrency[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermLendsResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription order list retrieved successfully-

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

create_earn_fixed_term_lend

CreateEarnFixedTermLendResponse create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)

Subscription

Subscribe to a fixed-term earn product by specifying the product ID and subscription amount. Optionally enable auto-renewal and apply an interest rate boost coupon

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
fixed_term_lend_request=gate_api.FixedTermLendRequest() # FixedTermLendRequest | (optional)try:
# Subscriptionapi_response=api_instance.create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_lend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
fixed_term_lend_requestFixedTermLendRequest[optional]

Return type

CreateEarnFixedTermLendResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription successful-

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

create_earn_fixed_term_pre_redeem

CreateEarnFixedTermPreRedeemResponse create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)

Redeem

Early redemption of a fixed-term earn order, order ID is required

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
earn_fixed_term_pre_redeem_request=gate_api.EarnFixedTermPreRedeemRequest() # EarnFixedTermPreRedeemRequest | (optional)try:
# Redeemapi_response=api_instance.create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_pre_redeem: %s\n"%e)

Parameters

NameTypeDescriptionNotes
earn_fixed_term_pre_redeem_requestEarnFixedTermPreRedeemRequest[optional]

Return type

CreateEarnFixedTermPreRedeemResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

list_earn_fixed_term_history

ListEarnFixedTermHistoryResponse list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)

Subscription history

Query the user's fixed-term earn history records. Supports filtering by type (subscription, redemption, interest, bonus rewards) and time range

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
type='1'# str | 1 for subscription, 2 for redemption, 3 for interest, 4 for bonus rewardpage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id='order_id_example'# str | Order ID (optional)asset='asset_example'# str | Currency (optional)start_at=56# int | Start timestamp (optional)end_at=56# int | End Timestamp (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription historyapi_response=api_instance.list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_history: %s\n"%e)

Parameters

NameTypeDescriptionNotes
typestr1 for subscription, 2 for redemption, 3 for interest, 4 for bonus reward
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idstrOrder ID[optional]
assetstrCurrency[optional]
start_atintStart timestamp[optional]
end_atintEnd Timestamp[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermHistoryResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200History records retrieved successfully-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
gateapi-python/docs/EarnApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
2110 lines (1595 loc) · 75.2 KB

File metadata and controls

2110 lines (1595 loc) · 75.2 KB

gate_api.EarnApi

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

MethodHTTP requestDescription
list_dual_investment_plansGET /earn/dual/investment_planDual Investment product list
list_dual_ordersGET /earn/dual/ordersDual Investment order list
place_dual_orderPOST /earn/dual/ordersPlace Dual Investment order
list_dual_balanceGET /earn/dual/balanceDual-Currency Earning Assets
get_dual_order_refund_previewGET /earn/dual/order-refund-previewDual-currency early redemption preview
place_dual_order_refundPOST /earn/dual/order-refundDual-currency order early redemption
modify_dual_order_reinvestPOST /earn/dual/modify-order-reinvestModify dual-currency order reinvest
get_dual_project_recommendGET /earn/dual/project-recommendDual-currency recommended projects
find_coinGET /earn/staking/coinsStaking coins
swap_staking_coinPOST /earn/staking/swapOn-chain token swap for earned coins
order_listGET /earn/staking/order_listList of on-chain coin-earning orders
award_listGET /earn/staking/award_listOn-chain coin-earning dividend records
asset_listGET /earn/staking/assetsOn-chain coin-earning assets
create_auto_invest_planPOST /earn/autoinvest/plans/createCreate auto invest plan
update_auto_invest_planPOST /earn/autoinvest/plans/updateUpdateAuto invest plan
stop_auto_invest_planPOST /earn/autoinvest/plans/stopStopAuto invest plan
add_position_auto_invest_planPOST /earn/autoinvest/plans/add_positionAdd position immediately
list_auto_invest_coinsGET /earn/autoinvest/coinsQueryCurrencies supporting auto invest
get_auto_invest_min_amountPOST /earn/autoinvest/min_invest_amountGet minimum investment amount
list_auto_invest_plan_recordsGET /earn/autoinvest/plans/recordsList plan execution records
list_auto_invest_ordersGET /earn/autoinvest/ordersList plan execution recordsDetails(OrderDetails)
list_auto_invest_configGET /earn/autoinvest/configList investment currency configuration
get_auto_invest_plan_detailGET /earn/autoinvest/plans/detailQueryAuto invest planDetails
list_auto_invest_plansGET /earn/autoinvest/plans/list_infoQueryAuto invest planList
list_earn_fixed_term_productsGET /earn/fixed-term/productGet product list
list_earn_fixed_term_products_by_assetGET /earn/fixed-term/product/{asset}/listGet product list by single currency
list_earn_fixed_term_lendsGET /earn/fixed-term/user/lendSubscription list
create_earn_fixed_term_lendPOST /earn/fixed-term/user/lendSubscription
create_earn_fixed_term_pre_redeemPOST /earn/fixed-term/user/pre-redeemRedeem
list_earn_fixed_term_historyGET /earn/fixed-term/user/historySubscription history

list_dual_investment_plans

list[DualGetPlans] list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)

Dual Investment product list

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=1# int | Financial project ID (optional)coin='BTC'# str | Investment Token (optional)type='call'# str | Type enum: `put` — buy low; `call` — sell high (optional)quote_currency='quote_currency_example'# str | Settlement currency enum: defaults to USDT; GUSD optional (optional)sort='sort_example'# str | Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first (optional)page=1# int | page number (optional)page_size=3# int | Items per page (optional)try:
# Dual Investment product listapi_response=api_instance.list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_investment_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintFinancial project ID[optional]
coinstrInvestment Token[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
quote_currencystrSettlement currency enum: defaults to USDT; GUSD optional[optional]
sortstrSort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first[optional]
pageintpage number[optional]
page_sizeintItems per page[optional]

Return type

list[DualGetPlans]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_dual_orders

list[DualGetOrders] list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)

Dual Investment order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
_from=1740727000# int | Start settlement time (optional)to=1740729000# int | End settlement time (optional)type='put'# str | Type enum: `put` — buy low; `call` — sell high (optional)status='HOLD'# str | Order status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all (optional)coin='BTC'# str | Investment Token (optional)page=1# int | Page number (optional) (default to 1)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Dual Investment order listapi_response=api_instance.list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
_fromintStart settlement time[optional]
tointEnd settlement time[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
statusstrOrder status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all[optional]
coinstrInvestment Token[optional]
pageintPage number[optional] [default to 1]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[DualGetOrders]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order

PlaceDualInvestmentOrder place_dual_order(place_dual_investment_order_params)

Place Dual Investment order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
place_dual_investment_order_params=gate_api.PlaceDualInvestmentOrderParams() # PlaceDualInvestmentOrderParams | try:
# Place Dual Investment orderapi_response=api_instance.place_dual_order(place_dual_investment_order_params)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
place_dual_investment_order_paramsPlaceDualInvestmentOrderParams

Return type

PlaceDualInvestmentOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order placed successfully-

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

list_dual_balance

DualGetBalance list_dual_balance()

Dual-Currency Earning Assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# Dual-Currency Earning Assetsapi_response=api_instance.list_dual_balance()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_balance: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

DualGetBalance

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_dual_order_refund_preview

DualOrderRefundPreview get_dual_order_refund_preview(order_id)

Dual-currency early redemption preview

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_id='9497'# str | Order IDtry:
# Dual-currency early redemption previewapi_response=api_instance.get_dual_order_refund_preview(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_order_refund_preview: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID

Return type

DualOrderRefundPreview

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order_refund

place_dual_order_refund(dual_order_refund_params)

Dual-currency order early redemption

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_order_refund_params=gate_api.DualOrderRefundParams() # DualOrderRefundParams | try:
# Dual-currency order early redemptionapi_instance.place_dual_order_refund(dual_order_refund_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order_refund: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_order_refund_paramsDualOrderRefundParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

modify_dual_order_reinvest

modify_dual_order_reinvest(dual_modify_order_reinvest_params)

Modify dual-currency order reinvest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_modify_order_reinvest_params=gate_api.DualModifyOrderReinvestParams() # DualModifyOrderReinvestParams | try:
# Modify dual-currency order reinvestapi_instance.modify_dual_order_reinvest(dual_modify_order_reinvest_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->modify_dual_order_reinvest: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_modify_order_reinvest_paramsDualModifyOrderReinvestParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

get_dual_project_recommend

list[DualProjectRecommend] get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)

Dual-currency recommended projects

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
mode='normal'# str | Sort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending (optional)coin='ETH'# str | Investment Token (optional)type='call'# str | `call`: sell high; `put`: buy low (optional)history_pids='110656,110652'# str | Comma-separated project IDs to exclude already recommended items (optional)try:
# Dual-currency recommended projectsapi_response=api_instance.get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_project_recommend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
modestrSort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending[optional]
coinstrInvestment Token[optional]
typestr`call`: sell high; `put`: buy low[optional]
history_pidsstrComma-separated project IDs to exclude already recommended items[optional]

Return type

list[DualProjectRecommend]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

find_coin

list[object] find_coin(cointype=cointype)

Staking coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
cointype='cointype_example'# str | Currency type: swap - voucher; lock - locked position; debt - US Treasury bond. (optional)try:
# Staking coinsapi_response=api_instance.find_coin(cointype=cointype)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->find_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
cointypestrCurrency type: swap - voucher; lock - locked position; debt - US Treasury bond.[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

swap_staking_coin

SwapCoinStruct swap_staking_coin(swap_coin)

On-chain token swap for earned coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
swap_coin=gate_api.SwapCoin() # SwapCoin | try:
# On-chain token swap for earned coinsapi_response=api_instance.swap_staking_coin(swap_coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->swap_staking_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
swap_coinSwapCoin

Return type

SwapCoinStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Swap successful-

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

order_list

OrderListStruct order_list(pid=pid, coin=coin, type=type, page=page)

List of on-chain coin-earning orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)type=0# int | Type 0-staking 1-redemption (optional)page=1# int | Page number (optional) (default to 1)try:
# List of on-chain coin-earning ordersapi_response=api_instance.order_list(pid=pid, coin=coin, type=type, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
typeintType 0-staking 1-redemption[optional]
pageintPage number[optional] [default to 1]

Return type

OrderListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

award_list

AwardListStruct award_list(pid=pid, coin=coin, page=page)

On-chain coin-earning dividend records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)page=1# int | Page number (optional) (default to 1)try:
# On-chain coin-earning dividend recordsapi_response=api_instance.award_list(pid=pid, coin=coin, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->award_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
pageintPage number[optional] [default to 1]

Return type

AwardListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

asset_list

list[object] asset_list(coin=coin)

On-chain coin-earning assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
coin='ETH'# str | Currency name (optional)try:
# On-chain coin-earning assetsapi_response=api_instance.asset_list(coin=coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->asset_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
coinstrCurrency name[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

create_auto_invest_plan

AutoInvestPlanCreateResp create_auto_invest_plan(auto_invest_plan_create)

Create auto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_create=gate_api.AutoInvestPlanCreate() # AutoInvestPlanCreate | try:
# Create auto invest planapi_response=api_instance.create_auto_invest_plan(auto_invest_plan_create)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_createAutoInvestPlanCreate

Return type

AutoInvestPlanCreateResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Created successfully-

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

update_auto_invest_plan

update_auto_invest_plan(auto_invest_plan_update)

UpdateAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_update=gate_api.AutoInvestPlanUpdate() # AutoInvestPlanUpdate | try:
# UpdateAuto invest planapi_instance.update_auto_invest_plan(auto_invest_plan_update)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->update_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_updateAutoInvestPlanUpdate

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

stop_auto_invest_plan

stop_auto_invest_plan(auto_invest_plan_stop)

StopAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_stop=gate_api.AutoInvestPlanStop() # AutoInvestPlanStop | try:
# StopAuto invest planapi_instance.stop_auto_invest_plan(auto_invest_plan_stop)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->stop_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_stopAutoInvestPlanStop

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Stopped successfully-

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

add_position_auto_invest_plan

add_position_auto_invest_plan(auto_invest_plan_add_position)

Add position immediately

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_add_position=gate_api.AutoInvestPlanAddPosition() # AutoInvestPlanAddPosition | try:
# Add position immediatelyapi_instance.add_position_auto_invest_plan(auto_invest_plan_add_position)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->add_position_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_add_positionAutoInvestPlanAddPosition

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Add PositionSuccess-

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

list_auto_invest_coins

list[AutoInvestCoinsItem] list_auto_invest_coins(plan_money=plan_money)

QueryCurrencies supporting auto invest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_money='USDT'# str | Pricing currency,Optional: USDT or BTC,Default: USDT (optional)try:
# QueryCurrencies supporting auto investapi_response=api_instance.list_auto_invest_coins(plan_money=plan_money)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_coins: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_moneystrPricing currency,Optional: USDT or BTC,Default: USDT[optional]

Return type

list[AutoInvestCoinsItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_min_amount

AutoInvestMinInvestAmountResp get_auto_invest_min_amount(auto_invest_min_invest_amount)

Get minimum investment amount

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_min_invest_amount=gate_api.AutoInvestMinInvestAmount() # AutoInvestMinInvestAmount | try:
# Get minimum investment amountapi_response=api_instance.get_auto_invest_min_amount(auto_invest_min_invest_amount)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_min_amount: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_min_invest_amountAutoInvestMinInvestAmount

Return type

AutoInvestMinInvestAmountResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plan_records

AutoInvestPlanRecordsResp list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)

List plan execution records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=141378# int | Plan IDpage=1# int | page number (optional)page_size=10# int | Items per page,Maximum 100 (optional)try:
# List plan execution recordsapi_response=api_instance.list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plan_records: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanRecordsResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_orders

list[AutoInvestOrderItem] list_auto_invest_orders(plan_id, record_id)

List plan execution recordsDetails(OrderDetails)

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142583# int | Plan IDrecord_id=1770805384904919# int | Record IDtry:
# List plan execution recordsDetails(OrderDetails)api_response=api_instance.list_auto_invest_orders(plan_id, record_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
record_idintRecord ID

Return type

list[AutoInvestOrderItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_config

list[AutoInvestConfigItem] list_auto_invest_config()

List investment currency configuration

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# List investment currency configurationapi_response=api_instance.list_auto_invest_config()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_config: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[AutoInvestConfigItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_plan_detail

AutoInvestPlanDetail get_auto_invest_plan_detail(plan_id)

QueryAuto invest planDetails

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142609# int | Plan IDtry:
# QueryAuto invest planDetailsapi_response=api_instance.get_auto_invest_plan_detail(plan_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_plan_detail: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID

Return type

AutoInvestPlanDetail

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plans

AutoInvestPlanListInfoResp list_auto_invest_plans(status, page=page, page_size=page_size)

QueryAuto invest planList

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
status='active'# str | Plan status,History history,Active activepage=56# int | page number (optional)page_size=56# int | Items per page,Maximum 100 (optional)try:
# QueryAuto invest planListapi_response=api_instance.list_auto_invest_plans(status, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrPlan status,History history,Active active
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanListInfoResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_earn_fixed_term_products

ListEarnFixedTermProductsResponse list_earn_fixed_term_products(page, limit, asset=asset, type=type)

Get product list

Query fixed-term earn product list. Supports filtering by currency, product type, status, etc. Returns product interest rate, lock-up period, quota, and reward campaign information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
page=1# int | Page numberlimit=100# int | Page sizeasset='USDT'# str | Currency (optional)type=1# int | Product type: 1 for regular, 2 for VIP (optional)try:
# Get product listapi_response=api_instance.list_earn_fixed_term_products(page, limit, asset=asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pageintPage number
limitintPage size
assetstrCurrency[optional]
typeintProduct type: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermProductsResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Product list retrieved successfully-

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

list_earn_fixed_term_products_by_asset

ListEarnFixedTermProductsByAssetResponse list_earn_fixed_term_products_by_asset(asset, type=type)

Get product list by single currency

Sort by product term in ascending order

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
asset='USDT'# str | Currency name, e.g., USDT, BTCtype='1'# str | Product type: \"\" or 1 for regular product list, 2 for VIP product list, 0 for all products (optional)try:
# Get product list by single currencyapi_response=api_instance.list_earn_fixed_term_products_by_asset(asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products_by_asset: %s\n"%e)

Parameters

NameTypeDescriptionNotes
assetstrCurrency name, e.g., USDT, BTC
typestrProduct type: "" or 1 for regular product list, 2 for VIP product list, 0 for all products[optional]

Return type

ListEarnFixedTermProductsByAssetResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Single currency product list retrieved successfully-

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

list_earn_fixed_term_lends

ListEarnFixedTermLendsResponse list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)

Subscription list

Query the user's fixed-term earn subscription order list. Supports filtering by product, currency, order type, etc. Returns order details, earnings, rewards, and interest rate boost coupon information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_type='1'# str | Order type: 1 for current orders, 2 for historical orderspage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id=56# int | Order ID (optional)asset='asset_example'# str | Currency (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription listapi_response=api_instance.list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_lends: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_typestrOrder type: 1 for current orders, 2 for historical orders
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idintOrder ID[optional]
assetstrCurrency[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermLendsResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription order list retrieved successfully-

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

create_earn_fixed_term_lend

CreateEarnFixedTermLendResponse create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)

Subscription

Subscribe to a fixed-term earn product by specifying the product ID and subscription amount. Optionally enable auto-renewal and apply an interest rate boost coupon

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
fixed_term_lend_request=gate_api.FixedTermLendRequest() # FixedTermLendRequest | (optional)try:
# Subscriptionapi_response=api_instance.create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_lend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
fixed_term_lend_requestFixedTermLendRequest[optional]

Return type

CreateEarnFixedTermLendResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription successful-

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

create_earn_fixed_term_pre_redeem

CreateEarnFixedTermPreRedeemResponse create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)

Redeem

Early redemption of a fixed-term earn order, order ID is required

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
earn_fixed_term_pre_redeem_request=gate_api.EarnFixedTermPreRedeemRequest() # EarnFixedTermPreRedeemRequest | (optional)try:
# Redeemapi_response=api_instance.create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_pre_redeem: %s\n"%e)

Parameters

NameTypeDescriptionNotes
earn_fixed_term_pre_redeem_requestEarnFixedTermPreRedeemRequest[optional]

Return type

CreateEarnFixedTermPreRedeemResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

list_earn_fixed_term_history

ListEarnFixedTermHistoryResponse list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)

Subscription history

Query the user's fixed-term earn history records. Supports filtering by type (subscription, redemption, interest, bonus rewards) and time range

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
type='1'# str | 1 for subscription, 2 for redemption, 3 for interest, 4 for bonus rewardpage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id='order_id_example'# str | Order ID (optional)asset='asset_example'# str | Currency (optional)start_at=56# int | Start timestamp (optional)end_at=56# int | End Timestamp (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription historyapi_response=api_instance.list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_history: %s\n"%e)

Parameters

NameTypeDescriptionNotes
typestr1 for subscription, 2 for redemption, 3 for interest, 4 for bonus reward
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idstrOrder ID[optional]
assetstrCurrency[optional]
start_atintStart timestamp[optional]
end_atintEnd Timestamp[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermHistoryResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200History records retrieved successfully-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' gateapi-python/docs/EarnApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
2110 lines (1595 loc) · 75.2 KB

File metadata and controls

2110 lines (1595 loc) · 75.2 KB

gate_api.EarnApi

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

MethodHTTP requestDescription
list_dual_investment_plansGET /earn/dual/investment_planDual Investment product list
list_dual_ordersGET /earn/dual/ordersDual Investment order list
place_dual_orderPOST /earn/dual/ordersPlace Dual Investment order
list_dual_balanceGET /earn/dual/balanceDual-Currency Earning Assets
get_dual_order_refund_previewGET /earn/dual/order-refund-previewDual-currency early redemption preview
place_dual_order_refundPOST /earn/dual/order-refundDual-currency order early redemption
modify_dual_order_reinvestPOST /earn/dual/modify-order-reinvestModify dual-currency order reinvest
get_dual_project_recommendGET /earn/dual/project-recommendDual-currency recommended projects
find_coinGET /earn/staking/coinsStaking coins
swap_staking_coinPOST /earn/staking/swapOn-chain token swap for earned coins
order_listGET /earn/staking/order_listList of on-chain coin-earning orders
award_listGET /earn/staking/award_listOn-chain coin-earning dividend records
asset_listGET /earn/staking/assetsOn-chain coin-earning assets
create_auto_invest_planPOST /earn/autoinvest/plans/createCreate auto invest plan
update_auto_invest_planPOST /earn/autoinvest/plans/updateUpdateAuto invest plan
stop_auto_invest_planPOST /earn/autoinvest/plans/stopStopAuto invest plan
add_position_auto_invest_planPOST /earn/autoinvest/plans/add_positionAdd position immediately
list_auto_invest_coinsGET /earn/autoinvest/coinsQueryCurrencies supporting auto invest
get_auto_invest_min_amountPOST /earn/autoinvest/min_invest_amountGet minimum investment amount
list_auto_invest_plan_recordsGET /earn/autoinvest/plans/recordsList plan execution records
list_auto_invest_ordersGET /earn/autoinvest/ordersList plan execution recordsDetails(OrderDetails)
list_auto_invest_configGET /earn/autoinvest/configList investment currency configuration
get_auto_invest_plan_detailGET /earn/autoinvest/plans/detailQueryAuto invest planDetails
list_auto_invest_plansGET /earn/autoinvest/plans/list_infoQueryAuto invest planList
list_earn_fixed_term_productsGET /earn/fixed-term/productGet product list
list_earn_fixed_term_products_by_assetGET /earn/fixed-term/product/{asset}/listGet product list by single currency
list_earn_fixed_term_lendsGET /earn/fixed-term/user/lendSubscription list
create_earn_fixed_term_lendPOST /earn/fixed-term/user/lendSubscription
create_earn_fixed_term_pre_redeemPOST /earn/fixed-term/user/pre-redeemRedeem
list_earn_fixed_term_historyGET /earn/fixed-term/user/historySubscription history

list_dual_investment_plans

list[DualGetPlans] list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)

Dual Investment product list

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=1# int | Financial project ID (optional)coin='BTC'# str | Investment Token (optional)type='call'# str | Type enum: `put` — buy low; `call` — sell high (optional)quote_currency='quote_currency_example'# str | Settlement currency enum: defaults to USDT; GUSD optional (optional)sort='sort_example'# str | Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first (optional)page=1# int | page number (optional)page_size=3# int | Items per page (optional)try:
# Dual Investment product listapi_response=api_instance.list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_investment_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintFinancial project ID[optional]
coinstrInvestment Token[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
quote_currencystrSettlement currency enum: defaults to USDT; GUSD optional[optional]
sortstrSort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first[optional]
pageintpage number[optional]
page_sizeintItems per page[optional]

Return type

list[DualGetPlans]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_dual_orders

list[DualGetOrders] list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)

Dual Investment order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
_from=1740727000# int | Start settlement time (optional)to=1740729000# int | End settlement time (optional)type='put'# str | Type enum: `put` — buy low; `call` — sell high (optional)status='HOLD'# str | Order status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all (optional)coin='BTC'# str | Investment Token (optional)page=1# int | Page number (optional) (default to 1)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Dual Investment order listapi_response=api_instance.list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
_fromintStart settlement time[optional]
tointEnd settlement time[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
statusstrOrder status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all[optional]
coinstrInvestment Token[optional]
pageintPage number[optional] [default to 1]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[DualGetOrders]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order

PlaceDualInvestmentOrder place_dual_order(place_dual_investment_order_params)

Place Dual Investment order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
place_dual_investment_order_params=gate_api.PlaceDualInvestmentOrderParams() # PlaceDualInvestmentOrderParams | try:
# Place Dual Investment orderapi_response=api_instance.place_dual_order(place_dual_investment_order_params)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
place_dual_investment_order_paramsPlaceDualInvestmentOrderParams

Return type

PlaceDualInvestmentOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order placed successfully-

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

list_dual_balance

DualGetBalance list_dual_balance()

Dual-Currency Earning Assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# Dual-Currency Earning Assetsapi_response=api_instance.list_dual_balance()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_balance: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

DualGetBalance

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_dual_order_refund_preview

DualOrderRefundPreview get_dual_order_refund_preview(order_id)

Dual-currency early redemption preview

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_id='9497'# str | Order IDtry:
# Dual-currency early redemption previewapi_response=api_instance.get_dual_order_refund_preview(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_order_refund_preview: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID

Return type

DualOrderRefundPreview

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order_refund

place_dual_order_refund(dual_order_refund_params)

Dual-currency order early redemption

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_order_refund_params=gate_api.DualOrderRefundParams() # DualOrderRefundParams | try:
# Dual-currency order early redemptionapi_instance.place_dual_order_refund(dual_order_refund_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order_refund: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_order_refund_paramsDualOrderRefundParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

modify_dual_order_reinvest

modify_dual_order_reinvest(dual_modify_order_reinvest_params)

Modify dual-currency order reinvest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_modify_order_reinvest_params=gate_api.DualModifyOrderReinvestParams() # DualModifyOrderReinvestParams | try:
# Modify dual-currency order reinvestapi_instance.modify_dual_order_reinvest(dual_modify_order_reinvest_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->modify_dual_order_reinvest: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_modify_order_reinvest_paramsDualModifyOrderReinvestParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

get_dual_project_recommend

list[DualProjectRecommend] get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)

Dual-currency recommended projects

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
mode='normal'# str | Sort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending (optional)coin='ETH'# str | Investment Token (optional)type='call'# str | `call`: sell high; `put`: buy low (optional)history_pids='110656,110652'# str | Comma-separated project IDs to exclude already recommended items (optional)try:
# Dual-currency recommended projectsapi_response=api_instance.get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_project_recommend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
modestrSort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending[optional]
coinstrInvestment Token[optional]
typestr`call`: sell high; `put`: buy low[optional]
history_pidsstrComma-separated project IDs to exclude already recommended items[optional]

Return type

list[DualProjectRecommend]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

find_coin

list[object] find_coin(cointype=cointype)

Staking coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
cointype='cointype_example'# str | Currency type: swap - voucher; lock - locked position; debt - US Treasury bond. (optional)try:
# Staking coinsapi_response=api_instance.find_coin(cointype=cointype)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->find_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
cointypestrCurrency type: swap - voucher; lock - locked position; debt - US Treasury bond.[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

swap_staking_coin

SwapCoinStruct swap_staking_coin(swap_coin)

On-chain token swap for earned coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
swap_coin=gate_api.SwapCoin() # SwapCoin | try:
# On-chain token swap for earned coinsapi_response=api_instance.swap_staking_coin(swap_coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->swap_staking_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
swap_coinSwapCoin

Return type

SwapCoinStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Swap successful-

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

order_list

OrderListStruct order_list(pid=pid, coin=coin, type=type, page=page)

List of on-chain coin-earning orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)type=0# int | Type 0-staking 1-redemption (optional)page=1# int | Page number (optional) (default to 1)try:
# List of on-chain coin-earning ordersapi_response=api_instance.order_list(pid=pid, coin=coin, type=type, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
typeintType 0-staking 1-redemption[optional]
pageintPage number[optional] [default to 1]

Return type

OrderListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

award_list

AwardListStruct award_list(pid=pid, coin=coin, page=page)

On-chain coin-earning dividend records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)page=1# int | Page number (optional) (default to 1)try:
# On-chain coin-earning dividend recordsapi_response=api_instance.award_list(pid=pid, coin=coin, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->award_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
pageintPage number[optional] [default to 1]

Return type

AwardListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

asset_list

list[object] asset_list(coin=coin)

On-chain coin-earning assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
coin='ETH'# str | Currency name (optional)try:
# On-chain coin-earning assetsapi_response=api_instance.asset_list(coin=coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->asset_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
coinstrCurrency name[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

create_auto_invest_plan

AutoInvestPlanCreateResp create_auto_invest_plan(auto_invest_plan_create)

Create auto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_create=gate_api.AutoInvestPlanCreate() # AutoInvestPlanCreate | try:
# Create auto invest planapi_response=api_instance.create_auto_invest_plan(auto_invest_plan_create)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_createAutoInvestPlanCreate

Return type

AutoInvestPlanCreateResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Created successfully-

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

update_auto_invest_plan

update_auto_invest_plan(auto_invest_plan_update)

UpdateAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_update=gate_api.AutoInvestPlanUpdate() # AutoInvestPlanUpdate | try:
# UpdateAuto invest planapi_instance.update_auto_invest_plan(auto_invest_plan_update)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->update_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_updateAutoInvestPlanUpdate

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

stop_auto_invest_plan

stop_auto_invest_plan(auto_invest_plan_stop)

StopAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_stop=gate_api.AutoInvestPlanStop() # AutoInvestPlanStop | try:
# StopAuto invest planapi_instance.stop_auto_invest_plan(auto_invest_plan_stop)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->stop_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_stopAutoInvestPlanStop

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Stopped successfully-

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

add_position_auto_invest_plan

add_position_auto_invest_plan(auto_invest_plan_add_position)

Add position immediately

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_add_position=gate_api.AutoInvestPlanAddPosition() # AutoInvestPlanAddPosition | try:
# Add position immediatelyapi_instance.add_position_auto_invest_plan(auto_invest_plan_add_position)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->add_position_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_add_positionAutoInvestPlanAddPosition

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Add PositionSuccess-

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

list_auto_invest_coins

list[AutoInvestCoinsItem] list_auto_invest_coins(plan_money=plan_money)

QueryCurrencies supporting auto invest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_money='USDT'# str | Pricing currency,Optional: USDT or BTC,Default: USDT (optional)try:
# QueryCurrencies supporting auto investapi_response=api_instance.list_auto_invest_coins(plan_money=plan_money)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_coins: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_moneystrPricing currency,Optional: USDT or BTC,Default: USDT[optional]

Return type

list[AutoInvestCoinsItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_min_amount

AutoInvestMinInvestAmountResp get_auto_invest_min_amount(auto_invest_min_invest_amount)

Get minimum investment amount

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_min_invest_amount=gate_api.AutoInvestMinInvestAmount() # AutoInvestMinInvestAmount | try:
# Get minimum investment amountapi_response=api_instance.get_auto_invest_min_amount(auto_invest_min_invest_amount)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_min_amount: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_min_invest_amountAutoInvestMinInvestAmount

Return type

AutoInvestMinInvestAmountResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plan_records

AutoInvestPlanRecordsResp list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)

List plan execution records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=141378# int | Plan IDpage=1# int | page number (optional)page_size=10# int | Items per page,Maximum 100 (optional)try:
# List plan execution recordsapi_response=api_instance.list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plan_records: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanRecordsResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_orders

list[AutoInvestOrderItem] list_auto_invest_orders(plan_id, record_id)

List plan execution recordsDetails(OrderDetails)

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142583# int | Plan IDrecord_id=1770805384904919# int | Record IDtry:
# List plan execution recordsDetails(OrderDetails)api_response=api_instance.list_auto_invest_orders(plan_id, record_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
record_idintRecord ID

Return type

list[AutoInvestOrderItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_config

list[AutoInvestConfigItem] list_auto_invest_config()

List investment currency configuration

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# List investment currency configurationapi_response=api_instance.list_auto_invest_config()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_config: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[AutoInvestConfigItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_plan_detail

AutoInvestPlanDetail get_auto_invest_plan_detail(plan_id)

QueryAuto invest planDetails

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142609# int | Plan IDtry:
# QueryAuto invest planDetailsapi_response=api_instance.get_auto_invest_plan_detail(plan_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_plan_detail: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID

Return type

AutoInvestPlanDetail

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plans

AutoInvestPlanListInfoResp list_auto_invest_plans(status, page=page, page_size=page_size)

QueryAuto invest planList

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
status='active'# str | Plan status,History history,Active activepage=56# int | page number (optional)page_size=56# int | Items per page,Maximum 100 (optional)try:
# QueryAuto invest planListapi_response=api_instance.list_auto_invest_plans(status, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrPlan status,History history,Active active
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanListInfoResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_earn_fixed_term_products

ListEarnFixedTermProductsResponse list_earn_fixed_term_products(page, limit, asset=asset, type=type)

Get product list

Query fixed-term earn product list. Supports filtering by currency, product type, status, etc. Returns product interest rate, lock-up period, quota, and reward campaign information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
page=1# int | Page numberlimit=100# int | Page sizeasset='USDT'# str | Currency (optional)type=1# int | Product type: 1 for regular, 2 for VIP (optional)try:
# Get product listapi_response=api_instance.list_earn_fixed_term_products(page, limit, asset=asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pageintPage number
limitintPage size
assetstrCurrency[optional]
typeintProduct type: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermProductsResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Product list retrieved successfully-

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

list_earn_fixed_term_products_by_asset

ListEarnFixedTermProductsByAssetResponse list_earn_fixed_term_products_by_asset(asset, type=type)

Get product list by single currency

Sort by product term in ascending order

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
asset='USDT'# str | Currency name, e.g., USDT, BTCtype='1'# str | Product type: \"\" or 1 for regular product list, 2 for VIP product list, 0 for all products (optional)try:
# Get product list by single currencyapi_response=api_instance.list_earn_fixed_term_products_by_asset(asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products_by_asset: %s\n"%e)

Parameters

NameTypeDescriptionNotes
assetstrCurrency name, e.g., USDT, BTC
typestrProduct type: "" or 1 for regular product list, 2 for VIP product list, 0 for all products[optional]

Return type

ListEarnFixedTermProductsByAssetResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Single currency product list retrieved successfully-

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

list_earn_fixed_term_lends

ListEarnFixedTermLendsResponse list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)

Subscription list

Query the user's fixed-term earn subscription order list. Supports filtering by product, currency, order type, etc. Returns order details, earnings, rewards, and interest rate boost coupon information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_type='1'# str | Order type: 1 for current orders, 2 for historical orderspage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id=56# int | Order ID (optional)asset='asset_example'# str | Currency (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription listapi_response=api_instance.list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_lends: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_typestrOrder type: 1 for current orders, 2 for historical orders
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idintOrder ID[optional]
assetstrCurrency[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermLendsResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription order list retrieved successfully-

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

create_earn_fixed_term_lend

CreateEarnFixedTermLendResponse create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)

Subscription

Subscribe to a fixed-term earn product by specifying the product ID and subscription amount. Optionally enable auto-renewal and apply an interest rate boost coupon

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
fixed_term_lend_request=gate_api.FixedTermLendRequest() # FixedTermLendRequest | (optional)try:
# Subscriptionapi_response=api_instance.create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_lend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
fixed_term_lend_requestFixedTermLendRequest[optional]

Return type

CreateEarnFixedTermLendResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription successful-

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

create_earn_fixed_term_pre_redeem

CreateEarnFixedTermPreRedeemResponse create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)

Redeem

Early redemption of a fixed-term earn order, order ID is required

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
earn_fixed_term_pre_redeem_request=gate_api.EarnFixedTermPreRedeemRequest() # EarnFixedTermPreRedeemRequest | (optional)try:
# Redeemapi_response=api_instance.create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_pre_redeem: %s\n"%e)

Parameters

NameTypeDescriptionNotes
earn_fixed_term_pre_redeem_requestEarnFixedTermPreRedeemRequest[optional]

Return type

CreateEarnFixedTermPreRedeemResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

list_earn_fixed_term_history

ListEarnFixedTermHistoryResponse list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)

Subscription history

Query the user's fixed-term earn history records. Supports filtering by type (subscription, redemption, interest, bonus rewards) and time range

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
type='1'# str | 1 for subscription, 2 for redemption, 3 for interest, 4 for bonus rewardpage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id='order_id_example'# str | Order ID (optional)asset='asset_example'# str | Currency (optional)start_at=56# int | Start timestamp (optional)end_at=56# int | End Timestamp (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription historyapi_response=api_instance.list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_history: %s\n"%e)

Parameters

NameTypeDescriptionNotes
typestr1 for subscription, 2 for redemption, 3 for interest, 4 for bonus reward
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idstrOrder ID[optional]
assetstrCurrency[optional]
start_atintStart timestamp[optional]
end_atintEnd Timestamp[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermHistoryResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200History records retrieved successfully-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' gateapi-python/docs/EarnApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
2110 lines (1595 loc) · 75.2 KB

File metadata and controls

2110 lines (1595 loc) · 75.2 KB

gate_api.EarnApi

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

MethodHTTP requestDescription
list_dual_investment_plansGET /earn/dual/investment_planDual Investment product list
list_dual_ordersGET /earn/dual/ordersDual Investment order list
place_dual_orderPOST /earn/dual/ordersPlace Dual Investment order
list_dual_balanceGET /earn/dual/balanceDual-Currency Earning Assets
get_dual_order_refund_previewGET /earn/dual/order-refund-previewDual-currency early redemption preview
place_dual_order_refundPOST /earn/dual/order-refundDual-currency order early redemption
modify_dual_order_reinvestPOST /earn/dual/modify-order-reinvestModify dual-currency order reinvest
get_dual_project_recommendGET /earn/dual/project-recommendDual-currency recommended projects
find_coinGET /earn/staking/coinsStaking coins
swap_staking_coinPOST /earn/staking/swapOn-chain token swap for earned coins
order_listGET /earn/staking/order_listList of on-chain coin-earning orders
award_listGET /earn/staking/award_listOn-chain coin-earning dividend records
asset_listGET /earn/staking/assetsOn-chain coin-earning assets
create_auto_invest_planPOST /earn/autoinvest/plans/createCreate auto invest plan
update_auto_invest_planPOST /earn/autoinvest/plans/updateUpdateAuto invest plan
stop_auto_invest_planPOST /earn/autoinvest/plans/stopStopAuto invest plan
add_position_auto_invest_planPOST /earn/autoinvest/plans/add_positionAdd position immediately
list_auto_invest_coinsGET /earn/autoinvest/coinsQueryCurrencies supporting auto invest
get_auto_invest_min_amountPOST /earn/autoinvest/min_invest_amountGet minimum investment amount
list_auto_invest_plan_recordsGET /earn/autoinvest/plans/recordsList plan execution records
list_auto_invest_ordersGET /earn/autoinvest/ordersList plan execution recordsDetails(OrderDetails)
list_auto_invest_configGET /earn/autoinvest/configList investment currency configuration
get_auto_invest_plan_detailGET /earn/autoinvest/plans/detailQueryAuto invest planDetails
list_auto_invest_plansGET /earn/autoinvest/plans/list_infoQueryAuto invest planList
list_earn_fixed_term_productsGET /earn/fixed-term/productGet product list
list_earn_fixed_term_products_by_assetGET /earn/fixed-term/product/{asset}/listGet product list by single currency
list_earn_fixed_term_lendsGET /earn/fixed-term/user/lendSubscription list
create_earn_fixed_term_lendPOST /earn/fixed-term/user/lendSubscription
create_earn_fixed_term_pre_redeemPOST /earn/fixed-term/user/pre-redeemRedeem
list_earn_fixed_term_historyGET /earn/fixed-term/user/historySubscription history

list_dual_investment_plans

list[DualGetPlans] list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)

Dual Investment product list

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=1# int | Financial project ID (optional)coin='BTC'# str | Investment Token (optional)type='call'# str | Type enum: `put` — buy low; `call` — sell high (optional)quote_currency='quote_currency_example'# str | Settlement currency enum: defaults to USDT; GUSD optional (optional)sort='sort_example'# str | Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first (optional)page=1# int | page number (optional)page_size=3# int | Items per page (optional)try:
# Dual Investment product listapi_response=api_instance.list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_investment_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintFinancial project ID[optional]
coinstrInvestment Token[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
quote_currencystrSettlement currency enum: defaults to USDT; GUSD optional[optional]
sortstrSort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first[optional]
pageintpage number[optional]
page_sizeintItems per page[optional]

Return type

list[DualGetPlans]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_dual_orders

list[DualGetOrders] list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)

Dual Investment order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
_from=1740727000# int | Start settlement time (optional)to=1740729000# int | End settlement time (optional)type='put'# str | Type enum: `put` — buy low; `call` — sell high (optional)status='HOLD'# str | Order status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all (optional)coin='BTC'# str | Investment Token (optional)page=1# int | Page number (optional) (default to 1)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Dual Investment order listapi_response=api_instance.list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
_fromintStart settlement time[optional]
tointEnd settlement time[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
statusstrOrder status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all[optional]
coinstrInvestment Token[optional]
pageintPage number[optional] [default to 1]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[DualGetOrders]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order

PlaceDualInvestmentOrder place_dual_order(place_dual_investment_order_params)

Place Dual Investment order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
place_dual_investment_order_params=gate_api.PlaceDualInvestmentOrderParams() # PlaceDualInvestmentOrderParams | try:
# Place Dual Investment orderapi_response=api_instance.place_dual_order(place_dual_investment_order_params)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
place_dual_investment_order_paramsPlaceDualInvestmentOrderParams

Return type

PlaceDualInvestmentOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order placed successfully-

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

list_dual_balance

DualGetBalance list_dual_balance()

Dual-Currency Earning Assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# Dual-Currency Earning Assetsapi_response=api_instance.list_dual_balance()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_balance: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

DualGetBalance

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_dual_order_refund_preview

DualOrderRefundPreview get_dual_order_refund_preview(order_id)

Dual-currency early redemption preview

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_id='9497'# str | Order IDtry:
# Dual-currency early redemption previewapi_response=api_instance.get_dual_order_refund_preview(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_order_refund_preview: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID

Return type

DualOrderRefundPreview

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order_refund

place_dual_order_refund(dual_order_refund_params)

Dual-currency order early redemption

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_order_refund_params=gate_api.DualOrderRefundParams() # DualOrderRefundParams | try:
# Dual-currency order early redemptionapi_instance.place_dual_order_refund(dual_order_refund_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order_refund: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_order_refund_paramsDualOrderRefundParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

modify_dual_order_reinvest

modify_dual_order_reinvest(dual_modify_order_reinvest_params)

Modify dual-currency order reinvest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_modify_order_reinvest_params=gate_api.DualModifyOrderReinvestParams() # DualModifyOrderReinvestParams | try:
# Modify dual-currency order reinvestapi_instance.modify_dual_order_reinvest(dual_modify_order_reinvest_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->modify_dual_order_reinvest: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_modify_order_reinvest_paramsDualModifyOrderReinvestParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

get_dual_project_recommend

list[DualProjectRecommend] get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)

Dual-currency recommended projects

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
mode='normal'# str | Sort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending (optional)coin='ETH'# str | Investment Token (optional)type='call'# str | `call`: sell high; `put`: buy low (optional)history_pids='110656,110652'# str | Comma-separated project IDs to exclude already recommended items (optional)try:
# Dual-currency recommended projectsapi_response=api_instance.get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_project_recommend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
modestrSort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending[optional]
coinstrInvestment Token[optional]
typestr`call`: sell high; `put`: buy low[optional]
history_pidsstrComma-separated project IDs to exclude already recommended items[optional]

Return type

list[DualProjectRecommend]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

find_coin

list[object] find_coin(cointype=cointype)

Staking coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
cointype='cointype_example'# str | Currency type: swap - voucher; lock - locked position; debt - US Treasury bond. (optional)try:
# Staking coinsapi_response=api_instance.find_coin(cointype=cointype)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->find_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
cointypestrCurrency type: swap - voucher; lock - locked position; debt - US Treasury bond.[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

swap_staking_coin

SwapCoinStruct swap_staking_coin(swap_coin)

On-chain token swap for earned coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
swap_coin=gate_api.SwapCoin() # SwapCoin | try:
# On-chain token swap for earned coinsapi_response=api_instance.swap_staking_coin(swap_coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->swap_staking_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
swap_coinSwapCoin

Return type

SwapCoinStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Swap successful-

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

order_list

OrderListStruct order_list(pid=pid, coin=coin, type=type, page=page)

List of on-chain coin-earning orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)type=0# int | Type 0-staking 1-redemption (optional)page=1# int | Page number (optional) (default to 1)try:
# List of on-chain coin-earning ordersapi_response=api_instance.order_list(pid=pid, coin=coin, type=type, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
typeintType 0-staking 1-redemption[optional]
pageintPage number[optional] [default to 1]

Return type

OrderListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

award_list

AwardListStruct award_list(pid=pid, coin=coin, page=page)

On-chain coin-earning dividend records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)page=1# int | Page number (optional) (default to 1)try:
# On-chain coin-earning dividend recordsapi_response=api_instance.award_list(pid=pid, coin=coin, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->award_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
pageintPage number[optional] [default to 1]

Return type

AwardListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

asset_list

list[object] asset_list(coin=coin)

On-chain coin-earning assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
coin='ETH'# str | Currency name (optional)try:
# On-chain coin-earning assetsapi_response=api_instance.asset_list(coin=coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->asset_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
coinstrCurrency name[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

create_auto_invest_plan

AutoInvestPlanCreateResp create_auto_invest_plan(auto_invest_plan_create)

Create auto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_create=gate_api.AutoInvestPlanCreate() # AutoInvestPlanCreate | try:
# Create auto invest planapi_response=api_instance.create_auto_invest_plan(auto_invest_plan_create)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_createAutoInvestPlanCreate

Return type

AutoInvestPlanCreateResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Created successfully-

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

update_auto_invest_plan

update_auto_invest_plan(auto_invest_plan_update)

UpdateAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_update=gate_api.AutoInvestPlanUpdate() # AutoInvestPlanUpdate | try:
# UpdateAuto invest planapi_instance.update_auto_invest_plan(auto_invest_plan_update)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->update_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_updateAutoInvestPlanUpdate

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

stop_auto_invest_plan

stop_auto_invest_plan(auto_invest_plan_stop)

StopAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_stop=gate_api.AutoInvestPlanStop() # AutoInvestPlanStop | try:
# StopAuto invest planapi_instance.stop_auto_invest_plan(auto_invest_plan_stop)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->stop_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_stopAutoInvestPlanStop

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Stopped successfully-

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

add_position_auto_invest_plan

add_position_auto_invest_plan(auto_invest_plan_add_position)

Add position immediately

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_add_position=gate_api.AutoInvestPlanAddPosition() # AutoInvestPlanAddPosition | try:
# Add position immediatelyapi_instance.add_position_auto_invest_plan(auto_invest_plan_add_position)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->add_position_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_add_positionAutoInvestPlanAddPosition

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Add PositionSuccess-

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

list_auto_invest_coins

list[AutoInvestCoinsItem] list_auto_invest_coins(plan_money=plan_money)

QueryCurrencies supporting auto invest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_money='USDT'# str | Pricing currency,Optional: USDT or BTC,Default: USDT (optional)try:
# QueryCurrencies supporting auto investapi_response=api_instance.list_auto_invest_coins(plan_money=plan_money)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_coins: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_moneystrPricing currency,Optional: USDT or BTC,Default: USDT[optional]

Return type

list[AutoInvestCoinsItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_min_amount

AutoInvestMinInvestAmountResp get_auto_invest_min_amount(auto_invest_min_invest_amount)

Get minimum investment amount

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_min_invest_amount=gate_api.AutoInvestMinInvestAmount() # AutoInvestMinInvestAmount | try:
# Get minimum investment amountapi_response=api_instance.get_auto_invest_min_amount(auto_invest_min_invest_amount)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_min_amount: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_min_invest_amountAutoInvestMinInvestAmount

Return type

AutoInvestMinInvestAmountResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plan_records

AutoInvestPlanRecordsResp list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)

List plan execution records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=141378# int | Plan IDpage=1# int | page number (optional)page_size=10# int | Items per page,Maximum 100 (optional)try:
# List plan execution recordsapi_response=api_instance.list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plan_records: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanRecordsResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_orders

list[AutoInvestOrderItem] list_auto_invest_orders(plan_id, record_id)

List plan execution recordsDetails(OrderDetails)

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142583# int | Plan IDrecord_id=1770805384904919# int | Record IDtry:
# List plan execution recordsDetails(OrderDetails)api_response=api_instance.list_auto_invest_orders(plan_id, record_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
record_idintRecord ID

Return type

list[AutoInvestOrderItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_config

list[AutoInvestConfigItem] list_auto_invest_config()

List investment currency configuration

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# List investment currency configurationapi_response=api_instance.list_auto_invest_config()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_config: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[AutoInvestConfigItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_plan_detail

AutoInvestPlanDetail get_auto_invest_plan_detail(plan_id)

QueryAuto invest planDetails

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142609# int | Plan IDtry:
# QueryAuto invest planDetailsapi_response=api_instance.get_auto_invest_plan_detail(plan_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_plan_detail: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID

Return type

AutoInvestPlanDetail

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plans

AutoInvestPlanListInfoResp list_auto_invest_plans(status, page=page, page_size=page_size)

QueryAuto invest planList

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
status='active'# str | Plan status,History history,Active activepage=56# int | page number (optional)page_size=56# int | Items per page,Maximum 100 (optional)try:
# QueryAuto invest planListapi_response=api_instance.list_auto_invest_plans(status, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrPlan status,History history,Active active
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanListInfoResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_earn_fixed_term_products

ListEarnFixedTermProductsResponse list_earn_fixed_term_products(page, limit, asset=asset, type=type)

Get product list

Query fixed-term earn product list. Supports filtering by currency, product type, status, etc. Returns product interest rate, lock-up period, quota, and reward campaign information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
page=1# int | Page numberlimit=100# int | Page sizeasset='USDT'# str | Currency (optional)type=1# int | Product type: 1 for regular, 2 for VIP (optional)try:
# Get product listapi_response=api_instance.list_earn_fixed_term_products(page, limit, asset=asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pageintPage number
limitintPage size
assetstrCurrency[optional]
typeintProduct type: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermProductsResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Product list retrieved successfully-

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

list_earn_fixed_term_products_by_asset

ListEarnFixedTermProductsByAssetResponse list_earn_fixed_term_products_by_asset(asset, type=type)

Get product list by single currency

Sort by product term in ascending order

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
asset='USDT'# str | Currency name, e.g., USDT, BTCtype='1'# str | Product type: \"\" or 1 for regular product list, 2 for VIP product list, 0 for all products (optional)try:
# Get product list by single currencyapi_response=api_instance.list_earn_fixed_term_products_by_asset(asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products_by_asset: %s\n"%e)

Parameters

NameTypeDescriptionNotes
assetstrCurrency name, e.g., USDT, BTC
typestrProduct type: "" or 1 for regular product list, 2 for VIP product list, 0 for all products[optional]

Return type

ListEarnFixedTermProductsByAssetResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Single currency product list retrieved successfully-

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

list_earn_fixed_term_lends

ListEarnFixedTermLendsResponse list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)

Subscription list

Query the user's fixed-term earn subscription order list. Supports filtering by product, currency, order type, etc. Returns order details, earnings, rewards, and interest rate boost coupon information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_type='1'# str | Order type: 1 for current orders, 2 for historical orderspage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id=56# int | Order ID (optional)asset='asset_example'# str | Currency (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription listapi_response=api_instance.list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_lends: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_typestrOrder type: 1 for current orders, 2 for historical orders
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idintOrder ID[optional]
assetstrCurrency[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermLendsResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription order list retrieved successfully-

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

create_earn_fixed_term_lend

CreateEarnFixedTermLendResponse create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)

Subscription

Subscribe to a fixed-term earn product by specifying the product ID and subscription amount. Optionally enable auto-renewal and apply an interest rate boost coupon

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
fixed_term_lend_request=gate_api.FixedTermLendRequest() # FixedTermLendRequest | (optional)try:
# Subscriptionapi_response=api_instance.create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_lend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
fixed_term_lend_requestFixedTermLendRequest[optional]

Return type

CreateEarnFixedTermLendResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription successful-

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

create_earn_fixed_term_pre_redeem

CreateEarnFixedTermPreRedeemResponse create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)

Redeem

Early redemption of a fixed-term earn order, order ID is required

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
earn_fixed_term_pre_redeem_request=gate_api.EarnFixedTermPreRedeemRequest() # EarnFixedTermPreRedeemRequest | (optional)try:
# Redeemapi_response=api_instance.create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_pre_redeem: %s\n"%e)

Parameters

NameTypeDescriptionNotes
earn_fixed_term_pre_redeem_requestEarnFixedTermPreRedeemRequest[optional]

Return type

CreateEarnFixedTermPreRedeemResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

list_earn_fixed_term_history

ListEarnFixedTermHistoryResponse list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)

Subscription history

Query the user's fixed-term earn history records. Supports filtering by type (subscription, redemption, interest, bonus rewards) and time range

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
type='1'# str | 1 for subscription, 2 for redemption, 3 for interest, 4 for bonus rewardpage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id='order_id_example'# str | Order ID (optional)asset='asset_example'# str | Currency (optional)start_at=56# int | Start timestamp (optional)end_at=56# int | End Timestamp (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription historyapi_response=api_instance.list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_history: %s\n"%e)

Parameters

NameTypeDescriptionNotes
typestr1 for subscription, 2 for redemption, 3 for interest, 4 for bonus reward
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idstrOrder ID[optional]
assetstrCurrency[optional]
start_atintStart timestamp[optional]
end_atintEnd Timestamp[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermHistoryResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200History records retrieved successfully-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' gateapi-python/docs/EarnApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
2110 lines (1595 loc) · 75.2 KB

File metadata and controls

2110 lines (1595 loc) · 75.2 KB

gate_api.EarnApi

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

MethodHTTP requestDescription
list_dual_investment_plansGET /earn/dual/investment_planDual Investment product list
list_dual_ordersGET /earn/dual/ordersDual Investment order list
place_dual_orderPOST /earn/dual/ordersPlace Dual Investment order
list_dual_balanceGET /earn/dual/balanceDual-Currency Earning Assets
get_dual_order_refund_previewGET /earn/dual/order-refund-previewDual-currency early redemption preview
place_dual_order_refundPOST /earn/dual/order-refundDual-currency order early redemption
modify_dual_order_reinvestPOST /earn/dual/modify-order-reinvestModify dual-currency order reinvest
get_dual_project_recommendGET /earn/dual/project-recommendDual-currency recommended projects
find_coinGET /earn/staking/coinsStaking coins
swap_staking_coinPOST /earn/staking/swapOn-chain token swap for earned coins
order_listGET /earn/staking/order_listList of on-chain coin-earning orders
award_listGET /earn/staking/award_listOn-chain coin-earning dividend records
asset_listGET /earn/staking/assetsOn-chain coin-earning assets
create_auto_invest_planPOST /earn/autoinvest/plans/createCreate auto invest plan
update_auto_invest_planPOST /earn/autoinvest/plans/updateUpdateAuto invest plan
stop_auto_invest_planPOST /earn/autoinvest/plans/stopStopAuto invest plan
add_position_auto_invest_planPOST /earn/autoinvest/plans/add_positionAdd position immediately
list_auto_invest_coinsGET /earn/autoinvest/coinsQueryCurrencies supporting auto invest
get_auto_invest_min_amountPOST /earn/autoinvest/min_invest_amountGet minimum investment amount
list_auto_invest_plan_recordsGET /earn/autoinvest/plans/recordsList plan execution records
list_auto_invest_ordersGET /earn/autoinvest/ordersList plan execution recordsDetails(OrderDetails)
list_auto_invest_configGET /earn/autoinvest/configList investment currency configuration
get_auto_invest_plan_detailGET /earn/autoinvest/plans/detailQueryAuto invest planDetails
list_auto_invest_plansGET /earn/autoinvest/plans/list_infoQueryAuto invest planList
list_earn_fixed_term_productsGET /earn/fixed-term/productGet product list
list_earn_fixed_term_products_by_assetGET /earn/fixed-term/product/{asset}/listGet product list by single currency
list_earn_fixed_term_lendsGET /earn/fixed-term/user/lendSubscription list
create_earn_fixed_term_lendPOST /earn/fixed-term/user/lendSubscription
create_earn_fixed_term_pre_redeemPOST /earn/fixed-term/user/pre-redeemRedeem
list_earn_fixed_term_historyGET /earn/fixed-term/user/historySubscription history

list_dual_investment_plans

list[DualGetPlans] list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)

Dual Investment product list

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=1# int | Financial project ID (optional)coin='BTC'# str | Investment Token (optional)type='call'# str | Type enum: `put` — buy low; `call` — sell high (optional)quote_currency='quote_currency_example'# str | Settlement currency enum: defaults to USDT; GUSD optional (optional)sort='sort_example'# str | Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first (optional)page=1# int | page number (optional)page_size=3# int | Items per page (optional)try:
# Dual Investment product listapi_response=api_instance.list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_investment_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintFinancial project ID[optional]
coinstrInvestment Token[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
quote_currencystrSettlement currency enum: defaults to USDT; GUSD optional[optional]
sortstrSort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first[optional]
pageintpage number[optional]
page_sizeintItems per page[optional]

Return type

list[DualGetPlans]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_dual_orders

list[DualGetOrders] list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)

Dual Investment order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
_from=1740727000# int | Start settlement time (optional)to=1740729000# int | End settlement time (optional)type='put'# str | Type enum: `put` — buy low; `call` — sell high (optional)status='HOLD'# str | Order status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all (optional)coin='BTC'# str | Investment Token (optional)page=1# int | Page number (optional) (default to 1)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Dual Investment order listapi_response=api_instance.list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
_fromintStart settlement time[optional]
tointEnd settlement time[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
statusstrOrder status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all[optional]
coinstrInvestment Token[optional]
pageintPage number[optional] [default to 1]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[DualGetOrders]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order

PlaceDualInvestmentOrder place_dual_order(place_dual_investment_order_params)

Place Dual Investment order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
place_dual_investment_order_params=gate_api.PlaceDualInvestmentOrderParams() # PlaceDualInvestmentOrderParams | try:
# Place Dual Investment orderapi_response=api_instance.place_dual_order(place_dual_investment_order_params)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
place_dual_investment_order_paramsPlaceDualInvestmentOrderParams

Return type

PlaceDualInvestmentOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order placed successfully-

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

list_dual_balance

DualGetBalance list_dual_balance()

Dual-Currency Earning Assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# Dual-Currency Earning Assetsapi_response=api_instance.list_dual_balance()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_balance: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

DualGetBalance

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_dual_order_refund_preview

DualOrderRefundPreview get_dual_order_refund_preview(order_id)

Dual-currency early redemption preview

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_id='9497'# str | Order IDtry:
# Dual-currency early redemption previewapi_response=api_instance.get_dual_order_refund_preview(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_order_refund_preview: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID

Return type

DualOrderRefundPreview

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order_refund

place_dual_order_refund(dual_order_refund_params)

Dual-currency order early redemption

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_order_refund_params=gate_api.DualOrderRefundParams() # DualOrderRefundParams | try:
# Dual-currency order early redemptionapi_instance.place_dual_order_refund(dual_order_refund_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order_refund: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_order_refund_paramsDualOrderRefundParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

modify_dual_order_reinvest

modify_dual_order_reinvest(dual_modify_order_reinvest_params)

Modify dual-currency order reinvest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_modify_order_reinvest_params=gate_api.DualModifyOrderReinvestParams() # DualModifyOrderReinvestParams | try:
# Modify dual-currency order reinvestapi_instance.modify_dual_order_reinvest(dual_modify_order_reinvest_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->modify_dual_order_reinvest: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_modify_order_reinvest_paramsDualModifyOrderReinvestParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

get_dual_project_recommend

list[DualProjectRecommend] get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)

Dual-currency recommended projects

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
mode='normal'# str | Sort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending (optional)coin='ETH'# str | Investment Token (optional)type='call'# str | `call`: sell high; `put`: buy low (optional)history_pids='110656,110652'# str | Comma-separated project IDs to exclude already recommended items (optional)try:
# Dual-currency recommended projectsapi_response=api_instance.get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_project_recommend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
modestrSort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending[optional]
coinstrInvestment Token[optional]
typestr`call`: sell high; `put`: buy low[optional]
history_pidsstrComma-separated project IDs to exclude already recommended items[optional]

Return type

list[DualProjectRecommend]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

find_coin

list[object] find_coin(cointype=cointype)

Staking coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
cointype='cointype_example'# str | Currency type: swap - voucher; lock - locked position; debt - US Treasury bond. (optional)try:
# Staking coinsapi_response=api_instance.find_coin(cointype=cointype)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->find_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
cointypestrCurrency type: swap - voucher; lock - locked position; debt - US Treasury bond.[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

swap_staking_coin

SwapCoinStruct swap_staking_coin(swap_coin)

On-chain token swap for earned coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
swap_coin=gate_api.SwapCoin() # SwapCoin | try:
# On-chain token swap for earned coinsapi_response=api_instance.swap_staking_coin(swap_coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->swap_staking_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
swap_coinSwapCoin

Return type

SwapCoinStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Swap successful-

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

order_list

OrderListStruct order_list(pid=pid, coin=coin, type=type, page=page)

List of on-chain coin-earning orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)type=0# int | Type 0-staking 1-redemption (optional)page=1# int | Page number (optional) (default to 1)try:
# List of on-chain coin-earning ordersapi_response=api_instance.order_list(pid=pid, coin=coin, type=type, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
typeintType 0-staking 1-redemption[optional]
pageintPage number[optional] [default to 1]

Return type

OrderListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

award_list

AwardListStruct award_list(pid=pid, coin=coin, page=page)

On-chain coin-earning dividend records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)page=1# int | Page number (optional) (default to 1)try:
# On-chain coin-earning dividend recordsapi_response=api_instance.award_list(pid=pid, coin=coin, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->award_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
pageintPage number[optional] [default to 1]

Return type

AwardListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

asset_list

list[object] asset_list(coin=coin)

On-chain coin-earning assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
coin='ETH'# str | Currency name (optional)try:
# On-chain coin-earning assetsapi_response=api_instance.asset_list(coin=coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->asset_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
coinstrCurrency name[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

create_auto_invest_plan

AutoInvestPlanCreateResp create_auto_invest_plan(auto_invest_plan_create)

Create auto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_create=gate_api.AutoInvestPlanCreate() # AutoInvestPlanCreate | try:
# Create auto invest planapi_response=api_instance.create_auto_invest_plan(auto_invest_plan_create)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_createAutoInvestPlanCreate

Return type

AutoInvestPlanCreateResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Created successfully-

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

update_auto_invest_plan

update_auto_invest_plan(auto_invest_plan_update)

UpdateAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_update=gate_api.AutoInvestPlanUpdate() # AutoInvestPlanUpdate | try:
# UpdateAuto invest planapi_instance.update_auto_invest_plan(auto_invest_plan_update)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->update_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_updateAutoInvestPlanUpdate

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

stop_auto_invest_plan

stop_auto_invest_plan(auto_invest_plan_stop)

StopAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_stop=gate_api.AutoInvestPlanStop() # AutoInvestPlanStop | try:
# StopAuto invest planapi_instance.stop_auto_invest_plan(auto_invest_plan_stop)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->stop_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_stopAutoInvestPlanStop

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Stopped successfully-

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

add_position_auto_invest_plan

add_position_auto_invest_plan(auto_invest_plan_add_position)

Add position immediately

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_add_position=gate_api.AutoInvestPlanAddPosition() # AutoInvestPlanAddPosition | try:
# Add position immediatelyapi_instance.add_position_auto_invest_plan(auto_invest_plan_add_position)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->add_position_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_add_positionAutoInvestPlanAddPosition

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Add PositionSuccess-

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

list_auto_invest_coins

list[AutoInvestCoinsItem] list_auto_invest_coins(plan_money=plan_money)

QueryCurrencies supporting auto invest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_money='USDT'# str | Pricing currency,Optional: USDT or BTC,Default: USDT (optional)try:
# QueryCurrencies supporting auto investapi_response=api_instance.list_auto_invest_coins(plan_money=plan_money)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_coins: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_moneystrPricing currency,Optional: USDT or BTC,Default: USDT[optional]

Return type

list[AutoInvestCoinsItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_min_amount

AutoInvestMinInvestAmountResp get_auto_invest_min_amount(auto_invest_min_invest_amount)

Get minimum investment amount

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_min_invest_amount=gate_api.AutoInvestMinInvestAmount() # AutoInvestMinInvestAmount | try:
# Get minimum investment amountapi_response=api_instance.get_auto_invest_min_amount(auto_invest_min_invest_amount)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_min_amount: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_min_invest_amountAutoInvestMinInvestAmount

Return type

AutoInvestMinInvestAmountResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plan_records

AutoInvestPlanRecordsResp list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)

List plan execution records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=141378# int | Plan IDpage=1# int | page number (optional)page_size=10# int | Items per page,Maximum 100 (optional)try:
# List plan execution recordsapi_response=api_instance.list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plan_records: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanRecordsResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_orders

list[AutoInvestOrderItem] list_auto_invest_orders(plan_id, record_id)

List plan execution recordsDetails(OrderDetails)

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142583# int | Plan IDrecord_id=1770805384904919# int | Record IDtry:
# List plan execution recordsDetails(OrderDetails)api_response=api_instance.list_auto_invest_orders(plan_id, record_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
record_idintRecord ID

Return type

list[AutoInvestOrderItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_config

list[AutoInvestConfigItem] list_auto_invest_config()

List investment currency configuration

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# List investment currency configurationapi_response=api_instance.list_auto_invest_config()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_config: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[AutoInvestConfigItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_plan_detail

AutoInvestPlanDetail get_auto_invest_plan_detail(plan_id)

QueryAuto invest planDetails

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142609# int | Plan IDtry:
# QueryAuto invest planDetailsapi_response=api_instance.get_auto_invest_plan_detail(plan_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_plan_detail: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID

Return type

AutoInvestPlanDetail

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plans

AutoInvestPlanListInfoResp list_auto_invest_plans(status, page=page, page_size=page_size)

QueryAuto invest planList

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
status='active'# str | Plan status,History history,Active activepage=56# int | page number (optional)page_size=56# int | Items per page,Maximum 100 (optional)try:
# QueryAuto invest planListapi_response=api_instance.list_auto_invest_plans(status, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrPlan status,History history,Active active
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanListInfoResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_earn_fixed_term_products

ListEarnFixedTermProductsResponse list_earn_fixed_term_products(page, limit, asset=asset, type=type)

Get product list

Query fixed-term earn product list. Supports filtering by currency, product type, status, etc. Returns product interest rate, lock-up period, quota, and reward campaign information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
page=1# int | Page numberlimit=100# int | Page sizeasset='USDT'# str | Currency (optional)type=1# int | Product type: 1 for regular, 2 for VIP (optional)try:
# Get product listapi_response=api_instance.list_earn_fixed_term_products(page, limit, asset=asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pageintPage number
limitintPage size
assetstrCurrency[optional]
typeintProduct type: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermProductsResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Product list retrieved successfully-

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

list_earn_fixed_term_products_by_asset

ListEarnFixedTermProductsByAssetResponse list_earn_fixed_term_products_by_asset(asset, type=type)

Get product list by single currency

Sort by product term in ascending order

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
asset='USDT'# str | Currency name, e.g., USDT, BTCtype='1'# str | Product type: \"\" or 1 for regular product list, 2 for VIP product list, 0 for all products (optional)try:
# Get product list by single currencyapi_response=api_instance.list_earn_fixed_term_products_by_asset(asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products_by_asset: %s\n"%e)

Parameters

NameTypeDescriptionNotes
assetstrCurrency name, e.g., USDT, BTC
typestrProduct type: "" or 1 for regular product list, 2 for VIP product list, 0 for all products[optional]

Return type

ListEarnFixedTermProductsByAssetResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Single currency product list retrieved successfully-

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

list_earn_fixed_term_lends

ListEarnFixedTermLendsResponse list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)

Subscription list

Query the user's fixed-term earn subscription order list. Supports filtering by product, currency, order type, etc. Returns order details, earnings, rewards, and interest rate boost coupon information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_type='1'# str | Order type: 1 for current orders, 2 for historical orderspage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id=56# int | Order ID (optional)asset='asset_example'# str | Currency (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription listapi_response=api_instance.list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_lends: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_typestrOrder type: 1 for current orders, 2 for historical orders
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idintOrder ID[optional]
assetstrCurrency[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermLendsResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription order list retrieved successfully-

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

create_earn_fixed_term_lend

CreateEarnFixedTermLendResponse create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)

Subscription

Subscribe to a fixed-term earn product by specifying the product ID and subscription amount. Optionally enable auto-renewal and apply an interest rate boost coupon

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
fixed_term_lend_request=gate_api.FixedTermLendRequest() # FixedTermLendRequest | (optional)try:
# Subscriptionapi_response=api_instance.create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_lend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
fixed_term_lend_requestFixedTermLendRequest[optional]

Return type

CreateEarnFixedTermLendResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription successful-

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

create_earn_fixed_term_pre_redeem

CreateEarnFixedTermPreRedeemResponse create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)

Redeem

Early redemption of a fixed-term earn order, order ID is required

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
earn_fixed_term_pre_redeem_request=gate_api.EarnFixedTermPreRedeemRequest() # EarnFixedTermPreRedeemRequest | (optional)try:
# Redeemapi_response=api_instance.create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_pre_redeem: %s\n"%e)

Parameters

NameTypeDescriptionNotes
earn_fixed_term_pre_redeem_requestEarnFixedTermPreRedeemRequest[optional]

Return type

CreateEarnFixedTermPreRedeemResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

list_earn_fixed_term_history

ListEarnFixedTermHistoryResponse list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)

Subscription history

Query the user's fixed-term earn history records. Supports filtering by type (subscription, redemption, interest, bonus rewards) and time range

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
type='1'# str | 1 for subscription, 2 for redemption, 3 for interest, 4 for bonus rewardpage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id='order_id_example'# str | Order ID (optional)asset='asset_example'# str | Currency (optional)start_at=56# int | Start timestamp (optional)end_at=56# int | End Timestamp (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription historyapi_response=api_instance.list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_history: %s\n"%e)

Parameters

NameTypeDescriptionNotes
typestr1 for subscription, 2 for redemption, 3 for interest, 4 for bonus reward
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idstrOrder ID[optional]
assetstrCurrency[optional]
start_atintStart timestamp[optional]
end_atintEnd Timestamp[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermHistoryResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200History records retrieved successfully-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' gateapi-python/docs/EarnApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
2110 lines (1595 loc) · 75.2 KB

File metadata and controls

2110 lines (1595 loc) · 75.2 KB

gate_api.EarnApi

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

MethodHTTP requestDescription
list_dual_investment_plansGET /earn/dual/investment_planDual Investment product list
list_dual_ordersGET /earn/dual/ordersDual Investment order list
place_dual_orderPOST /earn/dual/ordersPlace Dual Investment order
list_dual_balanceGET /earn/dual/balanceDual-Currency Earning Assets
get_dual_order_refund_previewGET /earn/dual/order-refund-previewDual-currency early redemption preview
place_dual_order_refundPOST /earn/dual/order-refundDual-currency order early redemption
modify_dual_order_reinvestPOST /earn/dual/modify-order-reinvestModify dual-currency order reinvest
get_dual_project_recommendGET /earn/dual/project-recommendDual-currency recommended projects
find_coinGET /earn/staking/coinsStaking coins
swap_staking_coinPOST /earn/staking/swapOn-chain token swap for earned coins
order_listGET /earn/staking/order_listList of on-chain coin-earning orders
award_listGET /earn/staking/award_listOn-chain coin-earning dividend records
asset_listGET /earn/staking/assetsOn-chain coin-earning assets
create_auto_invest_planPOST /earn/autoinvest/plans/createCreate auto invest plan
update_auto_invest_planPOST /earn/autoinvest/plans/updateUpdateAuto invest plan
stop_auto_invest_planPOST /earn/autoinvest/plans/stopStopAuto invest plan
add_position_auto_invest_planPOST /earn/autoinvest/plans/add_positionAdd position immediately
list_auto_invest_coinsGET /earn/autoinvest/coinsQueryCurrencies supporting auto invest
get_auto_invest_min_amountPOST /earn/autoinvest/min_invest_amountGet minimum investment amount
list_auto_invest_plan_recordsGET /earn/autoinvest/plans/recordsList plan execution records
list_auto_invest_ordersGET /earn/autoinvest/ordersList plan execution recordsDetails(OrderDetails)
list_auto_invest_configGET /earn/autoinvest/configList investment currency configuration
get_auto_invest_plan_detailGET /earn/autoinvest/plans/detailQueryAuto invest planDetails
list_auto_invest_plansGET /earn/autoinvest/plans/list_infoQueryAuto invest planList
list_earn_fixed_term_productsGET /earn/fixed-term/productGet product list
list_earn_fixed_term_products_by_assetGET /earn/fixed-term/product/{asset}/listGet product list by single currency
list_earn_fixed_term_lendsGET /earn/fixed-term/user/lendSubscription list
create_earn_fixed_term_lendPOST /earn/fixed-term/user/lendSubscription
create_earn_fixed_term_pre_redeemPOST /earn/fixed-term/user/pre-redeemRedeem
list_earn_fixed_term_historyGET /earn/fixed-term/user/historySubscription history

list_dual_investment_plans

list[DualGetPlans] list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)

Dual Investment product list

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=1# int | Financial project ID (optional)coin='BTC'# str | Investment Token (optional)type='call'# str | Type enum: `put` — buy low; `call` — sell high (optional)quote_currency='quote_currency_example'# str | Settlement currency enum: defaults to USDT; GUSD optional (optional)sort='sort_example'# str | Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first (optional)page=1# int | page number (optional)page_size=3# int | Items per page (optional)try:
# Dual Investment product listapi_response=api_instance.list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_investment_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintFinancial project ID[optional]
coinstrInvestment Token[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
quote_currencystrSettlement currency enum: defaults to USDT; GUSD optional[optional]
sortstrSort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first[optional]
pageintpage number[optional]
page_sizeintItems per page[optional]

Return type

list[DualGetPlans]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_dual_orders

list[DualGetOrders] list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)

Dual Investment order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
_from=1740727000# int | Start settlement time (optional)to=1740729000# int | End settlement time (optional)type='put'# str | Type enum: `put` — buy low; `call` — sell high (optional)status='HOLD'# str | Order status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all (optional)coin='BTC'# str | Investment Token (optional)page=1# int | Page number (optional) (default to 1)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Dual Investment order listapi_response=api_instance.list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
_fromintStart settlement time[optional]
tointEnd settlement time[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
statusstrOrder status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all[optional]
coinstrInvestment Token[optional]
pageintPage number[optional] [default to 1]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[DualGetOrders]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order

PlaceDualInvestmentOrder place_dual_order(place_dual_investment_order_params)

Place Dual Investment order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
place_dual_investment_order_params=gate_api.PlaceDualInvestmentOrderParams() # PlaceDualInvestmentOrderParams | try:
# Place Dual Investment orderapi_response=api_instance.place_dual_order(place_dual_investment_order_params)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
place_dual_investment_order_paramsPlaceDualInvestmentOrderParams

Return type

PlaceDualInvestmentOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order placed successfully-

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

list_dual_balance

DualGetBalance list_dual_balance()

Dual-Currency Earning Assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# Dual-Currency Earning Assetsapi_response=api_instance.list_dual_balance()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_balance: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

DualGetBalance

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_dual_order_refund_preview

DualOrderRefundPreview get_dual_order_refund_preview(order_id)

Dual-currency early redemption preview

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_id='9497'# str | Order IDtry:
# Dual-currency early redemption previewapi_response=api_instance.get_dual_order_refund_preview(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_order_refund_preview: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID

Return type

DualOrderRefundPreview

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order_refund

place_dual_order_refund(dual_order_refund_params)

Dual-currency order early redemption

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_order_refund_params=gate_api.DualOrderRefundParams() # DualOrderRefundParams | try:
# Dual-currency order early redemptionapi_instance.place_dual_order_refund(dual_order_refund_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order_refund: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_order_refund_paramsDualOrderRefundParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

modify_dual_order_reinvest

modify_dual_order_reinvest(dual_modify_order_reinvest_params)

Modify dual-currency order reinvest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_modify_order_reinvest_params=gate_api.DualModifyOrderReinvestParams() # DualModifyOrderReinvestParams | try:
# Modify dual-currency order reinvestapi_instance.modify_dual_order_reinvest(dual_modify_order_reinvest_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->modify_dual_order_reinvest: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_modify_order_reinvest_paramsDualModifyOrderReinvestParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

get_dual_project_recommend

list[DualProjectRecommend] get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)

Dual-currency recommended projects

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
mode='normal'# str | Sort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending (optional)coin='ETH'# str | Investment Token (optional)type='call'# str | `call`: sell high; `put`: buy low (optional)history_pids='110656,110652'# str | Comma-separated project IDs to exclude already recommended items (optional)try:
# Dual-currency recommended projectsapi_response=api_instance.get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_project_recommend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
modestrSort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending[optional]
coinstrInvestment Token[optional]
typestr`call`: sell high; `put`: buy low[optional]
history_pidsstrComma-separated project IDs to exclude already recommended items[optional]

Return type

list[DualProjectRecommend]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

find_coin

list[object] find_coin(cointype=cointype)

Staking coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
cointype='cointype_example'# str | Currency type: swap - voucher; lock - locked position; debt - US Treasury bond. (optional)try:
# Staking coinsapi_response=api_instance.find_coin(cointype=cointype)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->find_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
cointypestrCurrency type: swap - voucher; lock - locked position; debt - US Treasury bond.[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

swap_staking_coin

SwapCoinStruct swap_staking_coin(swap_coin)

On-chain token swap for earned coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
swap_coin=gate_api.SwapCoin() # SwapCoin | try:
# On-chain token swap for earned coinsapi_response=api_instance.swap_staking_coin(swap_coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->swap_staking_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
swap_coinSwapCoin

Return type

SwapCoinStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Swap successful-

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

order_list

OrderListStruct order_list(pid=pid, coin=coin, type=type, page=page)

List of on-chain coin-earning orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)type=0# int | Type 0-staking 1-redemption (optional)page=1# int | Page number (optional) (default to 1)try:
# List of on-chain coin-earning ordersapi_response=api_instance.order_list(pid=pid, coin=coin, type=type, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
typeintType 0-staking 1-redemption[optional]
pageintPage number[optional] [default to 1]

Return type

OrderListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

award_list

AwardListStruct award_list(pid=pid, coin=coin, page=page)

On-chain coin-earning dividend records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)page=1# int | Page number (optional) (default to 1)try:
# On-chain coin-earning dividend recordsapi_response=api_instance.award_list(pid=pid, coin=coin, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->award_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
pageintPage number[optional] [default to 1]

Return type

AwardListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

asset_list

list[object] asset_list(coin=coin)

On-chain coin-earning assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
coin='ETH'# str | Currency name (optional)try:
# On-chain coin-earning assetsapi_response=api_instance.asset_list(coin=coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->asset_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
coinstrCurrency name[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

create_auto_invest_plan

AutoInvestPlanCreateResp create_auto_invest_plan(auto_invest_plan_create)

Create auto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_create=gate_api.AutoInvestPlanCreate() # AutoInvestPlanCreate | try:
# Create auto invest planapi_response=api_instance.create_auto_invest_plan(auto_invest_plan_create)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_createAutoInvestPlanCreate

Return type

AutoInvestPlanCreateResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Created successfully-

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

update_auto_invest_plan

update_auto_invest_plan(auto_invest_plan_update)

UpdateAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_update=gate_api.AutoInvestPlanUpdate() # AutoInvestPlanUpdate | try:
# UpdateAuto invest planapi_instance.update_auto_invest_plan(auto_invest_plan_update)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->update_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_updateAutoInvestPlanUpdate

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

stop_auto_invest_plan

stop_auto_invest_plan(auto_invest_plan_stop)

StopAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_stop=gate_api.AutoInvestPlanStop() # AutoInvestPlanStop | try:
# StopAuto invest planapi_instance.stop_auto_invest_plan(auto_invest_plan_stop)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->stop_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_stopAutoInvestPlanStop

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Stopped successfully-

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

add_position_auto_invest_plan

add_position_auto_invest_plan(auto_invest_plan_add_position)

Add position immediately

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_add_position=gate_api.AutoInvestPlanAddPosition() # AutoInvestPlanAddPosition | try:
# Add position immediatelyapi_instance.add_position_auto_invest_plan(auto_invest_plan_add_position)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->add_position_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_add_positionAutoInvestPlanAddPosition

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Add PositionSuccess-

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

list_auto_invest_coins

list[AutoInvestCoinsItem] list_auto_invest_coins(plan_money=plan_money)

QueryCurrencies supporting auto invest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_money='USDT'# str | Pricing currency,Optional: USDT or BTC,Default: USDT (optional)try:
# QueryCurrencies supporting auto investapi_response=api_instance.list_auto_invest_coins(plan_money=plan_money)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_coins: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_moneystrPricing currency,Optional: USDT or BTC,Default: USDT[optional]

Return type

list[AutoInvestCoinsItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_min_amount

AutoInvestMinInvestAmountResp get_auto_invest_min_amount(auto_invest_min_invest_amount)

Get minimum investment amount

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_min_invest_amount=gate_api.AutoInvestMinInvestAmount() # AutoInvestMinInvestAmount | try:
# Get minimum investment amountapi_response=api_instance.get_auto_invest_min_amount(auto_invest_min_invest_amount)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_min_amount: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_min_invest_amountAutoInvestMinInvestAmount

Return type

AutoInvestMinInvestAmountResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plan_records

AutoInvestPlanRecordsResp list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)

List plan execution records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=141378# int | Plan IDpage=1# int | page number (optional)page_size=10# int | Items per page,Maximum 100 (optional)try:
# List plan execution recordsapi_response=api_instance.list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plan_records: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanRecordsResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_orders

list[AutoInvestOrderItem] list_auto_invest_orders(plan_id, record_id)

List plan execution recordsDetails(OrderDetails)

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142583# int | Plan IDrecord_id=1770805384904919# int | Record IDtry:
# List plan execution recordsDetails(OrderDetails)api_response=api_instance.list_auto_invest_orders(plan_id, record_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
record_idintRecord ID

Return type

list[AutoInvestOrderItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_config

list[AutoInvestConfigItem] list_auto_invest_config()

List investment currency configuration

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# List investment currency configurationapi_response=api_instance.list_auto_invest_config()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_config: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[AutoInvestConfigItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_plan_detail

AutoInvestPlanDetail get_auto_invest_plan_detail(plan_id)

QueryAuto invest planDetails

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142609# int | Plan IDtry:
# QueryAuto invest planDetailsapi_response=api_instance.get_auto_invest_plan_detail(plan_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_plan_detail: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID

Return type

AutoInvestPlanDetail

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plans

AutoInvestPlanListInfoResp list_auto_invest_plans(status, page=page, page_size=page_size)

QueryAuto invest planList

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
status='active'# str | Plan status,History history,Active activepage=56# int | page number (optional)page_size=56# int | Items per page,Maximum 100 (optional)try:
# QueryAuto invest planListapi_response=api_instance.list_auto_invest_plans(status, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrPlan status,History history,Active active
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanListInfoResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_earn_fixed_term_products

ListEarnFixedTermProductsResponse list_earn_fixed_term_products(page, limit, asset=asset, type=type)

Get product list

Query fixed-term earn product list. Supports filtering by currency, product type, status, etc. Returns product interest rate, lock-up period, quota, and reward campaign information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
page=1# int | Page numberlimit=100# int | Page sizeasset='USDT'# str | Currency (optional)type=1# int | Product type: 1 for regular, 2 for VIP (optional)try:
# Get product listapi_response=api_instance.list_earn_fixed_term_products(page, limit, asset=asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pageintPage number
limitintPage size
assetstrCurrency[optional]
typeintProduct type: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermProductsResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Product list retrieved successfully-

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

list_earn_fixed_term_products_by_asset

ListEarnFixedTermProductsByAssetResponse list_earn_fixed_term_products_by_asset(asset, type=type)

Get product list by single currency

Sort by product term in ascending order

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
asset='USDT'# str | Currency name, e.g., USDT, BTCtype='1'# str | Product type: \"\" or 1 for regular product list, 2 for VIP product list, 0 for all products (optional)try:
# Get product list by single currencyapi_response=api_instance.list_earn_fixed_term_products_by_asset(asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products_by_asset: %s\n"%e)

Parameters

NameTypeDescriptionNotes
assetstrCurrency name, e.g., USDT, BTC
typestrProduct type: "" or 1 for regular product list, 2 for VIP product list, 0 for all products[optional]

Return type

ListEarnFixedTermProductsByAssetResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Single currency product list retrieved successfully-

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

list_earn_fixed_term_lends

ListEarnFixedTermLendsResponse list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)

Subscription list

Query the user's fixed-term earn subscription order list. Supports filtering by product, currency, order type, etc. Returns order details, earnings, rewards, and interest rate boost coupon information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_type='1'# str | Order type: 1 for current orders, 2 for historical orderspage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id=56# int | Order ID (optional)asset='asset_example'# str | Currency (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription listapi_response=api_instance.list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_lends: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_typestrOrder type: 1 for current orders, 2 for historical orders
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idintOrder ID[optional]
assetstrCurrency[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermLendsResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription order list retrieved successfully-

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

create_earn_fixed_term_lend

CreateEarnFixedTermLendResponse create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)

Subscription

Subscribe to a fixed-term earn product by specifying the product ID and subscription amount. Optionally enable auto-renewal and apply an interest rate boost coupon

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
fixed_term_lend_request=gate_api.FixedTermLendRequest() # FixedTermLendRequest | (optional)try:
# Subscriptionapi_response=api_instance.create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_lend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
fixed_term_lend_requestFixedTermLendRequest[optional]

Return type

CreateEarnFixedTermLendResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription successful-

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

create_earn_fixed_term_pre_redeem

CreateEarnFixedTermPreRedeemResponse create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)

Redeem

Early redemption of a fixed-term earn order, order ID is required

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
earn_fixed_term_pre_redeem_request=gate_api.EarnFixedTermPreRedeemRequest() # EarnFixedTermPreRedeemRequest | (optional)try:
# Redeemapi_response=api_instance.create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_pre_redeem: %s\n"%e)

Parameters

NameTypeDescriptionNotes
earn_fixed_term_pre_redeem_requestEarnFixedTermPreRedeemRequest[optional]

Return type

CreateEarnFixedTermPreRedeemResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

list_earn_fixed_term_history

ListEarnFixedTermHistoryResponse list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)

Subscription history

Query the user's fixed-term earn history records. Supports filtering by type (subscription, redemption, interest, bonus rewards) and time range

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
type='1'# str | 1 for subscription, 2 for redemption, 3 for interest, 4 for bonus rewardpage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id='order_id_example'# str | Order ID (optional)asset='asset_example'# str | Currency (optional)start_at=56# int | Start timestamp (optional)end_at=56# int | End Timestamp (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription historyapi_response=api_instance.list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_history: %s\n"%e)

Parameters

NameTypeDescriptionNotes
typestr1 for subscription, 2 for redemption, 3 for interest, 4 for bonus reward
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idstrOrder ID[optional]
assetstrCurrency[optional]
start_atintStart timestamp[optional]
end_atintEnd Timestamp[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermHistoryResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200History records retrieved successfully-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' gateapi-python/docs/EarnApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
2110 lines (1595 loc) · 75.2 KB

File metadata and controls

2110 lines (1595 loc) · 75.2 KB

gate_api.EarnApi

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

MethodHTTP requestDescription
list_dual_investment_plansGET /earn/dual/investment_planDual Investment product list
list_dual_ordersGET /earn/dual/ordersDual Investment order list
place_dual_orderPOST /earn/dual/ordersPlace Dual Investment order
list_dual_balanceGET /earn/dual/balanceDual-Currency Earning Assets
get_dual_order_refund_previewGET /earn/dual/order-refund-previewDual-currency early redemption preview
place_dual_order_refundPOST /earn/dual/order-refundDual-currency order early redemption
modify_dual_order_reinvestPOST /earn/dual/modify-order-reinvestModify dual-currency order reinvest
get_dual_project_recommendGET /earn/dual/project-recommendDual-currency recommended projects
find_coinGET /earn/staking/coinsStaking coins
swap_staking_coinPOST /earn/staking/swapOn-chain token swap for earned coins
order_listGET /earn/staking/order_listList of on-chain coin-earning orders
award_listGET /earn/staking/award_listOn-chain coin-earning dividend records
asset_listGET /earn/staking/assetsOn-chain coin-earning assets
create_auto_invest_planPOST /earn/autoinvest/plans/createCreate auto invest plan
update_auto_invest_planPOST /earn/autoinvest/plans/updateUpdateAuto invest plan
stop_auto_invest_planPOST /earn/autoinvest/plans/stopStopAuto invest plan
add_position_auto_invest_planPOST /earn/autoinvest/plans/add_positionAdd position immediately
list_auto_invest_coinsGET /earn/autoinvest/coinsQueryCurrencies supporting auto invest
get_auto_invest_min_amountPOST /earn/autoinvest/min_invest_amountGet minimum investment amount
list_auto_invest_plan_recordsGET /earn/autoinvest/plans/recordsList plan execution records
list_auto_invest_ordersGET /earn/autoinvest/ordersList plan execution recordsDetails(OrderDetails)
list_auto_invest_configGET /earn/autoinvest/configList investment currency configuration
get_auto_invest_plan_detailGET /earn/autoinvest/plans/detailQueryAuto invest planDetails
list_auto_invest_plansGET /earn/autoinvest/plans/list_infoQueryAuto invest planList
list_earn_fixed_term_productsGET /earn/fixed-term/productGet product list
list_earn_fixed_term_products_by_assetGET /earn/fixed-term/product/{asset}/listGet product list by single currency
list_earn_fixed_term_lendsGET /earn/fixed-term/user/lendSubscription list
create_earn_fixed_term_lendPOST /earn/fixed-term/user/lendSubscription
create_earn_fixed_term_pre_redeemPOST /earn/fixed-term/user/pre-redeemRedeem
list_earn_fixed_term_historyGET /earn/fixed-term/user/historySubscription history

list_dual_investment_plans

list[DualGetPlans] list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)

Dual Investment product list

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=1# int | Financial project ID (optional)coin='BTC'# str | Investment Token (optional)type='call'# str | Type enum: `put` — buy low; `call` — sell high (optional)quote_currency='quote_currency_example'# str | Settlement currency enum: defaults to USDT; GUSD optional (optional)sort='sort_example'# str | Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first (optional)page=1# int | page number (optional)page_size=3# int | Items per page (optional)try:
# Dual Investment product listapi_response=api_instance.list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_investment_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintFinancial project ID[optional]
coinstrInvestment Token[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
quote_currencystrSettlement currency enum: defaults to USDT; GUSD optional[optional]
sortstrSort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first[optional]
pageintpage number[optional]
page_sizeintItems per page[optional]

Return type

list[DualGetPlans]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_dual_orders

list[DualGetOrders] list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)

Dual Investment order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
_from=1740727000# int | Start settlement time (optional)to=1740729000# int | End settlement time (optional)type='put'# str | Type enum: `put` — buy low; `call` — sell high (optional)status='HOLD'# str | Order status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all (optional)coin='BTC'# str | Investment Token (optional)page=1# int | Page number (optional) (default to 1)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Dual Investment order listapi_response=api_instance.list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
_fromintStart settlement time[optional]
tointEnd settlement time[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
statusstrOrder status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all[optional]
coinstrInvestment Token[optional]
pageintPage number[optional] [default to 1]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[DualGetOrders]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order

PlaceDualInvestmentOrder place_dual_order(place_dual_investment_order_params)

Place Dual Investment order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
place_dual_investment_order_params=gate_api.PlaceDualInvestmentOrderParams() # PlaceDualInvestmentOrderParams | try:
# Place Dual Investment orderapi_response=api_instance.place_dual_order(place_dual_investment_order_params)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
place_dual_investment_order_paramsPlaceDualInvestmentOrderParams

Return type

PlaceDualInvestmentOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order placed successfully-

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

list_dual_balance

DualGetBalance list_dual_balance()

Dual-Currency Earning Assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# Dual-Currency Earning Assetsapi_response=api_instance.list_dual_balance()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_balance: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

DualGetBalance

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_dual_order_refund_preview

DualOrderRefundPreview get_dual_order_refund_preview(order_id)

Dual-currency early redemption preview

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_id='9497'# str | Order IDtry:
# Dual-currency early redemption previewapi_response=api_instance.get_dual_order_refund_preview(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_order_refund_preview: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID

Return type

DualOrderRefundPreview

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order_refund

place_dual_order_refund(dual_order_refund_params)

Dual-currency order early redemption

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_order_refund_params=gate_api.DualOrderRefundParams() # DualOrderRefundParams | try:
# Dual-currency order early redemptionapi_instance.place_dual_order_refund(dual_order_refund_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order_refund: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_order_refund_paramsDualOrderRefundParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

modify_dual_order_reinvest

modify_dual_order_reinvest(dual_modify_order_reinvest_params)

Modify dual-currency order reinvest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_modify_order_reinvest_params=gate_api.DualModifyOrderReinvestParams() # DualModifyOrderReinvestParams | try:
# Modify dual-currency order reinvestapi_instance.modify_dual_order_reinvest(dual_modify_order_reinvest_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->modify_dual_order_reinvest: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_modify_order_reinvest_paramsDualModifyOrderReinvestParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

get_dual_project_recommend

list[DualProjectRecommend] get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)

Dual-currency recommended projects

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
mode='normal'# str | Sort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending (optional)coin='ETH'# str | Investment Token (optional)type='call'# str | `call`: sell high; `put`: buy low (optional)history_pids='110656,110652'# str | Comma-separated project IDs to exclude already recommended items (optional)try:
# Dual-currency recommended projectsapi_response=api_instance.get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_project_recommend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
modestrSort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending[optional]
coinstrInvestment Token[optional]
typestr`call`: sell high; `put`: buy low[optional]
history_pidsstrComma-separated project IDs to exclude already recommended items[optional]

Return type

list[DualProjectRecommend]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

find_coin

list[object] find_coin(cointype=cointype)

Staking coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
cointype='cointype_example'# str | Currency type: swap - voucher; lock - locked position; debt - US Treasury bond. (optional)try:
# Staking coinsapi_response=api_instance.find_coin(cointype=cointype)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->find_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
cointypestrCurrency type: swap - voucher; lock - locked position; debt - US Treasury bond.[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

swap_staking_coin

SwapCoinStruct swap_staking_coin(swap_coin)

On-chain token swap for earned coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
swap_coin=gate_api.SwapCoin() # SwapCoin | try:
# On-chain token swap for earned coinsapi_response=api_instance.swap_staking_coin(swap_coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->swap_staking_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
swap_coinSwapCoin

Return type

SwapCoinStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Swap successful-

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

order_list

OrderListStruct order_list(pid=pid, coin=coin, type=type, page=page)

List of on-chain coin-earning orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)type=0# int | Type 0-staking 1-redemption (optional)page=1# int | Page number (optional) (default to 1)try:
# List of on-chain coin-earning ordersapi_response=api_instance.order_list(pid=pid, coin=coin, type=type, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
typeintType 0-staking 1-redemption[optional]
pageintPage number[optional] [default to 1]

Return type

OrderListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

award_list

AwardListStruct award_list(pid=pid, coin=coin, page=page)

On-chain coin-earning dividend records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)page=1# int | Page number (optional) (default to 1)try:
# On-chain coin-earning dividend recordsapi_response=api_instance.award_list(pid=pid, coin=coin, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->award_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
pageintPage number[optional] [default to 1]

Return type

AwardListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

asset_list

list[object] asset_list(coin=coin)

On-chain coin-earning assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
coin='ETH'# str | Currency name (optional)try:
# On-chain coin-earning assetsapi_response=api_instance.asset_list(coin=coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->asset_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
coinstrCurrency name[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

create_auto_invest_plan

AutoInvestPlanCreateResp create_auto_invest_plan(auto_invest_plan_create)

Create auto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_create=gate_api.AutoInvestPlanCreate() # AutoInvestPlanCreate | try:
# Create auto invest planapi_response=api_instance.create_auto_invest_plan(auto_invest_plan_create)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_createAutoInvestPlanCreate

Return type

AutoInvestPlanCreateResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Created successfully-

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

update_auto_invest_plan

update_auto_invest_plan(auto_invest_plan_update)

UpdateAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_update=gate_api.AutoInvestPlanUpdate() # AutoInvestPlanUpdate | try:
# UpdateAuto invest planapi_instance.update_auto_invest_plan(auto_invest_plan_update)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->update_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_updateAutoInvestPlanUpdate

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

stop_auto_invest_plan

stop_auto_invest_plan(auto_invest_plan_stop)

StopAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_stop=gate_api.AutoInvestPlanStop() # AutoInvestPlanStop | try:
# StopAuto invest planapi_instance.stop_auto_invest_plan(auto_invest_plan_stop)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->stop_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_stopAutoInvestPlanStop

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Stopped successfully-

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

add_position_auto_invest_plan

add_position_auto_invest_plan(auto_invest_plan_add_position)

Add position immediately

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_add_position=gate_api.AutoInvestPlanAddPosition() # AutoInvestPlanAddPosition | try:
# Add position immediatelyapi_instance.add_position_auto_invest_plan(auto_invest_plan_add_position)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->add_position_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_add_positionAutoInvestPlanAddPosition

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Add PositionSuccess-

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

list_auto_invest_coins

list[AutoInvestCoinsItem] list_auto_invest_coins(plan_money=plan_money)

QueryCurrencies supporting auto invest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_money='USDT'# str | Pricing currency,Optional: USDT or BTC,Default: USDT (optional)try:
# QueryCurrencies supporting auto investapi_response=api_instance.list_auto_invest_coins(plan_money=plan_money)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_coins: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_moneystrPricing currency,Optional: USDT or BTC,Default: USDT[optional]

Return type

list[AutoInvestCoinsItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_min_amount

AutoInvestMinInvestAmountResp get_auto_invest_min_amount(auto_invest_min_invest_amount)

Get minimum investment amount

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_min_invest_amount=gate_api.AutoInvestMinInvestAmount() # AutoInvestMinInvestAmount | try:
# Get minimum investment amountapi_response=api_instance.get_auto_invest_min_amount(auto_invest_min_invest_amount)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_min_amount: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_min_invest_amountAutoInvestMinInvestAmount

Return type

AutoInvestMinInvestAmountResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plan_records

AutoInvestPlanRecordsResp list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)

List plan execution records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=141378# int | Plan IDpage=1# int | page number (optional)page_size=10# int | Items per page,Maximum 100 (optional)try:
# List plan execution recordsapi_response=api_instance.list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plan_records: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanRecordsResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_orders

list[AutoInvestOrderItem] list_auto_invest_orders(plan_id, record_id)

List plan execution recordsDetails(OrderDetails)

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142583# int | Plan IDrecord_id=1770805384904919# int | Record IDtry:
# List plan execution recordsDetails(OrderDetails)api_response=api_instance.list_auto_invest_orders(plan_id, record_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
record_idintRecord ID

Return type

list[AutoInvestOrderItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_config

list[AutoInvestConfigItem] list_auto_invest_config()

List investment currency configuration

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# List investment currency configurationapi_response=api_instance.list_auto_invest_config()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_config: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[AutoInvestConfigItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_plan_detail

AutoInvestPlanDetail get_auto_invest_plan_detail(plan_id)

QueryAuto invest planDetails

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142609# int | Plan IDtry:
# QueryAuto invest planDetailsapi_response=api_instance.get_auto_invest_plan_detail(plan_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_plan_detail: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID

Return type

AutoInvestPlanDetail

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plans

AutoInvestPlanListInfoResp list_auto_invest_plans(status, page=page, page_size=page_size)

QueryAuto invest planList

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
status='active'# str | Plan status,History history,Active activepage=56# int | page number (optional)page_size=56# int | Items per page,Maximum 100 (optional)try:
# QueryAuto invest planListapi_response=api_instance.list_auto_invest_plans(status, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrPlan status,History history,Active active
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanListInfoResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_earn_fixed_term_products

ListEarnFixedTermProductsResponse list_earn_fixed_term_products(page, limit, asset=asset, type=type)

Get product list

Query fixed-term earn product list. Supports filtering by currency, product type, status, etc. Returns product interest rate, lock-up period, quota, and reward campaign information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
page=1# int | Page numberlimit=100# int | Page sizeasset='USDT'# str | Currency (optional)type=1# int | Product type: 1 for regular, 2 for VIP (optional)try:
# Get product listapi_response=api_instance.list_earn_fixed_term_products(page, limit, asset=asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pageintPage number
limitintPage size
assetstrCurrency[optional]
typeintProduct type: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermProductsResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Product list retrieved successfully-

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

list_earn_fixed_term_products_by_asset

ListEarnFixedTermProductsByAssetResponse list_earn_fixed_term_products_by_asset(asset, type=type)

Get product list by single currency

Sort by product term in ascending order

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
asset='USDT'# str | Currency name, e.g., USDT, BTCtype='1'# str | Product type: \"\" or 1 for regular product list, 2 for VIP product list, 0 for all products (optional)try:
# Get product list by single currencyapi_response=api_instance.list_earn_fixed_term_products_by_asset(asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products_by_asset: %s\n"%e)

Parameters

NameTypeDescriptionNotes
assetstrCurrency name, e.g., USDT, BTC
typestrProduct type: "" or 1 for regular product list, 2 for VIP product list, 0 for all products[optional]

Return type

ListEarnFixedTermProductsByAssetResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Single currency product list retrieved successfully-

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

list_earn_fixed_term_lends

ListEarnFixedTermLendsResponse list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)

Subscription list

Query the user's fixed-term earn subscription order list. Supports filtering by product, currency, order type, etc. Returns order details, earnings, rewards, and interest rate boost coupon information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_type='1'# str | Order type: 1 for current orders, 2 for historical orderspage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id=56# int | Order ID (optional)asset='asset_example'# str | Currency (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription listapi_response=api_instance.list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_lends: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_typestrOrder type: 1 for current orders, 2 for historical orders
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idintOrder ID[optional]
assetstrCurrency[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermLendsResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription order list retrieved successfully-

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

create_earn_fixed_term_lend

CreateEarnFixedTermLendResponse create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)

Subscription

Subscribe to a fixed-term earn product by specifying the product ID and subscription amount. Optionally enable auto-renewal and apply an interest rate boost coupon

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
fixed_term_lend_request=gate_api.FixedTermLendRequest() # FixedTermLendRequest | (optional)try:
# Subscriptionapi_response=api_instance.create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_lend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
fixed_term_lend_requestFixedTermLendRequest[optional]

Return type

CreateEarnFixedTermLendResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription successful-

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

create_earn_fixed_term_pre_redeem

CreateEarnFixedTermPreRedeemResponse create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)

Redeem

Early redemption of a fixed-term earn order, order ID is required

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
earn_fixed_term_pre_redeem_request=gate_api.EarnFixedTermPreRedeemRequest() # EarnFixedTermPreRedeemRequest | (optional)try:
# Redeemapi_response=api_instance.create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_pre_redeem: %s\n"%e)

Parameters

NameTypeDescriptionNotes
earn_fixed_term_pre_redeem_requestEarnFixedTermPreRedeemRequest[optional]

Return type

CreateEarnFixedTermPreRedeemResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

list_earn_fixed_term_history

ListEarnFixedTermHistoryResponse list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)

Subscription history

Query the user's fixed-term earn history records. Supports filtering by type (subscription, redemption, interest, bonus rewards) and time range

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
type='1'# str | 1 for subscription, 2 for redemption, 3 for interest, 4 for bonus rewardpage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id='order_id_example'# str | Order ID (optional)asset='asset_example'# str | Currency (optional)start_at=56# int | Start timestamp (optional)end_at=56# int | End Timestamp (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription historyapi_response=api_instance.list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_history: %s\n"%e)

Parameters

NameTypeDescriptionNotes
typestr1 for subscription, 2 for redemption, 3 for interest, 4 for bonus reward
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idstrOrder ID[optional]
assetstrCurrency[optional]
start_atintStart timestamp[optional]
end_atintEnd Timestamp[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermHistoryResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200History records retrieved successfully-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); gateapi-python/docs/EarnApi.md at master · gate/gateapi-python · GitHub
Skip to content

Latest commit

History

History
2110 lines (1595 loc) · 75.2 KB

File metadata and controls

2110 lines (1595 loc) · 75.2 KB

gate_api.EarnApi

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

MethodHTTP requestDescription
list_dual_investment_plansGET /earn/dual/investment_planDual Investment product list
list_dual_ordersGET /earn/dual/ordersDual Investment order list
place_dual_orderPOST /earn/dual/ordersPlace Dual Investment order
list_dual_balanceGET /earn/dual/balanceDual-Currency Earning Assets
get_dual_order_refund_previewGET /earn/dual/order-refund-previewDual-currency early redemption preview
place_dual_order_refundPOST /earn/dual/order-refundDual-currency order early redemption
modify_dual_order_reinvestPOST /earn/dual/modify-order-reinvestModify dual-currency order reinvest
get_dual_project_recommendGET /earn/dual/project-recommendDual-currency recommended projects
find_coinGET /earn/staking/coinsStaking coins
swap_staking_coinPOST /earn/staking/swapOn-chain token swap for earned coins
order_listGET /earn/staking/order_listList of on-chain coin-earning orders
award_listGET /earn/staking/award_listOn-chain coin-earning dividend records
asset_listGET /earn/staking/assetsOn-chain coin-earning assets
create_auto_invest_planPOST /earn/autoinvest/plans/createCreate auto invest plan
update_auto_invest_planPOST /earn/autoinvest/plans/updateUpdateAuto invest plan
stop_auto_invest_planPOST /earn/autoinvest/plans/stopStopAuto invest plan
add_position_auto_invest_planPOST /earn/autoinvest/plans/add_positionAdd position immediately
list_auto_invest_coinsGET /earn/autoinvest/coinsQueryCurrencies supporting auto invest
get_auto_invest_min_amountPOST /earn/autoinvest/min_invest_amountGet minimum investment amount
list_auto_invest_plan_recordsGET /earn/autoinvest/plans/recordsList plan execution records
list_auto_invest_ordersGET /earn/autoinvest/ordersList plan execution recordsDetails(OrderDetails)
list_auto_invest_configGET /earn/autoinvest/configList investment currency configuration
get_auto_invest_plan_detailGET /earn/autoinvest/plans/detailQueryAuto invest planDetails
list_auto_invest_plansGET /earn/autoinvest/plans/list_infoQueryAuto invest planList
list_earn_fixed_term_productsGET /earn/fixed-term/productGet product list
list_earn_fixed_term_products_by_assetGET /earn/fixed-term/product/{asset}/listGet product list by single currency
list_earn_fixed_term_lendsGET /earn/fixed-term/user/lendSubscription list
create_earn_fixed_term_lendPOST /earn/fixed-term/user/lendSubscription
create_earn_fixed_term_pre_redeemPOST /earn/fixed-term/user/pre-redeemRedeem
list_earn_fixed_term_historyGET /earn/fixed-term/user/historySubscription history

list_dual_investment_plans

list[DualGetPlans] list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)

Dual Investment product list

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=1# int | Financial project ID (optional)coin='BTC'# str | Investment Token (optional)type='call'# str | Type enum: `put` — buy low; `call` — sell high (optional)quote_currency='quote_currency_example'# str | Settlement currency enum: defaults to USDT; GUSD optional (optional)sort='sort_example'# str | Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first (optional)page=1# int | page number (optional)page_size=3# int | Items per page (optional)try:
# Dual Investment product listapi_response=api_instance.list_dual_investment_plans(plan_id=plan_id, coin=coin, type=type, quote_currency=quote_currency, sort=sort, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_investment_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintFinancial project ID[optional]
coinstrInvestment Token[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
quote_currencystrSettlement currency enum: defaults to USDT; GUSD optional[optional]
sortstrSort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first[optional]
pageintpage number[optional]
page_sizeintItems per page[optional]

Return type

list[DualGetPlans]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_dual_orders

list[DualGetOrders] list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)

Dual Investment order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
_from=1740727000# int | Start settlement time (optional)to=1740729000# int | End settlement time (optional)type='put'# str | Type enum: `put` — buy low; `call` — sell high (optional)status='HOLD'# str | Order status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all (optional)coin='BTC'# str | Investment Token (optional)page=1# int | Page number (optional) (default to 1)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Dual Investment order listapi_response=api_instance.list_dual_orders(_from=_from, to=to, type=type, status=status, coin=coin, page=page, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
_fromintStart settlement time[optional]
tointEnd settlement time[optional]
typestrType enum: `put` — buy low; `call` — sell high[optional]
statusstrOrder status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all[optional]
coinstrInvestment Token[optional]
pageintPage number[optional] [default to 1]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[DualGetOrders]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order

PlaceDualInvestmentOrder place_dual_order(place_dual_investment_order_params)

Place Dual Investment order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
place_dual_investment_order_params=gate_api.PlaceDualInvestmentOrderParams() # PlaceDualInvestmentOrderParams | try:
# Place Dual Investment orderapi_response=api_instance.place_dual_order(place_dual_investment_order_params)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
place_dual_investment_order_paramsPlaceDualInvestmentOrderParams

Return type

PlaceDualInvestmentOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order placed successfully-

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

list_dual_balance

DualGetBalance list_dual_balance()

Dual-Currency Earning Assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# Dual-Currency Earning Assetsapi_response=api_instance.list_dual_balance()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_dual_balance: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

DualGetBalance

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_dual_order_refund_preview

DualOrderRefundPreview get_dual_order_refund_preview(order_id)

Dual-currency early redemption preview

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_id='9497'# str | Order IDtry:
# Dual-currency early redemption previewapi_response=api_instance.get_dual_order_refund_preview(order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_order_refund_preview: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_idstrOrder ID

Return type

DualOrderRefundPreview

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

place_dual_order_refund

place_dual_order_refund(dual_order_refund_params)

Dual-currency order early redemption

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_order_refund_params=gate_api.DualOrderRefundParams() # DualOrderRefundParams | try:
# Dual-currency order early redemptionapi_instance.place_dual_order_refund(dual_order_refund_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->place_dual_order_refund: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_order_refund_paramsDualOrderRefundParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

modify_dual_order_reinvest

modify_dual_order_reinvest(dual_modify_order_reinvest_params)

Modify dual-currency order reinvest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
dual_modify_order_reinvest_params=gate_api.DualModifyOrderReinvestParams() # DualModifyOrderReinvestParams | try:
# Modify dual-currency order reinvestapi_instance.modify_dual_order_reinvest(dual_modify_order_reinvest_params)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->modify_dual_order_reinvest: %s\n"%e)

Parameters

NameTypeDescriptionNotes
dual_modify_order_reinvest_paramsDualModifyOrderReinvestParams

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

get_dual_project_recommend

list[DualProjectRecommend] get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)

Dual-currency recommended projects

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
mode='normal'# str | Sort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending (optional)coin='ETH'# str | Investment Token (optional)type='call'# str | `call`: sell high; `put`: buy low (optional)history_pids='110656,110652'# str | Comma-separated project IDs to exclude already recommended items (optional)try:
# Dual-currency recommended projectsapi_response=api_instance.get_dual_project_recommend(mode=mode, coin=coin, type=type, history_pids=history_pids)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_dual_project_recommend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
modestrSort mode; default `normal`: `senior` — curated picks (APR/tenor) `apy_up` — APY ascending `ep_down` — target price descending `ep_up` — target price ascending `dt_down` — maturity time descending `dt_up` — maturity time ascending[optional]
coinstrInvestment Token[optional]
typestr`call`: sell high; `put`: buy low[optional]
history_pidsstrComma-separated project IDs to exclude already recommended items[optional]

Return type

list[DualProjectRecommend]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

find_coin

list[object] find_coin(cointype=cointype)

Staking coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
cointype='cointype_example'# str | Currency type: swap - voucher; lock - locked position; debt - US Treasury bond. (optional)try:
# Staking coinsapi_response=api_instance.find_coin(cointype=cointype)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->find_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
cointypestrCurrency type: swap - voucher; lock - locked position; debt - US Treasury bond.[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

swap_staking_coin

SwapCoinStruct swap_staking_coin(swap_coin)

On-chain token swap for earned coins

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
swap_coin=gate_api.SwapCoin() # SwapCoin | try:
# On-chain token swap for earned coinsapi_response=api_instance.swap_staking_coin(swap_coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->swap_staking_coin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
swap_coinSwapCoin

Return type

SwapCoinStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Swap successful-

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

order_list

OrderListStruct order_list(pid=pid, coin=coin, type=type, page=page)

List of on-chain coin-earning orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)type=0# int | Type 0-staking 1-redemption (optional)page=1# int | Page number (optional) (default to 1)try:
# List of on-chain coin-earning ordersapi_response=api_instance.order_list(pid=pid, coin=coin, type=type, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
typeintType 0-staking 1-redemption[optional]
pageintPage number[optional] [default to 1]

Return type

OrderListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

award_list

AwardListStruct award_list(pid=pid, coin=coin, page=page)

On-chain coin-earning dividend records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
pid=7# int | Product ID (optional)coin='ETH'# str | Currency name (optional)page=1# int | Page number (optional) (default to 1)try:
# On-chain coin-earning dividend recordsapi_response=api_instance.award_list(pid=pid, coin=coin, page=page)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->award_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pidintProduct ID[optional]
coinstrCurrency name[optional]
pageintPage number[optional] [default to 1]

Return type

AwardListStruct

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

asset_list

list[object] asset_list(coin=coin)

On-chain coin-earning assets

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
coin='ETH'# str | Currency name (optional)try:
# On-chain coin-earning assetsapi_response=api_instance.asset_list(coin=coin)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->asset_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
coinstrCurrency name[optional]

Return type

list[object]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

create_auto_invest_plan

AutoInvestPlanCreateResp create_auto_invest_plan(auto_invest_plan_create)

Create auto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_create=gate_api.AutoInvestPlanCreate() # AutoInvestPlanCreate | try:
# Create auto invest planapi_response=api_instance.create_auto_invest_plan(auto_invest_plan_create)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_createAutoInvestPlanCreate

Return type

AutoInvestPlanCreateResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Created successfully-

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

update_auto_invest_plan

update_auto_invest_plan(auto_invest_plan_update)

UpdateAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_update=gate_api.AutoInvestPlanUpdate() # AutoInvestPlanUpdate | try:
# UpdateAuto invest planapi_instance.update_auto_invest_plan(auto_invest_plan_update)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->update_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_updateAutoInvestPlanUpdate

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Updated successfully-

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

stop_auto_invest_plan

stop_auto_invest_plan(auto_invest_plan_stop)

StopAuto invest plan

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_stop=gate_api.AutoInvestPlanStop() # AutoInvestPlanStop | try:
# StopAuto invest planapi_instance.stop_auto_invest_plan(auto_invest_plan_stop)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->stop_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_stopAutoInvestPlanStop

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Stopped successfully-

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

add_position_auto_invest_plan

add_position_auto_invest_plan(auto_invest_plan_add_position)

Add position immediately

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_plan_add_position=gate_api.AutoInvestPlanAddPosition() # AutoInvestPlanAddPosition | try:
# Add position immediatelyapi_instance.add_position_auto_invest_plan(auto_invest_plan_add_position)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->add_position_auto_invest_plan: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_plan_add_positionAutoInvestPlanAddPosition

Return type

void (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Add PositionSuccess-

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

list_auto_invest_coins

list[AutoInvestCoinsItem] list_auto_invest_coins(plan_money=plan_money)

QueryCurrencies supporting auto invest

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_money='USDT'# str | Pricing currency,Optional: USDT or BTC,Default: USDT (optional)try:
# QueryCurrencies supporting auto investapi_response=api_instance.list_auto_invest_coins(plan_money=plan_money)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_coins: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_moneystrPricing currency,Optional: USDT or BTC,Default: USDT[optional]

Return type

list[AutoInvestCoinsItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_min_amount

AutoInvestMinInvestAmountResp get_auto_invest_min_amount(auto_invest_min_invest_amount)

Get minimum investment amount

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
auto_invest_min_invest_amount=gate_api.AutoInvestMinInvestAmount() # AutoInvestMinInvestAmount | try:
# Get minimum investment amountapi_response=api_instance.get_auto_invest_min_amount(auto_invest_min_invest_amount)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_min_amount: %s\n"%e)

Parameters

NameTypeDescriptionNotes
auto_invest_min_invest_amountAutoInvestMinInvestAmount

Return type

AutoInvestMinInvestAmountResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plan_records

AutoInvestPlanRecordsResp list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)

List plan execution records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=141378# int | Plan IDpage=1# int | page number (optional)page_size=10# int | Items per page,Maximum 100 (optional)try:
# List plan execution recordsapi_response=api_instance.list_auto_invest_plan_records(plan_id, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plan_records: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanRecordsResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_orders

list[AutoInvestOrderItem] list_auto_invest_orders(plan_id, record_id)

List plan execution recordsDetails(OrderDetails)

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142583# int | Plan IDrecord_id=1770805384904919# int | Record IDtry:
# List plan execution recordsDetails(OrderDetails)api_response=api_instance.list_auto_invest_orders(plan_id, record_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID
record_idintRecord ID

Return type

list[AutoInvestOrderItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_config

list[AutoInvestConfigItem] list_auto_invest_config()

List investment currency configuration

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
try:
# List investment currency configurationapi_response=api_instance.list_auto_invest_config()
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_config: %s\n"%e)

Parameters

This endpoint does not need any parameter.

Return type

list[AutoInvestConfigItem]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

get_auto_invest_plan_detail

AutoInvestPlanDetail get_auto_invest_plan_detail(plan_id)

QueryAuto invest planDetails

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
plan_id=142609# int | Plan IDtry:
# QueryAuto invest planDetailsapi_response=api_instance.get_auto_invest_plan_detail(plan_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->get_auto_invest_plan_detail: %s\n"%e)

Parameters

NameTypeDescriptionNotes
plan_idintPlan ID

Return type

AutoInvestPlanDetail

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_auto_invest_plans

AutoInvestPlanListInfoResp list_auto_invest_plans(status, page=page, page_size=page_size)

QueryAuto invest planList

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
status='active'# str | Plan status,History history,Active activepage=56# int | page number (optional)page_size=56# int | Items per page,Maximum 100 (optional)try:
# QueryAuto invest planListapi_response=api_instance.list_auto_invest_plans(status, page=page, page_size=page_size)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_auto_invest_plans: %s\n"%e)

Parameters

NameTypeDescriptionNotes
statusstrPlan status,History history,Active active
pageintpage number[optional]
page_sizeintItems per page,Maximum 100[optional]

Return type

AutoInvestPlanListInfoResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successfully retrieved-

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

list_earn_fixed_term_products

ListEarnFixedTermProductsResponse list_earn_fixed_term_products(page, limit, asset=asset, type=type)

Get product list

Query fixed-term earn product list. Supports filtering by currency, product type, status, etc. Returns product interest rate, lock-up period, quota, and reward campaign information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
page=1# int | Page numberlimit=100# int | Page sizeasset='USDT'# str | Currency (optional)type=1# int | Product type: 1 for regular, 2 for VIP (optional)try:
# Get product listapi_response=api_instance.list_earn_fixed_term_products(page, limit, asset=asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products: %s\n"%e)

Parameters

NameTypeDescriptionNotes
pageintPage number
limitintPage size
assetstrCurrency[optional]
typeintProduct type: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermProductsResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Product list retrieved successfully-

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

list_earn_fixed_term_products_by_asset

ListEarnFixedTermProductsByAssetResponse list_earn_fixed_term_products_by_asset(asset, type=type)

Get product list by single currency

Sort by product term in ascending order

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 classapi_instance=gate_api.EarnApi(api_client)
asset='USDT'# str | Currency name, e.g., USDT, BTCtype='1'# str | Product type: \"\" or 1 for regular product list, 2 for VIP product list, 0 for all products (optional)try:
# Get product list by single currencyapi_response=api_instance.list_earn_fixed_term_products_by_asset(asset, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_products_by_asset: %s\n"%e)

Parameters

NameTypeDescriptionNotes
assetstrCurrency name, e.g., USDT, BTC
typestrProduct type: "" or 1 for regular product list, 2 for VIP product list, 0 for all products[optional]

Return type

ListEarnFixedTermProductsByAssetResponse

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Single currency product list retrieved successfully-

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

list_earn_fixed_term_lends

ListEarnFixedTermLendsResponse list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)

Subscription list

Query the user's fixed-term earn subscription order list. Supports filtering by product, currency, order type, etc. Returns order details, earnings, rewards, and interest rate boost coupon information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
order_type='1'# str | Order type: 1 for current orders, 2 for historical orderspage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id=56# int | Order ID (optional)asset='asset_example'# str | Currency (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription listapi_response=api_instance.list_earn_fixed_term_lends(order_type, page, limit, product_id=product_id, order_id=order_id, asset=asset, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_lends: %s\n"%e)

Parameters

NameTypeDescriptionNotes
order_typestrOrder type: 1 for current orders, 2 for historical orders
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idintOrder ID[optional]
assetstrCurrency[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermLendsResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription order list retrieved successfully-

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

create_earn_fixed_term_lend

CreateEarnFixedTermLendResponse create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)

Subscription

Subscribe to a fixed-term earn product by specifying the product ID and subscription amount. Optionally enable auto-renewal and apply an interest rate boost coupon

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
fixed_term_lend_request=gate_api.FixedTermLendRequest() # FixedTermLendRequest | (optional)try:
# Subscriptionapi_response=api_instance.create_earn_fixed_term_lend(fixed_term_lend_request=fixed_term_lend_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_lend: %s\n"%e)

Parameters

NameTypeDescriptionNotes
fixed_term_lend_requestFixedTermLendRequest[optional]

Return type

CreateEarnFixedTermLendResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Subscription successful-

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

create_earn_fixed_term_pre_redeem

CreateEarnFixedTermPreRedeemResponse create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)

Redeem

Early redemption of a fixed-term earn order, order ID is required

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
earn_fixed_term_pre_redeem_request=gate_api.EarnFixedTermPreRedeemRequest() # EarnFixedTermPreRedeemRequest | (optional)try:
# Redeemapi_response=api_instance.create_earn_fixed_term_pre_redeem(earn_fixed_term_pre_redeem_request=earn_fixed_term_pre_redeem_request)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->create_earn_fixed_term_pre_redeem: %s\n"%e)

Parameters

NameTypeDescriptionNotes
earn_fixed_term_pre_redeem_requestEarnFixedTermPreRedeemRequest[optional]

Return type

CreateEarnFixedTermPreRedeemResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Redemption successful-

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

list_earn_fixed_term_history

ListEarnFixedTermHistoryResponse list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)

Subscription history

Query the user's fixed-term earn history records. Supports filtering by type (subscription, redemption, interest, bonus rewards) and time range

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, 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 authorizationconfiguration=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 classapi_instance=gate_api.EarnApi(api_client)
type='1'# str | 1 for subscription, 2 for redemption, 3 for interest, 4 for bonus rewardpage=1# int | Page numberlimit=10# int | Page sizeproduct_id=56# int | Product ID (optional)order_id='order_id_example'# str | Order ID (optional)asset='asset_example'# str | Currency (optional)start_at=56# int | Start timestamp (optional)end_at=56# int | End Timestamp (optional)sub_business=56# int | Sub-business (optional)business_filter='[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]'# str | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP (optional)try:
# Subscription historyapi_response=api_instance.list_earn_fixed_term_history(type, page, limit, product_id=product_id, order_id=order_id, asset=asset, start_at=start_at, end_at=end_at, sub_business=sub_business, business_filter=business_filter)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling EarnApi->list_earn_fixed_term_history: %s\n"%e)

Parameters

NameTypeDescriptionNotes
typestr1 for subscription, 2 for redemption, 3 for interest, 4 for bonus reward
pageintPage number
limitintPage size
product_idintProduct ID[optional]
order_idstrOrder ID[optional]
assetstrCurrency[optional]
start_atintStart timestamp[optional]
end_atintEnd Timestamp[optional]
sub_businessintSub-business[optional]
business_filterstrBusiness filter conditions, JSON array format, e.g., [{"business":1, "sub_business": 0}]. business: 1 for regular, 2 for VIP[optional]

Return type

ListEarnFixedTermHistoryResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200History records retrieved successfully-

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