Skip to content

Latest commit

 

History

History
627 lines (436 loc) · 25 KB

File metadata and controls

627 lines (436 loc) · 25 KB

RebateApi

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

Method HTTP request Description
agencyTransactionHistory GET /rebate/agency/transaction_history Broker obtains transaction history of recommended users
agencyCommissionsHistory GET /rebate/agency/commission_history Broker obtains rebate history of recommended users
partnerTransactionHistory GET /rebate/partner/transaction_history Partner obtains transaction history of recommended users
partnerCommissionsHistory GET /rebate/partner/commission_history Partner obtains rebate records of recommended users
partnerSubList GET /rebate/partner/sub_list Partner subordinate list
rebateBrokerCommissionHistory GET /rebate/broker/commission_history Broker obtains user's rebate records
rebateBrokerTransactionHistory GET /rebate/broker/transaction_history Broker obtains user's trading history
rebateUserInfo GET /rebate/user/info User obtains rebate information
userSubRelation GET /rebate/user/sub_relation User subordinate relationship
getPartnerApplicationRecent GET /rebate/partner/applications/recent Get recent partner application records
getPartnerEligibility GET /rebate/partner/eligibility Check partner application eligibility
getPartnerAgentDataAggregated GET /rebate/partner/data/aggregated Aggregated partner agent statistics

agencyTransactionHistory

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

Broker obtains transaction history of recommended users

