Skip to content

Latest commit

 

History

History
1835 lines (1258 loc) · 62.6 KB

EarnApi.md

File metadata and controls

1835 lines (1258 loc) · 62.6 KB

EarnApi

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

Method HTTP request Description
listDualInvestmentPlans GET /earn/dual/investment_plan Dual Investment product list
listDualOrders GET /earn/dual/orders Dual Investment order list
placeDualOrder POST /earn/dual/orders Place Dual Investment order
listDualBalance GET /earn/dual/balance Dual-Currency Earning Assets
getDualOrderRefundPreview GET /earn/dual/order-refund-preview Dual-currency early redemption preview
placeDualOrderRefund POST /earn/dual/order-refund Dual-currency order early redemption
modifyDualOrderReinvest POST /earn/dual/modify-order-reinvest Modify dual-currency order reinvest
getDualProjectRecommend GET /earn/dual/project-recommend Dual-currency recommended projects
listDualStockInvestmentPlans GET /earn/dual/stock/investment_plan List stock dual investment products
getDualStockProjectRecommend GET /earn/dual/stock/project-recommend Get recommendations for stock dual investment products
listDualStockOrders GET /earn/dual/stock/orders List stock dual investment orders
placeDualStockOrder POST /earn/dual/stock/orders Place a stock dual investment order
listDualStockBalance GET /earn/dual/stock/balance Get stock dual investment asset statistics
getDualStockOrderRefundPreview GET /earn/dual/stock/order-refund-preview Preview stock dual investment redemption
placeDualStockOrderRefund POST /earn/dual/stock/order-refund Redeem a stock dual investment order
modifyDualStockOrderReinvest POST /earn/dual/stock/modify-order-reinvest Reinvest a stock dual investment order
findCoin GET /earn/staking/coins Staking coins
swapStakingCoin POST /earn/staking/swap On-chain token swap for earned coins
orderList GET /earn/staking/order_list List of on-chain coin-earning orders
awardList GET /earn/staking/award_list On-chain coin-earning dividend records
assetList GET /earn/staking/assets On-chain coin-earning assets
createAutoInvestPlan POST /earn/autoinvest/plans/create Create auto invest plan
updateAutoInvestPlan POST /earn/autoinvest/plans/update UpdateAuto invest plan
stopAutoInvestPlan POST /earn/autoinvest/plans/stop StopAuto invest plan
addPositionAutoInvestPlan POST /earn/autoinvest/plans/add_position Add position immediately
listAutoInvestCoins GET /earn/autoinvest/coins QueryCurrencies supporting auto invest
getAutoInvestMinAmount POST /earn/autoinvest/min_invest_amount Get minimum investment amount
listAutoInvestPlanRecords GET /earn/autoinvest/plans/records List plan execution records
listAutoInvestOrders GET /earn/autoinvest/orders List plan execution recordsDetails(OrderDetails)
listAutoInvestConfig GET /earn/autoinvest/config List investment currency configuration
getAutoInvestPlanDetail GET /earn/autoinvest/plans/detail QueryAuto invest planDetails
listAutoInvestPlans GET /earn/autoinvest/plans/list_info QueryAuto invest planList
listEarnFixedTermProducts GET /earn/fixed-term/product Get product list
listEarnFixedTermProductsByAsset GET /earn/fixed-term/product/{asset}/list Get product list by single currency
listEarnFixedTermLends GET /earn/fixed-term/user/lend Subscription list
createEarnFixedTermLend POST /earn/fixed-term/user/lend Subscription
createEarnFixedTermPreRedeem POST /earn/fixed-term/user/pre-redeem Redeem
listEarnFixedTermHistory GET /earn/fixed-term/user/history Subscription history

listDualInvestmentPlans

Promise<{ response: http.IncomingMessage; body: Array; }> listDualInvestmentPlans(opts)

Dual Investment product list

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"

