All URIs are relative to https://api.gateio.ws/api/v4
Method | HTTP request | Description |
---|---|---|
listMarginAccounts | GET /margin/accounts | Margin account list |
listMarginAccountBook | GET /margin/account_book | List margin account balance change history |
listFundingAccounts | GET /margin/funding_accounts | Funding account list |
getAutoRepayStatus | GET /margin/auto_repay | Retrieve user auto repayment setting |
setAutoRepay | POST /margin/auto_repay | Update user's auto repayment setting |
getMarginTransferable | GET /margin/transferable | Get the max transferable amount for a specific margin currency |
listCrossMarginCurrencies | GET /margin/cross/currencies | Currencies supported by cross margin.(deprecated) |
getCrossMarginCurrency | GET /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin. (deprecated) |
getCrossMarginAccount | GET /margin/cross/accounts | Retrieve cross margin account. (deprecated) |
listCrossMarginAccountBook | GET /margin/cross/account_book | Retrieve cross margin account change history. (deprecated) |
listCrossMarginLoans | GET /margin/cross/loans | List cross margin borrow history. (deprecated) |
createCrossMarginLoan | POST /margin/cross/loans | Create a cross margin borrow loan. (deprecated) |
getCrossMarginLoan | GET /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail. (deprecated) |
listCrossMarginRepayments | GET /margin/cross/repayments | Retrieve cross margin repayments. (deprecated) |
repayCrossMarginLoan | POST /margin/cross/repayments | Cross margin repayments. (deprecated) |
getCrossMarginInterestRecords | GET /margin/cross/interest_records | Interest records for the cross margin account. (deprecated) |
getCrossMarginTransferable | GET /margin/cross/transferable | Get the max transferable amount for a specific cross margin currency. (deprecated) |
getCrossMarginEstimateRate | GET /margin/cross/estimate_rate | Estimated interest rates. (deprecated) |
getCrossMarginBorrowable | GET /margin/cross/borrowable | Get the max borrowable amount for a specific cross margin currency. (deprecated) |
Promise<{ response: http.IncomingMessage; body: Array; }> listMarginAccounts(opts)
Margin account list
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.MarginApi(client);
const opts = {
'currencyPair': "BTC_USDT" // string | Currency pair
};
api.listMarginAccounts(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currencyPair | string | Currency pair | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> MarginAccount
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listMarginAccountBook(opts)
List margin account balance change history
Only transferals from and to margin account are provided for now. Time range allows 30 days at most
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.MarginApi(client);
const opts = {
'currency': "currency_example", // string | List records related to specified currency only. If specified, `currency_pair` is also required.
'currencyPair': "currencyPair_example", // string | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided
'type': "lend", // string | Only retrieve changes of the specified type. All types will be returned if not specified.
'from': 1627706330, // number | Start timestamp of the query
'to': 1635329650, // number | Time range ending, default to current time
'page': 1, // number | Page number
'limit': 100 // number | Maximum number of records to be returned in a single list
};
api.listMarginAccountBook(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currency | string | List records related to specified currency only. If specified, `currency_pair` is also required. | [optional] [default to undefined] |
currencyPair | string | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided | [optional] [default to undefined] |
type | string | Only retrieve changes of the specified type. All types will be returned if not specified. | [optional] [default to undefined] |
from | number | Start timestamp of the query | [optional] [default to undefined] |
to | number | Time range ending, default to current time | [optional] [default to undefined] |
page | number | Page number | [optional] [default to 1] |
limit | number | Maximum number of records to be returned in a single list | [optional] [default to 100] |
Promise<{ response: AxiosResponse; body: Array; }> MarginAccountBook
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listFundingAccounts(opts)
Funding account list
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.MarginApi(client);
const opts = {
'currency': "BTC" // string | Retrieve data of the specified currency
};
api.listFundingAccounts(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; }> FundingAccount
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: AutoRepaySetting; }> getAutoRepayStatus()
Retrieve user auto repayment setting
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.MarginApi(client);
api.getAutoRepayStatus()
.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: AutoRepaySetting; }> AutoRepaySetting
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: AutoRepaySetting; }> setAutoRepay(status)
Update user's auto repayment setting
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.MarginApi(client);
const status = "on"; // string | New auto repayment status. `on` - enabled, `off` - disabled
api.setAutoRepay(status)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
status | string | New auto repayment status. `on` - enabled, `off` - disabled | [default to undefined] |
Promise<{ response: AxiosResponse; body: AutoRepaySetting; }> AutoRepaySetting
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: MarginTransferable; }> getMarginTransferable(currency, opts)
Get the max transferable amount for a specific margin 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"
// Configure Gate APIv4 key authentication:
client.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
const api = new GateApi.MarginApi(client);
const currency = "BTC"; // string | Retrieve data of the specified currency
const opts = {
'currencyPair': "BTC_USDT" // string | Currency pair
};
api.getMarginTransferable(currency, 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 | [default to undefined] |
currencyPair | string | Currency pair | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: MarginTransferable; }> MarginTransferable
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listCrossMarginCurrencies()
Currencies supported by cross margin.(deprecated)
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.MarginApi(client);
api.listCrossMarginCurrencies()
.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: Array; }> CrossMarginCurrency
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: CrossMarginCurrency; }> getCrossMarginCurrency(currency)
Retrieve detail of one single currency supported by cross margin. (deprecated)
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.MarginApi(client);
const currency = "BTC"; // string | Currency name
api.getCrossMarginCurrency(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: CrossMarginCurrency; }> CrossMarginCurrency
No authorization required
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: CrossMarginAccount; }> getCrossMarginAccount()
Retrieve cross margin account. (deprecated)
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.MarginApi(client);
api.getCrossMarginAccount()
.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: CrossMarginAccount; }> CrossMarginAccount
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listCrossMarginAccountBook(opts)
Retrieve cross margin account change history. (deprecated)
The record query time range is not allowed to exceed 30 days. When using the limit&page paging function to retrieve data, the maximum number of pages is 100,000, that is, (limit page - 1) <= 100000.
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.MarginApi(client);
const opts = {
'currency': "currency_example", // string | Filter by currency
'from': 1627706330, // number | Start timestamp of the query
'to': 1635329650, // number | Time range ending, default to current time
'page': 1, // number | Page number
'limit': 100, // number | Maximum number of records to be returned in a single list
'type': "borrow" // string | Only retrieve changes of the specified type. All types will be returned if not specified.
};
api.listCrossMarginAccountBook(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 | [optional] [default to undefined] |
from | number | Start timestamp of the query | [optional] [default to undefined] |
to | number | Time range ending, default to current time | [optional] [default to undefined] |
page | number | Page number | [optional] [default to 1] |
limit | number | Maximum number of records to be returned in a single list | [optional] [default to 100] |
type | string | Only retrieve changes of the specified type. All types will be returned if not specified. | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> CrossMarginAccountBook
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listCrossMarginLoans(status, opts)
List cross margin borrow history. (deprecated)
Sort by creation time in descending order by default. Set `reverse=false` to return ascending results.
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.MarginApi(client);
const status = 56; // number | Filter by status. Supported values are 2 and 3. (deprecated.)
const opts = {
'currency': "currency_example", // string | Filter by currency
'limit': 100, // number | Maximum number of records to be returned in a single list
'offset': 0, // number | List offset, starting from 0
'reverse': True // boolean | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results
};
api.listCrossMarginLoans(status, opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
status | number | Filter by status. Supported values are 2 and 3. (deprecated.) | [default to undefined] |
currency | string | Filter by currency | [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] |
reverse | boolean | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> CrossMarginLoan
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: CrossMarginLoan; }> createCrossMarginLoan(crossMarginLoan)
Create a cross margin borrow loan. (deprecated)
Borrow amount cannot be less than currency minimum borrow amount
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.MarginApi(client);
const crossMarginLoan = new CrossMarginLoan(); // CrossMarginLoan |
api.createCrossMarginLoan(crossMarginLoan)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
crossMarginLoan | CrossMarginLoan |
Promise<{ response: AxiosResponse; body: CrossMarginLoan; }> CrossMarginLoan
- Content-Type: application/json
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: CrossMarginLoan; }> getCrossMarginLoan(loanId)
Retrieve single borrow loan detail. (deprecated)
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.MarginApi(client);
const loanId = "12345"; // string | Borrow loan ID
api.getCrossMarginLoan(loanId)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
loanId | string | Borrow loan ID | [default to undefined] |
Promise<{ response: AxiosResponse; body: CrossMarginLoan; }> CrossMarginLoan
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> listCrossMarginRepayments(opts)
Retrieve cross margin repayments. (deprecated)
Sort by creation time in descending order by default. Set `reverse=false` to return ascending results.
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.MarginApi(client);
const opts = {
'currency': "BTC", // string |
'loanId': "12345", // string |
'limit': 100, // number | Maximum number of records to be returned in a single list
'offset': 0, // number | List offset, starting from 0
'reverse': True // boolean | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results
};
api.listCrossMarginRepayments(opts)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currency | string | [optional] [default to undefined] | |
loanId | string | [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] |
reverse | boolean | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> CrossMarginRepayment
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> repayCrossMarginLoan(crossMarginRepayRequest)
Cross margin repayments. (deprecated)
When the liquidity of the currency is insufficient and the transaction risk is high, the currency will be disabled, and funds cannot be transferred.When the available balance of cross-margin is insufficient, the balance of the spot account can be used for repayment. Please ensure that the balance of the spot account is sufficient, and system uses cross-margin account for repayment first
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.MarginApi(client);
const crossMarginRepayRequest = new CrossMarginRepayRequest(); // CrossMarginRepayRequest |
api.repayCrossMarginLoan(crossMarginRepayRequest)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
crossMarginRepayRequest | CrossMarginRepayRequest |
Promise<{ response: AxiosResponse; body: Array; }> CrossMarginLoan
- Content-Type: application/json
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: Array; }> getCrossMarginInterestRecords(opts)
Interest records for the cross margin account. (deprecated)
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.MarginApi(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
'from': 1547706332, // number | Start timestamp
'to': 1547706332 // number | End timestamp
};
api.getCrossMarginInterestRecords(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] |
from | number | Start timestamp | [optional] [default to undefined] |
to | number | End timestamp | [optional] [default to undefined] |
Promise<{ response: AxiosResponse; body: Array; }> UniLoanInterestRecord
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: CrossMarginTransferable; }> getCrossMarginTransferable(currency)
Get the max transferable amount for a specific cross margin currency. (deprecated)
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.MarginApi(client);
const currency = "BTC"; // string | Retrieve data of the specified currency
api.getCrossMarginTransferable(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: CrossMarginTransferable; }> CrossMarginTransferable
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: { [key: string]: string; }; }> getCrossMarginEstimateRate(currencies)
Estimated interest rates. (deprecated)
Please note that the interest rates are subject to change based on the borrowing and lending demand, and therefore, the provided rates may not be entirely accurate.
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.MarginApi(client);
const currencies = [["BTC","GT"]]; // Array<string> | An array of up to 10 specifying the currency name
api.getCrossMarginEstimateRate(currencies)
.then(value => console.log('API called successfully. Returned data: ', value.body),
error => console.error(error));
Name | Type | Description | Notes |
---|---|---|---|
currencies | Array<string> | An array of up to 10 specifying the currency name | [default to undefined] |
Promise<{ response: AxiosResponse; body: { [key: string]: string; }; }> string
- Content-Type: Not defined
- Accept: application/json
Promise<{ response: http.IncomingMessage; body: UnifiedBorrowable; }> getCrossMarginBorrowable(currency)
Get the max borrowable amount for a specific cross margin currency. (deprecated)
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.MarginApi(client);
const currency = "BTC"; // string | Retrieve data of the specified currency
api.getCrossMarginBorrowable(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