All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
listUnifiedAccounts | GET /unified/accounts | Get unified account information |
listUnifiedAccountMode | GET /unified/account_mode | Query mode of the unified account |
setUnifiedAccountMode | POST /unified/account_mode | Set mode of the unified account |
getUnifiedBorrowable | GET /unified/borrowable | Query about the maximum borrowing for the unified account |
getUnifiedTransferable | GET /unified/transferable | Query about the maximum transferable for the unified account |
listUnifiedLoans | GET /unified/loans | List loans |
createUnifiedLoan | POST /unified/loans | Borrow or repay |
listUnifiedLoanRecords | GET /unified/loan_records | Get load records |
listUnifiedLoanInterestRecords | GET /unified/interest_records | List interest records |
Promise<{ response: http.IncomingMessage; body: UnifiedAccount; }> listUnifiedAccounts(opts)
Get unified account information
The assets of each currency in the account will be adjusted according to their liquidity, defined by corresponding adjustment coefficients, and then uniformly converted to USD to calculate the total asset value and position value of the account. You can refer to the Formula in the documentation
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.UnifiedApi(client);
const opts = {
'currency': "BTC" // string | Retrieve data of the specified currency
};
api.listUnifiedAccounts(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: UnifiedAccount; }> UnifiedAccount
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: { [key: string]: boolean; }; }> listUnifiedAccountMode()
Query mode of the unified account
cross_margin - cross margin, usdt_futures - usdt futures
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.UnifiedApi(client);
api.listUnifiedAccountMode()
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
This endpoint does not need any parameter.
Promise<{ response: AxiosResponse; body: { [key: string]: boolean; }; }> boolean
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: { [key: string]: boolean; }; }> setUnifiedAccountMode(unifiedMode)
Set mode of the unified account
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.UnifiedApi(client);
const unifiedMode = new UnifiedMode(); // UnifiedMode |
api.setUnifiedAccountMode(unifiedMode)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
unifiedMode | UnifiedMode |
Promise<{ response: AxiosResponse; body: { [key: string]: boolean; }; }> boolean
- Content-Type: application/json
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: UnifiedBorrowable; }> getUnifiedBorrowable(currency)
Query about the maximum borrowing for the unified account
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.UnifiedApi(client);
const currency = "BTC"; // string | Retrieve data of the specified currency
api.getUnifiedBorrowable(currency)
.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 | [default to undefined] |
Promise<{ response: AxiosResponse; body: UnifiedBorrowable; }> UnifiedBorrowable
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: UnifiedTransferable; }> getUnifiedTransferable(currency)
Query about the maximum transferable for the unified account
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.UnifiedApi(client);
const currency = "BTC"; // string | Retrieve data of the specified currency
api.getUnifiedTransferable(currency)
.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 | [default to undefined] |
Promise<{ response: AxiosResponse; body: UnifiedTransferable; }> UnifiedTransferable
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listUnifiedLoans(opts)
List loans
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.UnifiedApi(client);
const opts = {
'currency': "BTC", // string | Retrieve data of the specified currency
'page': 1, // number | Page number
'limit': 100 // number | Maximum response items. Default: 100, minimum: 1, Maximum: 100
};
api.listUnifiedLoans(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] |
page | number | Page number | [optional] [default to 1] |
limit | number | Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [optional] [default to 100] |
Promise<{ response: AxiosResponse; body: Array; }> UniLoan
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body?: any; }> createUnifiedLoan(unifiedLoan)
Borrow or repay
When borrowing, it is essential to ensure that the borrowed amount is not below the minimum borrowing threshold for the specific cryptocurrency and does not exceed the maximum borrowing limit set by the platform and the user. The interest on the loan will be automatically deducted from the account at regular intervals. It is the user's responsibility to manage the repayment of the borrowed amount. For repayment, the option to repay the entire borrowed amount is available by setting the parameter `repaid_all=true`
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.UnifiedApi(client);
const unifiedLoan = new UnifiedLoan(); // UnifiedLoan |
api.createUnifiedLoan(unifiedLoan)
.then(value => console.log('API called successfully.'),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
unifiedLoan | UnifiedLoan |
Promise<{ response: AxiosResponse; body?: any; }>
- Content-Type: application/json
- Accept: Not defined
Promise<{ response: http.IncomingMessage; body: Array; }> listUnifiedLoanRecords(opts)
Get load records
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.UnifiedApi(client);
const opts = {
'type': "type_example", // 'borrow' | 'repay' | The types of lending records, borrow - indicates the action of borrowing funds, repay - indicates the action of repaying the borrowed funds
'currency': "BTC", // string | Retrieve data of the specified currency
'page': 1, // number | Page number
'limit': 100 // number | Maximum response items. Default: 100, minimum: 1, Maximum: 100
};
api.listUnifiedLoanRecords(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
type | Type | The types of lending records, borrow - indicates the action of borrowing funds, repay - indicates the action of repaying the borrowed funds | [optional] [default to undefined] |
currency | string | Retrieve data of the specified currency | [optional] [default to undefined] |
page | number | Page number | [optional] [default to 1] |
limit | number | Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [optional] [default to 100] |
Promise<{ response: AxiosResponse; body: Array; }> UnifiedLoanRecord
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listUnifiedLoanInterestRecords(opts)
List interest records
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.UnifiedApi(client);
const opts = {
'currency': "BTC", // string | Retrieve data of the specified currency
'page': 1, // number | Page number
'limit': 100 // number | Maximum response items. Default: 100, minimum: 1, Maximum: 100
};
api.listUnifiedLoanInterestRecords(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] |
page | number | Page number | [optional] [default to 1] |
limit | number | Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [optional] [default to 100] |
Promise<{ response: AxiosResponse; body: Array; }> UniLoanInterestRecord
- Content-Type: Not defined
- Accept: application/json