All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
listCurrencyChains | GET /wallet/currency_chains | List chains supported for specified currency |
getDepositAddress | GET /wallet/deposit_address | Generate currency deposit address |
listWithdrawals | GET /wallet/withdrawals | Retrieve withdrawal records |
listDeposits | GET /wallet/deposits | Retrieve deposit records |
transfer | POST /wallet/transfers | Transfer between trading accounts |
listSubAccountTransfers | GET /wallet/sub_account_transfers | Retrieve transfer records between main and sub accounts |
transferWithSubAccount | POST /wallet/sub_account_transfers | Transfer between main and sub accounts |
subAccountToSubAccount | POST /wallet/sub_account_to_sub_account | Sub-account transfers to sub-account |
listWithdrawStatus | GET /wallet/withdraw_status | Retrieve withdrawal status |
listSubAccountBalances | GET /wallet/sub_account_balances | Retrieve sub account balances |
listSubAccountMarginBalances | GET /wallet/sub_account_margin_balances | Query sub accounts' margin balances |
listSubAccountFuturesBalances | GET /wallet/sub_account_futures_balances | Query sub accounts' futures account balances |
listSubAccountCrossMarginBalances | GET /wallet/sub_account_cross_margin_balances | Query subaccount's cross_margin account info |
listSavedAddress | GET /wallet/saved_address | Query saved address |
getTradeFee | GET /wallet/fee | Retrieve personal trading fee |
getTotalBalance | GET /wallet/total_balance | Retrieve user's total balances |
Promise<{ response: http.IncomingMessage; body: Array; }> listCurrencyChains(currency)
List chains supported for specified currency
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.WalletApi(client);
const currency = "GT"; // string | Currency name
api.listCurrencyChains(currency)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currency | string | Currency name | [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> CurrencyChain
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: DepositAddress; }> getDepositAddress(currency)
Generate currency deposit address
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.WalletApi(client);
const currency = "USDT"; // string | Currency name
api.getDepositAddress(currency)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currency | string | Currency name | [default to undefined] |
Promise<{ response: AxiosResponse; body: DepositAddress; }> DepositAddress
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listWithdrawals(opts)
Retrieve withdrawal records
Record time range cannot exceed 30 days
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.WalletApi(client);
const opts = {
'currency': "BTC", // string | Filter by currency. Return all currency records if not specified
'from': 1602120000, // number | Time range beginning, default to 7 days before current time
'to': 1602123600, // number | Time range ending, default to current time
'limit': 100, // number | Maximum number of records to be returned in a single list
'offset': 0 // number | List offset, starting from 0
};
api.listWithdrawals(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currency | string | Filter by currency. Return all currency records if not specified | [optional] [default to undefined] |
from | number | Time range beginning, default to 7 days before current time | [optional] [default to undefined] |
to | number | Time range ending, default to current time | [optional] [default to undefined] |
limit | number | Maximum number of records to be returned in a single list | [optional] [default to 100] |
offset | number | List offset, starting from 0 | [optional] [default to 0] |
Promise<{ response: AxiosResponse; body: Array; }> WithdrawalRecord
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listDeposits(opts)
Retrieve deposit records
Record time range cannot exceed 30 days
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.WalletApi(client);
const opts = {
'currency': "BTC", // string | Filter by currency. Return all currency records if not specified
'from': 1602120000, // number | Time range beginning, default to 7 days before current time
'to': 1602123600, // number | Time range ending, default to current time
'limit': 100, // number | Maximum number of records to be returned in a single list
'offset': 0 // number | List offset, starting from 0
};
api.listDeposits(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currency | string | Filter by currency. Return all currency records if not specified | [optional] [default to undefined] |
from | number | Time range beginning, default to 7 days before current time | [optional] [default to undefined] |
to | number | Time range ending, default to current time | [optional] [default to undefined] |
limit | number | Maximum number of records to be returned in a single list | [optional] [default to 100] |
offset | number | List offset, starting from 0 | [optional] [default to 0] |
Promise<{ response: AxiosResponse; body: Array; }> LedgerRecord
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: TransactionID; }> transfer(transfer)
Transfer between trading accounts
Transfer between different accounts. Currently support transfers between the following: 1. spot - margin 2. spot - futures(perpetual) 3. spot - delivery 4. spot - cross margin 5. spot - options
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.WalletApi(client);
const transfer = new Transfer(); // Transfer |
api.transfer(transfer)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
transfer | Transfer |
Promise<{ response: AxiosResponse; body: TransactionID; }> TransactionID
- Content-Type: application/json
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listSubAccountTransfers(opts)
Retrieve transfer records between main and sub accounts
Record time range cannot exceed 30 days > Note: only records after 2020-04-10 can be retrieved
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.WalletApi(client);
const opts = {
'subUid': "10003", // string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts
'from': 1602120000, // number | Time range beginning, default to 7 days before current time
'to': 1602123600, // number | Time range ending, default to current time
'limit': 100, // number | Maximum number of records to be returned in a single list
'offset': 0 // number | List offset, starting from 0
};
api.listSubAccountTransfers(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
subUid | string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts | [optional] [default to undefined] |
from | number | Time range beginning, default to 7 days before current time | [optional] [default to undefined] |
to | number | Time range ending, default to current time | [optional] [default to undefined] |
limit | number | Maximum number of records to be returned in a single list | [optional] [default to 100] |
offset | number | List offset, starting from 0 | [optional] [default to 0] |
Promise<{ response: AxiosResponse; body: Array; }> SubAccountTransfer
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body?: any; }> transferWithSubAccount(subAccountTransfer)
Transfer between main and sub accounts
Support transferring with sub user's spot or futures account. Note that only main user's spot account is used no matter which sub user's account is operated.
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.WalletApi(client);
const subAccountTransfer = new SubAccountTransfer(); // SubAccountTransfer |
api.transferWithSubAccount(subAccountTransfer)
.then(value => console.log('API called successfully.'),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
subAccountTransfer | SubAccountTransfer |
Promise<{ response: AxiosResponse; body?: any; }>
- Content-Type: application/json
- Accept: Not defined
Promise<{ response: http.IncomingMessage; body?: any; }> subAccountToSubAccount(subAccountToSubAccount)
Sub-account transfers to sub-account
It is possible to perform balance transfers between two sub-accounts under the same main account. You can use either the API Key of the main account or the API Key of the sub-account to initiate the transfer.
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.WalletApi(client);
const subAccountToSubAccount = new SubAccountToSubAccount(); // SubAccountToSubAccount |
api.subAccountToSubAccount(subAccountToSubAccount)
.then(value => console.log('API called successfully.'),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
subAccountToSubAccount | SubAccountToSubAccount |
Promise<{ response: AxiosResponse; body?: any; }>
- Content-Type: application/json
- Accept: Not defined
Promise<{ response: http.IncomingMessage; body: Array; }> listWithdrawStatus(opts)
Retrieve withdrawal status
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.WalletApi(client);
const opts = {
'currency': "BTC" // string | Retrieve data of the specified currency
};
api.listWithdrawStatus(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currency | string | Retrieve data of the specified currency | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> WithdrawStatus
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listSubAccountBalances(opts)
Retrieve sub account balances
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.WalletApi(client);
const opts = {
'subUid': "10003" // string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts
};
api.listSubAccountBalances(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
subUid | string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> SubAccountBalance
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listSubAccountMarginBalances(opts)
Query sub accounts' margin balances
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.WalletApi(client);
const opts = {
'subUid': "10003" // string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts
};
api.listSubAccountMarginBalances(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
subUid | string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> SubAccountMarginBalance
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listSubAccountFuturesBalances(opts)
Query sub accounts' futures account balances
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.WalletApi(client);
const opts = {
'subUid': "10003", // string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts
'settle': "usdt" // string | Query only balances of specified settle currency
};
api.listSubAccountFuturesBalances(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
subUid | string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts | [optional] [default to undefined] |
settle | string | Query only balances of specified settle currency | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> SubAccountFuturesBalance
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listSubAccountCrossMarginBalances(opts)
Query subaccount's cross_margin account info
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.WalletApi(client);
const opts = {
'subUid': "10003" // string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts
};
api.listSubAccountCrossMarginBalances(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
subUid | string | User ID of sub-account, you can query multiple records separated by `,`. If not specified, it will return the records of all sub accounts | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> SubAccountCrossMarginBalance
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listSavedAddress(currency, opts)
Query saved address
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.WalletApi(client);
const currency = "USDT"; // string | Currency
const opts = {
'chain': '', // string | Chain name
'limit': '50' // string | Maximum number returned, 100 at most
};
api.listSavedAddress(currency, opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currency | string | Currency | [default to undefined] |
chain | string | Chain name | [optional] [default to ''] |
limit | string | Maximum number returned, 100 at most | [optional] [default to '50'] |
Promise<{ response: AxiosResponse; body: Array; }> SavedAddress
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: TradeFee; }> getTradeFee(opts)
Retrieve personal trading fee
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.WalletApi(client);
const opts = {
'currencyPair': "BTC_USDT", // string | Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs
'settle': "BTC" // 'BTC' | 'USDT' | 'USD' | Specify the settlement currency of the contract to get more accurate rate settings This field is optional. Generally, the rate settings for all settlement currencies are the same.
};
api.getTradeFee(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currencyPair | string | Specify a currency pair to retrieve precise fee rate This field is optional. In most cases, the fee rate is identical among all currency pairs | [optional] [default to undefined] |
settle | Settle | Specify the settlement currency of the contract to get more accurate rate settings This field is optional. Generally, the rate settings for all settlement currencies are the same. | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: TradeFee; }> TradeFee
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: TotalBalance; }> getTotalBalance(opts)
Retrieve user's total balances
This endpoint returns an approximate sum of exchanged amount from all currencies to input currency for each account.The exchange rate and account balance could have been cached for at most 1 minute. It is not recommended to use its result for any trading calculation. For trading calculation, use the corresponding account query endpoint for each account type. For example: - `GET /spot/accounts` to query spot account balance - `GET /margin/accounts` to query margin account balance - `GET /futures/{settle}/accounts` to query futures account balance
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.WalletApi(client);
const opts = {
'currency': 'USDT' // string | Currency unit used to calculate the balance amount. BTC, CNY, USD and USDT are allowed. USDT is the default.
};
api.getTotalBalance(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currency | string | Currency unit used to calculate the balance amount. BTC, CNY, USD and USDT are allowed. USDT is the default. | [optional] [default to 'USDT'] |
Promise<{ response: AxiosResponse; body: TotalBalance; }> TotalBalance
- Content-Type: Not defined
- Accept: application/json