const api = new GateApi.EarnApi(client);
const opts = {
  'planId': BigInt('1'), // number | Financial project ID
  'coin': "BTC", // string | Investment Token
  'type': "call", // string | Type enum: `put` — buy low; `call` — sell high
  'quoteCurrency': "quoteCurrency_example", // string | Settlement currency enum: defaults to USDT; GUSD optional
  'sort': "sort_example", // string | Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first
  'page': 1, // number | page number
  'pageSize': 3 // number | Items per page
};
api.listDualInvestmentPlans(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
planId number | bigint Financial project ID [optional] [default to undefined]
coin string Investment Token [optional] [default to undefined]
type string Type enum: `put` — buy low; `call` — sell high [optional] [default to undefined]
quoteCurrency string Settlement currency enum: defaults to USDT; GUSD optional [optional] [default to undefined]
sort string Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first [optional] [default to undefined]
page number page number [optional] [default to undefined]
pageSize number Items per page [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> DualGetPlans

Authorization

No authorization required

HTTP request headers

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

listDualOrders

Promise<{ response: http.IncomingMessage; body: Array; }> listDualOrders(opts)

Dual Investment order list

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const opts = {
  'from': BigInt('1740727000'), // number | Start settlement time
  'to': BigInt('1740729000'), // number | End settlement time
  'type': "put", // string | Type enum: `put` — buy low; `call` — sell high
  'status': "HOLD", // string | Order status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all
  'coin': "BTC", // string | Investment Token
  'page': 1, // number | Page number
  'limit': 100 // number | Maximum number of records returned in a single list
};
api.listDualOrders(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
from number | bigint Start settlement time [optional] [default to undefined]
to number | bigint End settlement time [optional] [default to undefined]
type string Type enum: `put` — buy low; `call` — sell high [optional] [default to undefined]
status string Order status enum: `HOLD` — open position `REPAY` — historical position `PROCESSING` — position active `SETTLEMENT_PROCESSING` — settlement in progress `ALL` — all [optional] [default to undefined]
coin string Investment Token [optional] [default to undefined]
page number Page number [optional] [default to 1]
limit number Maximum number of records returned in a single list [optional] [default to 100]

Return type

Promise<{ response: AxiosResponse; body: Array; }> DualGetOrders

Authorization

apiv4

HTTP request headers

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

placeDualOrder

Promise<{ response: http.IncomingMessage; body: PlaceDualInvestmentOrder; }> placeDualOrder(placeDualInvestmentOrderParams)

Place Dual Investment order

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const placeDualInvestmentOrderParams = new PlaceDualInvestmentOrderParams(); // PlaceDualInvestmentOrderParams | 
api.placeDualOrder(placeDualInvestmentOrderParams)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
placeDualInvestmentOrderParams PlaceDualInvestmentOrderParams

Return type

Promise<{ response: AxiosResponse; body: PlaceDualInvestmentOrder; }> PlaceDualInvestmentOrder

Authorization

apiv4

HTTP request headers

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

listDualBalance

Promise<{ response: http.IncomingMessage; body: DualGetBalance; }> listDualBalance()

Dual-Currency Earning Assets

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
api.listDualBalance()
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

This endpoint does not need any parameter.

Return type

Promise<{ response: AxiosResponse; body: DualGetBalance; }> DualGetBalance

Authorization

apiv4

HTTP request headers

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

getDualOrderRefundPreview

Promise<{ response: http.IncomingMessage; body: DualOrderRefundPreview; }> getDualOrderRefundPreview(orderId)

Dual-currency early redemption preview

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const orderId = "9497"; // string | Order ID
api.getDualOrderRefundPreview(orderId)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
orderId string Order ID [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: DualOrderRefundPreview; }> DualOrderRefundPreview

Authorization

apiv4

HTTP request headers

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

placeDualOrderRefund

Promise<{ response: http.IncomingMessage; body?: any; }> placeDualOrderRefund(dualOrderRefundParams)

Dual-currency order early redemption

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const dualOrderRefundParams = new DualOrderRefundParams(); // DualOrderRefundParams | 
api.placeDualOrderRefund(dualOrderRefundParams)
   .then(value => console.log('API called successfully.'),
         error => console.error(error));

Parameters

Name Type Description Notes
dualOrderRefundParams DualOrderRefundParams

Return type

Promise<{ response: AxiosResponse; body?: any; }>

Authorization

apiv4

HTTP request headers

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

modifyDualOrderReinvest

Promise<{ response: http.IncomingMessage; body?: any; }> modifyDualOrderReinvest(dualModifyOrderReinvestParams)

Modify dual-currency order reinvest

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const dualModifyOrderReinvestParams = new DualModifyOrderReinvestParams(); // DualModifyOrderReinvestParams | 
api.modifyDualOrderReinvest(dualModifyOrderReinvestParams)
   .then(value => console.log('API called successfully.'),
         error => console.error(error));

Parameters

Name Type Description Notes
dualModifyOrderReinvestParams DualModifyOrderReinvestParams

Return type

Promise<{ response: AxiosResponse; body?: any; }>

Authorization

apiv4

HTTP request headers

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

getDualProjectRecommend

Promise<{ response: http.IncomingMessage; body: Array; }> getDualProjectRecommend(opts)

Dual-currency recommended projects

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const opts = {
  'mode': "normal", // string | 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
  'coin': "ETH", // string | Investment Token
  'type': "call", // string | `call`: sell high; `put`: buy low
  'historyPids': "110656,110652" // string | Comma-separated project IDs to exclude already recommended items
};
api.getDualProjectRecommend(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
mode string 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] [default to undefined]
coin string Investment Token [optional] [default to undefined]
type string `call`: sell high; `put`: buy low [optional] [default to undefined]
historyPids string Comma-separated project IDs to exclude already recommended items [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> DualProjectRecommend

Authorization

apiv4

HTTP request headers

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

listDualStockInvestmentPlans

Promise<{ response: http.IncomingMessage; body: Array; }> listDualStockInvestmentPlans(opts)

List stock dual investment products

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"

const api = new GateApi.EarnApi(client);
const opts = {
  'planId': "272", // string | Product/plan ID. If provided, only the matching product is returned
  'coin': "BTC", // string | Underlying currency
  'type': "call", // 'call' | 'put' | Type enum: `put` — buy low; `call` — sell high
  'quoteCurrency': 'USDT', // string | Settlement currency. Default: USDT
  'sort': "sort_example", // string | Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first
  'page': 1, // number | page number
  'pageSize': 100 // number | Items per page,Maximum 100
};
api.listDualStockInvestmentPlans(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
planId string Product/plan ID. If provided, only the matching product is returned [optional] [default to undefined]
coin string Underlying currency [optional] [default to undefined]
type Type Type enum: `put` — buy low; `call` — sell high [optional] [default to undefined]
quoteCurrency string Settlement currency. Default: USDT [optional] [default to 'USDT']
sort string Sort field enum: `apy` — highest APY first `short-period` — shortest tenor first `multiple` — highest premium first [optional] [default to undefined]
page number page number [optional] [default to undefined]
pageSize number Items per page,Maximum 100 [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> DualGetPlans

Authorization

No authorization required

HTTP request headers

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

getDualStockProjectRecommend

Promise<{ response: http.IncomingMessage; body: Array; }> getDualStockProjectRecommend(opts)

Get recommendations for stock dual investment products

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"

const api = new GateApi.EarnApi(client);
const opts = {
  'coin': "BTC", // string | Underlying currency
  'type': "call", // 'call' | 'put' | `call`: sell high; `put`: buy low
  'mode': 'normal', // 'normal' | 'senior' | Recommendation mode. Default: normal normal: Regular users senior: Experienced users
  'historyPids': "1001,1002" // string | Previously recommended project IDs, separated by commas
};
api.getDualStockProjectRecommend(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
coin string Underlying currency [optional] [default to undefined]
type Type `call`: sell high; `put`: buy low [optional] [default to undefined]
mode Mode Recommendation mode. Default: normal normal: Regular users senior: Experienced users [optional] [default to 'normal']
historyPids string Previously recommended project IDs, separated by commas [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> DualProjectRecommend

Authorization

No authorization required

HTTP request headers

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

listDualStockOrders

Promise<{ response: http.IncomingMessage; body: Array; }> listDualStockOrders(opts)

List stock dual investment orders

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const opts = {
  'coin': "BTC", // string | Investment Token
  'status': 'ALL', // string | Filter by order status. Default: ALL HOLD: Current holdings REPAY: Historical holdings PROCESSING: Holding in progress SETTLEMENT_PROCESSING: Settlement in progress ALL: All orders
  'type': "put", // 'call' | 'put' | Type enum: `put` — buy low; `call` — sell high
  'from': BigInt('1740727000'), // number | Start of the time range, in Unix seconds
  'to': BigInt('1740729000'), // number | End of the time range, in Unix seconds
  'page': 1, // number | Page number
  'pageSize': 100, // number | Number of records per page, up to 100. Defaults to 100 when omitted
  'limit': 100 // number | Maximum number of records returned in a single list
};
api.listDualStockOrders(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
coin string Investment Token [optional] [default to undefined]
status string Filter by order status. Default: ALL HOLD: Current holdings REPAY: Historical holdings PROCESSING: Holding in progress SETTLEMENT_PROCESSING: Settlement in progress ALL: All orders [optional] [default to 'ALL']
type Type Type enum: `put` — buy low; `call` — sell high [optional] [default to undefined]
from number | bigint Start of the time range, in Unix seconds [optional] [default to undefined]
to number | bigint End of the time range, in Unix seconds [optional] [default to undefined]
page number Page number [optional] [default to 1]
pageSize number Number of records per page, up to 100. Defaults to 100 when omitted [optional] [default to undefined]
limit number Maximum number of records returned in a single list [optional] [default to 100]

Return type

Promise<{ response: AxiosResponse; body: Array; }> DualGetOrders

Authorization

apiv4

HTTP request headers

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

placeDualStockOrder

Promise<{ response: http.IncomingMessage; body: PlaceDualInvestmentOrder; }> placeDualStockOrder(placeDualStockInvestmentOrderParams)

Place a stock dual investment order

For buy-low (put) products, optionally pass `hit_spot`, `hit_stock`, and `hit_simple` (`1` selects the corresponding funding account) to collect funds from the spot, stock, or Simple Earn accounts before subscribing.

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const placeDualStockInvestmentOrderParams = new PlaceDualStockInvestmentOrderParams(); // PlaceDualStockInvestmentOrderParams | 
api.placeDualStockOrder(placeDualStockInvestmentOrderParams)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
placeDualStockInvestmentOrderParams PlaceDualStockInvestmentOrderParams

Return type

Promise<{ response: AxiosResponse; body: PlaceDualInvestmentOrder; }> PlaceDualInvestmentOrder

Authorization

apiv4

HTTP request headers

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

listDualStockBalance

Promise<{ response: http.IncomingMessage; body: DualGetBalance; }> listDualStockBalance()

Get stock dual investment asset statistics

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
api.listDualStockBalance()
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

This endpoint does not need any parameter.

Return type

Promise<{ response: AxiosResponse; body: DualGetBalance; }> DualGetBalance

Authorization

apiv4

HTTP request headers

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

getDualStockOrderRefundPreview

Promise<{ response: http.IncomingMessage; body: DualOrderRefundPreview; }> getDualStockOrderRefundPreview(orderId)

Preview stock dual investment redemption

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const orderId = "9497"; // string | Order ID
api.getDualStockOrderRefundPreview(orderId)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
orderId string Order ID [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: DualOrderRefundPreview; }> DualOrderRefundPreview

Authorization

apiv4

HTTP request headers

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

placeDualStockOrderRefund

Promise<{ response: http.IncomingMessage; body?: any; }> placeDualStockOrderRefund(dualOrderRefundParams)

Redeem a stock dual investment order

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const dualOrderRefundParams = new DualOrderRefundParams(); // DualOrderRefundParams | 
api.placeDualStockOrderRefund(dualOrderRefundParams)
   .then(value => console.log('API called successfully.'),
         error => console.error(error));

Parameters

Name Type Description Notes
dualOrderRefundParams DualOrderRefundParams

Return type

Promise<{ response: AxiosResponse; body?: any; }>

Authorization

apiv4

HTTP request headers

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

modifyDualStockOrderReinvest

Promise<{ response: http.IncomingMessage; body?: any; }> modifyDualStockOrderReinvest(dualModifyOrderReinvestParams)

Reinvest a stock dual investment order

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const dualModifyOrderReinvestParams = new DualModifyOrderReinvestParams(); // DualModifyOrderReinvestParams | 
api.modifyDualStockOrderReinvest(dualModifyOrderReinvestParams)
   .then(value => console.log('API called successfully.'),
         error => console.error(error));

Parameters

Name Type Description Notes
dualModifyOrderReinvestParams DualModifyOrderReinvestParams

Return type

Promise<{ response: AxiosResponse; body?: any; }>

Authorization

apiv4

HTTP request headers

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

findCoin

Promise<{ response: http.IncomingMessage; body: Array; }> findCoin(opts)

Staking coins

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const opts = {
  'cointype': "cointype_example" // string | Currency type: swap - voucher; lock - locked position; debt - US Treasury bond.
};
api.findCoin(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
cointype string Currency type: swap - voucher; lock - locked position; debt - US Treasury bond. [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> FindCoinStructItem

Authorization

apiv4

HTTP request headers

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

swapStakingCoin

Promise<{ response: http.IncomingMessage; body: SwapCoinStruct; }> swapStakingCoin(swapCoin)

On-chain token swap for earned coins

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const swapCoin = new SwapCoin(); // SwapCoin | 
api.swapStakingCoin(swapCoin)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
swapCoin SwapCoin

Return type

Promise<{ response: AxiosResponse; body: SwapCoinStruct; }> SwapCoinStruct

Authorization

apiv4

HTTP request headers

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

orderList

Promise<{ response: http.IncomingMessage; body: OrderListStruct; }> orderList(opts)

List of on-chain coin-earning orders

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const opts = {
  'pid': 7, // number | Product ID
  'coin': "ETH", // string | Currency name
  'type': 0, // number | Type 0-staking 1-redemption
  'page': 1 // number | Page number
};
api.orderList(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
pid number Product ID [optional] [default to undefined]
coin string Currency name [optional] [default to undefined]
type number Type 0-staking 1-redemption [optional] [default to undefined]
page number Page number [optional] [default to 1]

Return type

Promise<{ response: AxiosResponse; body: OrderListStruct; }> OrderListStruct

Authorization

apiv4

HTTP request headers

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

awardList

Promise<{ response: http.IncomingMessage; body: AwardListStruct; }> awardList(opts)

On-chain coin-earning dividend records

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const opts = {
  'pid': 7, // number | Product ID
  'coin': "ETH", // string | Currency name
  'page': 1 // number | Page number
};
api.awardList(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
pid number Product ID [optional] [default to undefined]
coin string Currency name [optional] [default to undefined]
page number Page number [optional] [default to 1]

Return type

Promise<{ response: AxiosResponse; body: AwardListStruct; }> AwardListStruct

Authorization

apiv4

HTTP request headers

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

assetList

Promise<{ response: http.IncomingMessage; body: Array; }> assetList(opts)

On-chain coin-earning assets

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const opts = {
  'coin': "ETH" // string | Currency name
};
api.assetList(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
coin string Currency name [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> AssetListStructItem

Authorization

apiv4

HTTP request headers

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

createAutoInvestPlan

Promise<{ response: http.IncomingMessage; body: AutoInvestPlanCreateResp; }> createAutoInvestPlan(autoInvestPlanCreate)

Create auto invest plan

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const autoInvestPlanCreate = new AutoInvestPlanCreate(); // AutoInvestPlanCreate | 
api.createAutoInvestPlan(autoInvestPlanCreate)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
autoInvestPlanCreate AutoInvestPlanCreate

Return type

Promise<{ response: AxiosResponse; body: AutoInvestPlanCreateResp; }> AutoInvestPlanCreateResp

Authorization

apiv4

HTTP request headers

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

updateAutoInvestPlan

Promise<{ response: http.IncomingMessage; body?: any; }> updateAutoInvestPlan(autoInvestPlanUpdate)

UpdateAuto invest plan

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const autoInvestPlanUpdate = new AutoInvestPlanUpdate(); // AutoInvestPlanUpdate | 
api.updateAutoInvestPlan(autoInvestPlanUpdate)
   .then(value => console.log('API called successfully.'),
         error => console.error(error));

Parameters

Name Type Description Notes
autoInvestPlanUpdate AutoInvestPlanUpdate

Return type

Promise<{ response: AxiosResponse; body?: any; }>

Authorization

apiv4

HTTP request headers

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

stopAutoInvestPlan

Promise<{ response: http.IncomingMessage; body?: any; }> stopAutoInvestPlan(autoInvestPlanStop)

StopAuto invest plan

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const autoInvestPlanStop = new AutoInvestPlanStop(); // AutoInvestPlanStop | 
api.stopAutoInvestPlan(autoInvestPlanStop)
   .then(value => console.log('API called successfully.'),
         error => console.error(error));

Parameters

Name Type Description Notes
autoInvestPlanStop AutoInvestPlanStop

Return type

Promise<{ response: AxiosResponse; body?: any; }>

Authorization

apiv4

HTTP request headers

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

addPositionAutoInvestPlan

Promise<{ response: http.IncomingMessage; body?: any; }> addPositionAutoInvestPlan(autoInvestPlanAddPosition)

Add position immediately

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const autoInvestPlanAddPosition = new AutoInvestPlanAddPosition(); // AutoInvestPlanAddPosition | 
api.addPositionAutoInvestPlan(autoInvestPlanAddPosition)
   .then(value => console.log('API called successfully.'),
         error => console.error(error));

Parameters

Name Type Description Notes
autoInvestPlanAddPosition AutoInvestPlanAddPosition

Return type

Promise<{ response: AxiosResponse; body?: any; }>

Authorization

apiv4

HTTP request headers

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

listAutoInvestCoins

Promise<{ response: http.IncomingMessage; body: Array; }> listAutoInvestCoins(opts)

QueryCurrencies supporting auto invest

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const opts = {
  'planMoney': "USDT" // string | Pricing currency,Optional: USDT or BTC,Default: USDT
};
api.listAutoInvestCoins(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
planMoney string Pricing currency,Optional: USDT or BTC,Default: USDT [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> AutoInvestCoinsItem

Authorization

apiv4

HTTP request headers

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

getAutoInvestMinAmount

Promise<{ response: http.IncomingMessage; body: AutoInvestMinInvestAmountResp; }> getAutoInvestMinAmount(autoInvestMinInvestAmount)

Get minimum investment amount

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const autoInvestMinInvestAmount = new AutoInvestMinInvestAmount(); // AutoInvestMinInvestAmount | 
api.getAutoInvestMinAmount(autoInvestMinInvestAmount)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
autoInvestMinInvestAmount AutoInvestMinInvestAmount

Return type

Promise<{ response: AxiosResponse; body: AutoInvestMinInvestAmountResp; }> AutoInvestMinInvestAmountResp

Authorization

apiv4

HTTP request headers

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

listAutoInvestPlanRecords

Promise<{ response: http.IncomingMessage; body: AutoInvestPlanRecordsResp; }> listAutoInvestPlanRecords(planId, opts)

List plan execution records

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const planId = BigInt('141378'); // number | Plan ID
const opts = {
  'page': BigInt('1'), // number | page number
  'pageSize': BigInt('10') // number | Items per page,Maximum 100
};
api.listAutoInvestPlanRecords(planId, opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
planId number | bigint Plan ID [default to undefined]
page number | bigint page number [optional] [default to undefined]
pageSize number | bigint Items per page,Maximum 100 [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: AutoInvestPlanRecordsResp; }> AutoInvestPlanRecordsResp

Authorization

apiv4

HTTP request headers

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

listAutoInvestOrders

Promise<{ response: http.IncomingMessage; body: Array; }> listAutoInvestOrders(planId, recordId)

List plan execution recordsDetails(OrderDetails)

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const planId = BigInt('142583'); // number | Plan ID
const recordId = BigInt('1770805384904919'); // number | Record ID
api.listAutoInvestOrders(planId, recordId)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
planId number | bigint Plan ID [default to undefined]
recordId number | bigint Record ID [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: Array; }> AutoInvestOrderItem

Authorization

apiv4

HTTP request headers

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

listAutoInvestConfig

Promise<{ response: http.IncomingMessage; body: Array; }> listAutoInvestConfig()

List investment currency configuration

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
api.listAutoInvestConfig()
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

This endpoint does not need any parameter.

Return type

Promise<{ response: AxiosResponse; body: Array; }> AutoInvestConfigItem

Authorization

apiv4

HTTP request headers

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

getAutoInvestPlanDetail

Promise<{ response: http.IncomingMessage; body: AutoInvestPlanDetail; }> getAutoInvestPlanDetail(planId)

QueryAuto invest planDetails

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const planId = BigInt('142609'); // number | Plan ID
api.getAutoInvestPlanDetail(planId)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
planId number | bigint Plan ID [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: AutoInvestPlanDetail; }> AutoInvestPlanDetail

Authorization

apiv4

HTTP request headers

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

listAutoInvestPlans

Promise<{ response: http.IncomingMessage; body: AutoInvestPlanListInfoResp; }> listAutoInvestPlans(status, opts)

QueryAuto invest planList

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const status = "active"; // string | Plan status,History history,Active active
const opts = {
  'page': BigInt('56'), // number | page number
  'pageSize': BigInt('56') // number | Items per page,Maximum 100
};
api.listAutoInvestPlans(status, opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
status string Plan status,History history,Active active [default to undefined]
page number | bigint page number [optional] [default to undefined]
pageSize number | bigint Items per page,Maximum 100 [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: AutoInvestPlanListInfoResp; }> AutoInvestPlanListInfoResp

Authorization

apiv4

HTTP request headers

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

listEarnFixedTermProducts

Promise<{ response: http.IncomingMessage; body: ListEarnFixedTermProductsResponse; }> listEarnFixedTermProducts(page, limit, opts)

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

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"

const api = new GateApi.EarnApi(client);
const page = 1; // number | Page number
const limit = 100; // number | Page size
const opts = {
  'asset': "USDT", // string | Currency
  'type': 1, // number | Product type: 1 for regular, 2 for VIP
  'status': 2, // number | Product status filter. Pass 2 for products available for subscription.
  'showStatus': "2" // string | Visibility status filter. Pass \"2\" for visible products.
};
api.listEarnFixedTermProducts(page, limit, opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
page number Page number [default to undefined]
limit number Page size [default to undefined]
asset string Currency [optional] [default to undefined]
type number Product type: 1 for regular, 2 for VIP [optional] [default to undefined]
status number Product status filter. Pass 2 for products available for subscription. [optional] [default to undefined]
showStatus string Visibility status filter. Pass &quot;2&quot; for visible products. [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: ListEarnFixedTermProductsResponse; }> ListEarnFixedTermProductsResponse

Authorization

No authorization required

HTTP request headers

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

listEarnFixedTermProductsByAsset

Promise<{ response: http.IncomingMessage; body: ListEarnFixedTermProductsByAssetResponse; }> listEarnFixedTermProductsByAsset(asset, opts)

Get product list by single currency

Sort by product term in ascending order

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"

const api = new GateApi.EarnApi(client);
const asset = "USDT"; // string | Currency name, e.g., USDT, BTC
const opts = {
  'type': "1" // string | Product type: \"\" or 1 for regular product list, 2 for VIP product list, 0 for all products
};
api.listEarnFixedTermProductsByAsset(asset, opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
asset string Currency name, e.g., USDT, BTC [default to undefined]
type string Product type: &quot;&quot; or 1 for regular product list, 2 for VIP product list, 0 for all products [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: ListEarnFixedTermProductsByAssetResponse; }> ListEarnFixedTermProductsByAssetResponse

Authorization

No authorization required

HTTP request headers

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

listEarnFixedTermLends

Promise<{ response: http.IncomingMessage; body: ListEarnFixedTermLendsResponse; }> listEarnFixedTermLends(orderType, page, limit, opts)

Subscription list

Query the user&#39;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

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const orderType = "1"; // string | Order type: 1 for current orders, 2 for historical orders
const page = 1; // number | Page number
const limit = 10; // number | Page size
const opts = {
  'productId': 56, // number | Product ID
  'orderId': BigInt('56'), // number | Order ID
  'asset': "asset_example", // string | Currency
  'subBusiness': 56, // number | Sub-business
  'businessFilter': "[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]" // string | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP
};
api.listEarnFixedTermLends(orderType, page, limit, opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
orderType string Order type: 1 for current orders, 2 for historical orders [default to undefined]
page number Page number [default to undefined]
limit number Page size [default to undefined]
productId number Product ID [optional] [default to undefined]
orderId number | bigint Order ID [optional] [default to undefined]
asset string Currency [optional] [default to undefined]
subBusiness number Sub-business [optional] [default to undefined]
businessFilter string Business filter conditions, JSON array format, e.g., [{&quot;business&quot;:1, &quot;sub_business&quot;: 0}]. business: 1 for regular, 2 for VIP [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: ListEarnFixedTermLendsResponse; }> ListEarnFixedTermLendsResponse

Authorization

apiv4

HTTP request headers

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

createEarnFixedTermLend

Promise<{ response: http.IncomingMessage; body: CreateEarnFixedTermLendResponse; }> createEarnFixedTermLend(opts)

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

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const opts = {
  'fixedTermLendRequest': new FixedTermLendRequest() // FixedTermLendRequest | 
};
api.createEarnFixedTermLend(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
fixedTermLendRequest FixedTermLendRequest [optional]

Return type

Promise<{ response: AxiosResponse; body: CreateEarnFixedTermLendResponse; }> CreateEarnFixedTermLendResponse

Authorization

apiv4

HTTP request headers

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

createEarnFixedTermPreRedeem

Promise<{ response: http.IncomingMessage; body: CreateEarnFixedTermPreRedeemResponse; }> createEarnFixedTermPreRedeem(opts)

Redeem

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

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const opts = {
  'earnFixedTermPreRedeemRequest': new EarnFixedTermPreRedeemRequest() // EarnFixedTermPreRedeemRequest | 
};
api.createEarnFixedTermPreRedeem(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
earnFixedTermPreRedeemRequest EarnFixedTermPreRedeemRequest [optional]

Return type

Promise<{ response: AxiosResponse; body: CreateEarnFixedTermPreRedeemResponse; }> CreateEarnFixedTermPreRedeemResponse

Authorization

apiv4

HTTP request headers

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

listEarnFixedTermHistory

Promise<{ response: http.IncomingMessage; body: ListEarnFixedTermHistoryResponse; }> listEarnFixedTermHistory(type, page, limit, opts)

Subscription history

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

Example

const GateApi = require('gate-api');
const client = new GateApi.ApiClient();
// uncomment the next line to change base path
// client.basePath = "https://some-other-host"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");

const api = new GateApi.EarnApi(client);
const type = "1"; // string | 1 for subscription, 2 for redemption, 3 for interest, 4 for bonus reward
const page = 1; // number | Page number
const limit = 10; // number | Page size
const opts = {
  'productId': 56, // number | Product ID
  'orderId': "orderId_example", // string | Order ID
  'asset': "asset_example", // string | Currency
  'startAt': 56, // number | Start timestamp
  'endAt': 56, // number | End Timestamp
  'subBusiness': 56, // number | Sub-business
  'businessFilter': "[{\"business\":1, \"sub_business\": 0},{\"business\":2, \"sub_business\": 0}]" // string | Business filter conditions, JSON array format, e.g., [{\"business\":1, \"sub_business\": 0}]. business: 1 for regular, 2 for VIP
};
api.listEarnFixedTermHistory(type, page, limit, opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
type string 1 for subscription, 2 for redemption, 3 for interest, 4 for bonus reward [default to undefined]
page number Page number [default to undefined]
limit number Page size [default to undefined]
productId number Product ID [optional] [default to undefined]
orderId string Order ID [optional] [default to undefined]
asset string Currency [optional] [default to undefined]
startAt number Start timestamp [optional] [default to undefined]
endAt number End Timestamp [optional] [default to undefined]
subBusiness number Sub-business [optional] [default to undefined]
businessFilter string Business filter conditions, JSON array format, e.g., [{&quot;business&quot;:1, &quot;sub_business&quot;: 0}]. business: 1 for regular, 2 for VIP [optional] [default to undefined]

Return type

Promise<{ response: AxiosResponse; body: ListEarnFixedTermHistoryResponse; }> ListEarnFixedTermHistoryResponse

Authorization

apiv4

HTTP request headers

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