Record query time range cannot exceed 30 days

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.RebateApi(client);
const opts = {
  'currencyPair': "BTC_USDT", // string | Specify the trading pair. If not specified, returns all trading pairs
  'userId': 10003, // number | User ID. If not specified, all user records will be returned
  'from': 1602120000, // number | Start time for querying records. If not specified, defaults to 7 days before current time
  'to': 1602123600, // number | End timestamp for the query, defaults to current time if not specified
  'limit': 100, // number | Maximum number of records returned in a single list
  'offset': 0 // number | List offset, starting from 0
};
api.agencyTransactionHistory(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
currencyPair string Specify the trading pair. If not specified, returns all trading pairs [optional] [default to undefined]
userId number User ID. If not specified, all user records will be returned [optional] [default to undefined]
from number Start time for querying records. If not specified, defaults to 7 days before current time [optional] [default to undefined]
to number End timestamp for the query, defaults to current time if not specified [optional] [default to undefined]
limit number Maximum number of records returned in a single list [optional] [default to 100]
offset number List offset, starting from 0 [optional] [default to 0]

Return type

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

Authorization

apiv4

HTTP request headers

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

agencyCommissionsHistory

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

Broker obtains rebate history of recommended users

Record query time range cannot exceed 30 days

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.RebateApi(client);
const opts = {
  'currency': "BTC", // string | Specify the currency. If not specified, returns all currencies
  'commissionType': 1, // number | Rebate type: 1 - Direct rebate, 2 - Indirect rebate, 3 - Self rebate
  'userId': 10003, // number | User ID. If not specified, all user records will be returned
  'from': 1602120000, // number | Start time for querying records. If not specified, defaults to 7 days before current time
  'to': 1602123600, // number | End timestamp for the query, defaults to current time if not specified
  'limit': 100, // number | Maximum number of records returned in a single list
  'offset': 0 // number | List offset, starting from 0
};
api.agencyCommissionsHistory(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
currency string Specify the currency. If not specified, returns all currencies [optional] [default to undefined]
commissionType number Rebate type: 1 - Direct rebate, 2 - Indirect rebate, 3 - Self rebate [optional] [default to undefined]
userId number User ID. If not specified, all user records will be returned [optional] [default to undefined]
from number Start time for querying records. If not specified, defaults to 7 days before current time [optional] [default to undefined]
to number End timestamp for the query, defaults to current time if not specified [optional] [default to undefined]
limit number Maximum number of records returned in a single list [optional] [default to 100]
offset number List offset, starting from 0 [optional] [default to 0]

Return type

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

Authorization

apiv4

HTTP request headers

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

partnerTransactionHistory

Promise<{ response: http.IncomingMessage; body: PartnerTransactionHistory; }> partnerTransactionHistory(opts)

Partner obtains transaction history of recommended users

Record query time range cannot exceed 30 days

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.RebateApi(client);
const opts = {
  'currencyPair': "BTC_USDT", // string | Specify the trading pair. If not specified, returns all trading pairs
  'userId': 10003, // number | User ID. If not specified, all user records will be returned
  'from': 1602120000, // number | Start time for querying records. If not specified, defaults to 7 days before current time
  'to': 1602123600, // number | End timestamp for the query, defaults to current time if not specified
  'limit': 100, // number | Maximum number of records returned in a single list
  'offset': 0 // number | List offset, starting from 0
};
api.partnerTransactionHistory(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
currencyPair string Specify the trading pair. If not specified, returns all trading pairs [optional] [default to undefined]
userId number User ID. If not specified, all user records will be returned [optional] [default to undefined]
from number Start time for querying records. If not specified, defaults to 7 days before current time [optional] [default to undefined]
to number End timestamp for the query, defaults to current time if not specified [optional] [default to undefined]
limit number Maximum number of records returned in a single list [optional] [default to 100]
offset number List offset, starting from 0 [optional] [default to 0]

Return type

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

Authorization

apiv4

HTTP request headers

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

partnerCommissionsHistory

Promise<{ response: http.IncomingMessage; body: PartnerCommissionHistory; }> partnerCommissionsHistory(opts)

Partner obtains rebate records of recommended users

Record query time range cannot exceed 30 days

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.RebateApi(client);
const opts = {
  'currency': "BTC", // string | Specify the currency. If not specified, returns all currencies
  'userId': 10003, // number | User ID. If not specified, all user records will be returned
  'from': 1602120000, // number | Start time for querying records. If not specified, defaults to 7 days before current time
  'to': 1602123600, // number | End timestamp for the query, defaults to current time if not specified
  'limit': 100, // number | Maximum number of records returned in a single list
  'offset': 0 // number | List offset, starting from 0
};
api.partnerCommissionsHistory(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
currency string Specify the currency. If not specified, returns all currencies [optional] [default to undefined]
userId number User ID. If not specified, all user records will be returned [optional] [default to undefined]
from number Start time for querying records. If not specified, defaults to 7 days before current time [optional] [default to undefined]
to number End timestamp for the query, defaults to current time if not specified [optional] [default to undefined]
limit number Maximum number of records returned in a single list [optional] [default to 100]
offset number List offset, starting from 0 [optional] [default to 0]

Return type

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

Authorization

apiv4

HTTP request headers

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

partnerSubList

Promise<{ response: http.IncomingMessage; body: PartnerSubList; }> partnerSubList(opts)

Partner subordinate list

Including sub-agents, direct customers, and indirect customers

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.RebateApi(client);
const opts = {
  'userId': 10003, // number | User ID. If not specified, all user records will be returned
  'limit': 100, // number | Maximum number of records returned in a single list
  'offset': 0 // number | List offset, starting from 0
};
api.partnerSubList(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
userId number User ID. If not specified, all user records will be returned [optional] [default to undefined]
limit number Maximum number of records returned in a single list [optional] [default to 100]
offset number List offset, starting from 0 [optional] [default to 0]

Return type

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

Authorization

apiv4

HTTP request headers

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

rebateBrokerCommissionHistory

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

Broker obtains user&#39;s rebate records

Record query time range cannot exceed 30 days

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.RebateApi(client);
const opts = {
  'limit': 100, // number | Maximum number of records returned in a single list
  'offset': 0, // number | List offset, starting from 0
  'userId': 10003, // number | User ID. If not specified, all user records will be returned
  'from': 1711929600, // number | Start time of the query record. If not specified, defaults to 30 days before the current time
  'to': 1714521600 // number | End timestamp for the query, defaults to current time if not specified
};
api.rebateBrokerCommissionHistory(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
limit number Maximum number of records returned in a single list [optional] [default to 100]
offset number List offset, starting from 0 [optional] [default to 0]
userId number User ID. If not specified, all user records will be returned [optional] [default to undefined]
from number Start time of the query record. If not specified, defaults to 30 days before the current time [optional] [default to undefined]
to number End timestamp for the query, defaults to current time if not specified [optional] [default to undefined]

Return type

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

Authorization

apiv4

HTTP request headers

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

rebateBrokerTransactionHistory

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

Broker obtains user&#39;s trading history

Record query time range cannot exceed 30 days

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.RebateApi(client);
const opts = {
  'limit': 100, // number | Maximum number of records returned in a single list
  'offset': 0, // number | List offset, starting from 0
  'userId': 10003, // number | User ID. If not specified, all user records will be returned
  'from': 1711929600, // number | Start time of the query record. If not specified, defaults to 30 days before the current time
  'to': 1714521600 // number | End timestamp for the query, defaults to current time if not specified
};
api.rebateBrokerTransactionHistory(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
limit number Maximum number of records returned in a single list [optional] [default to 100]
offset number List offset, starting from 0 [optional] [default to 0]
userId number User ID. If not specified, all user records will be returned [optional] [default to undefined]
from number Start time of the query record. If not specified, defaults to 30 days before the current time [optional] [default to undefined]
to number End timestamp for the query, defaults to current time if not specified [optional] [default to undefined]

Return type

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

Authorization

apiv4

HTTP request headers

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

rebateUserInfo

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

User obtains rebate 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.RebateApi(client);
api.rebateUserInfo()
   .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; }> RebateUserInfo

Authorization

apiv4

HTTP request headers

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

userSubRelation

Promise<{ response: http.IncomingMessage; body: UserSubRelation; }> userSubRelation(userIdList)

User subordinate relationship

Query whether the specified user is within the system

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.RebateApi(client);
const userIdList = "1, 2, 3"; // string | Query user ID list, separated by commas. If more than 100, only 100 will be returned
api.userSubRelation(userIdList)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
userIdList string Query user ID list, separated by commas. If more than 100, only 100 will be returned [default to undefined]

Return type

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

Authorization

apiv4

HTTP request headers

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

getPartnerApplicationRecent

Promise<{ response: http.IncomingMessage; body: PartnerApplicationResponse; }> getPartnerApplicationRecent()

Get recent partner application records

获取当前用户最近的合伙人申请记录。 此接口返回用户最近 30 天内的申请记录,包括申请状态、审核信息、申请材料等详细信息。

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.RebateApi(client);
api.getPartnerApplicationRecent()
   .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: PartnerApplicationResponse; }> PartnerApplicationResponse

Authorization

apiv4

HTTP request headers

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

getPartnerEligibility

Promise<{ response: http.IncomingMessage; body: EligibilityResponse; }> getPartnerEligibility()

Check partner application eligibility

检查当前用户是否有资格申请成为合伙人。 此接口会检查多个条件: - 账户状态(是否被封禁) - 是否为子账号 - 是否已经是合伙人 - KYC 认证状态 - 是否在其他代理商的邀请链下 - 是否在黑名单中 - 其他业务规则限制

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.RebateApi(client);
api.getPartnerEligibility()
   .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: EligibilityResponse; }> EligibilityResponse

Authorization

apiv4

HTTP request headers

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

getPartnerAgentDataAggregated

Promise<{ response: http.IncomingMessage; body: PartnerDataAggregatedResponse; }> getPartnerAgentDataAggregated(opts)

Aggregated partner agent statistics

查询指定时间范围内合伙人代理的数据聚合统计,包括返佣金额、交易量、净手续费、客户数和交易人数。 注意事项: - 交易人数 `trading_user_count` 仅在 `business_type=0`(全部)时返回 - 时间参数使用 UTC+8 时区 - 如不传时间参数,默认查询近 7 天数据 - 仅限合伙人代理访问,子账号无权限

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.RebateApi(client);
const opts = {
  'startDate': "2024-01-01 00:00:00", // string | 查询开始时间,格式:yyyy-mm-dd hh:ii:ss(UTC+8)  不传时默认为近 7 日开始时间
  'endDate': "2024-01-07 23:59:59", // string | 查询结束时间,格式:yyyy-mm-dd hh:ii:ss(UTC+8)  不传时默认为近 7 日结束时间
  'businessType': 0 // 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Business type filter: - 0: All (default) - 1: Spot - 2: Futures - 3: Alpha - 4: Web3 - 5: Perps (DEX) - 6: Exchange All - 7: Web3 All - 8: TradFi
};
api.getPartnerAgentDataAggregated(opts)
   .then(value => console.log('API called successfully. Returned data: ', value.body),
         error => console.error(error));

Parameters

Name Type Description Notes
startDate string 查询开始时间,格式:yyyy-mm-dd hh:ii:ss(UTC+8) 不传时默认为近 7 日开始时间 [optional] [default to undefined]
endDate string 查询结束时间,格式:yyyy-mm-dd hh:ii:ss(UTC+8) 不传时默认为近 7 日结束时间 [optional] [default to undefined]
businessType BusinessType Business type filter: - 0: All (default) - 1: Spot - 2: Futures - 3: Alpha - 4: Web3 - 5: Perps (DEX) - 6: Exchange All - 7: Web3 All - 8: TradFi [optional] [default to 0]

Return type

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

Authorization

apiv4

HTTP request headers

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