Skip to content

Latest commit

 

History

History
777 lines (527 loc) · 27 KB

WalletApi.md

File metadata and controls

777 lines (527 loc) · 27 KB

WalletApi

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

listCurrencyChains

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

List chains supported for specified currency

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.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));

Parameters

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

Return type

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

Authorization

No authorization required

HTTP request headers

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

getDepositAddress

Promise<{ response: http.IncomingMessage; body: DepositAddress; }> getDepositAddress(currency)

Generate currency deposit address

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.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));

Parameters

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

Return type

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

Authorization

apiv4

HTTP request headers

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

listWithdrawals

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

Retrieve withdrawal records

Record 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.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));

Parameters

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]

Return type

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

Authorization

apiv4

HTTP request headers

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

listDeposits

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

Retrieve deposit records

Record 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.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));

Parameters

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]

Return type

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

Authorization

apiv4

HTTP request headers

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

transfer

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

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.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));

Parameters

Name Type Description Notes
transfer Transfer

Return type

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

Authorization

apiv4

HTTP request headers

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

listSubAccountTransfers

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

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.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));

Parameters

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]

Return type

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

Authorization

apiv4

HTTP request headers

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

transferWithSubAccount

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

Transfer between main and sub accounts

Support transferring with sub user&#39;s spot or futures account. Note that only main user&#39;s spot account is used no matter which sub user&#39;s account is operated.

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.WalletApi(client);
const subAccountTransfer = new SubAccountTransfer(); // SubAccountTransfer | 
api.transferWithSubAccount(subAccountTransfer)
   .then(value => console.log('API called successfully.'),
         error => console.error(error));

Parameters

Name Type Description Notes
subAccountTransfer SubAccountTransfer

Return type

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

Authorization

apiv4

HTTP request headers

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

subAccountToSubAccount

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.

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.WalletApi(client);
const subAccountToSubAccount = new SubAccountToSubAccount(); // SubAccountToSubAccount | 
api.subAccountToSubAccount(subAccountToSubAccount)
   .then(value => console.log('API called successfully.'),
         error => console.error(error));

Parameters

Name Type Description Notes
subAccountToSubAccount SubAccountToSubAccount

Return type

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

Authorization

apiv4

HTTP request headers

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

listWithdrawStatus

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

Retrieve withdrawal status

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.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));

Parameters

Name Type Description Notes
currency string Retrieve data of the specified currency [optional] [default to undefined]

Return type

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

Authorization

apiv4

HTTP request headers

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

listSubAccountBalances

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

Retrieve sub account balances

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.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));

Parameters

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]

Return type

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

Authorization

apiv4

HTTP request headers

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

listSubAccountMarginBalances

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

Query sub accounts&#39; margin balances

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.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));

Parameters

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]

Return type

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

Authorization

apiv4

HTTP request headers

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

listSubAccountFuturesBalances

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

Query sub accounts&#39; futures account balances

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.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));

Parameters

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]

Return type

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

Authorization

apiv4

HTTP request headers

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

listSubAccountCrossMarginBalances

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

Query subaccount&#39;s cross_margin account info

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.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));

Parameters

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]

Return type

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

Authorization

apiv4

HTTP request headers

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

listSavedAddress

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

Query saved address

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.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));

Parameters

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']

Return type

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

Authorization

apiv4

HTTP request headers

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

getTradeFee

Promise<{ response: http.IncomingMessage; body: TradeFee; }> getTradeFee(opts)

Retrieve personal trading fee

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.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));

Parameters

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]

Return type

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

Authorization

apiv4

HTTP request headers

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

getTotalBalance

Promise<{ response: http.IncomingMessage; body: TotalBalance; }> getTotalBalance(opts)

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

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.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));

Parameters

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']

Return type

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

Authorization

apiv4

HTTP request headers

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