All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| listUnifiedAccounts | GET /unified/accounts | Get unified account information |
| 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 |
| getUnifiedTransferables | GET /unified/transferables | Batch query can be transferred out at most for unified accounts; each currency is the maximum value. After the user withdraws the currency, the amount of transferable currency will be changed. |
| getUnifiedBorrowableList | GET /unified/batch_borrowable | Batch query unified account can be borrowed up to a maximum |
| 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 |
| getUnifiedRiskUnits | GET /unified/risk_units | Get user risk unit details |
| getUnifiedMode | GET /unified/unified_mode | Query mode of the unified account |
| setUnifiedMode | PUT /unified/unified_mode | Set mode of the unified account |
| getUnifiedEstimateRate | GET /unified/estimate_rate | Get unified estimate rate |
| listCurrencyDiscountTiers | GET /unified/currency_discount_tiers | List currency discount tiers |
| listLoanMarginTiers | GET /unified/loan_margin_tiers | List loan margin tiers |
| calculatePortfolioMargin | POST /unified/portfolio_calculator | Portfolio margin calculator |
| getUserLeverageCurrencyConfig | GET /unified/leverage/user_currency_config | Minimum currency leverage that can be set |
| getUserLeverageCurrencySetting | GET /unified/leverage/user_currency_setting | Get the leverage multiple of the user currency |
| setUserLeverageCurrencySetting | POST /unified/leverage/user_currency_setting | Set the loan currency leverage |
| listUnifiedCurrencies | GET /unified/currencies | List of loan currencies supported by unified account |
| getHistoryLoanRate | GET /unified/history_loan_rate | get historical lending rates |
UnifiedAccount listUnifiedAccounts().currency(currency).subUid(subUid).execute();
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
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
String subUid = "10001"; // String | Sub account user ID
try {
UnifiedAccount result = apiInstance.listUnifiedAccounts()
.currency(currency)
.subUid(subUid)
.execute();
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#listUnifiedAccounts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Retrieve data of the specified currency | [optional] |
| subUid | String | Sub account user ID | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
UnifiedBorrowable getUnifiedBorrowable(currency)
Query about the maximum borrowing for the unified account
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
try {
UnifiedBorrowable result = apiInstance.getUnifiedBorrowable(currency);
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#getUnifiedBorrowable");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Retrieve data of the specified currency |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
UnifiedTransferable getUnifiedTransferable(currency)
Query about the maximum transferable for the unified account
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
try {
UnifiedTransferable result = apiInstance.getUnifiedTransferable(currency);
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#getUnifiedTransferable");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Retrieve data of the specified currency |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
List<TransferablesResult> getUnifiedTransferables(currencies)
Batch query can be transferred out at most for unified accounts; each currency is the maximum value. After the user withdraws the currency, the amount of transferable currency will be changed.
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
String currencies = "BTC,ETH"; // String | Specify the currency name to query in batches, and support up to 100 pass parameters at a time.
try {
List<TransferablesResult> result = apiInstance.getUnifiedTransferables(currencies);
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#getUnifiedTransferables");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencies | String | Specify the currency name to query in batches, and support up to 100 pass parameters at a time. |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
List<UnifiedBorrowable1> getUnifiedBorrowableList(currencies)
Batch query unified account can be borrowed up to a maximum
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
List<String> currencies = Arrays.asList(); // List<String> | Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies.
try {
List<UnifiedBorrowable1> result = apiInstance.getUnifiedBorrowableList(currencies);
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#getUnifiedBorrowableList");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencies | List<String> | Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies. |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
List<UniLoan> listUnifiedLoans().currency(currency).page(page).limit(limit).type(type).execute();
List loans
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
Integer page = 1; // Integer | Page number
Integer limit = 100; // Integer | Maximum response items. Default: 100, minimum: 1, Maximum: 100
String type = "platform"; // String | Loan type, platform - platform, margin - margin
try {
List<UniLoan> result = apiInstance.listUnifiedLoans()
.currency(currency)
.page(page)
.limit(limit)
.type(type)
.execute();
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#listUnifiedLoans");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Retrieve data of the specified currency | [optional] |
| page | Integer | Page number | [optional] [default to 1] |
| limit | Integer | Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [optional] [default to 100] |
| type | String | Loan type, platform - platform, margin - margin | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
UnifiedLoanResult 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`
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
UnifiedLoan unifiedLoan = new UnifiedLoan(); // UnifiedLoan |
try {
UnifiedLoanResult result = apiInstance.createUnifiedLoan(unifiedLoan);
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#createUnifiedLoan");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| unifiedLoan | UnifiedLoan |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Operated successfully | - |
List<UnifiedLoanRecord> listUnifiedLoanRecords().type(type).currency(currency).page(page).limit(limit).execute();
Get load records
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
String type = "type_example"; // String | The types of lending records, borrow - indicates the action of borrowing funds, repay - indicates the action of repaying the borrowed funds
String currency = "BTC"; // String | Retrieve data of the specified currency
Integer page = 1; // Integer | Page number
Integer limit = 100; // Integer | Maximum response items. Default: 100, minimum: 1, Maximum: 100
try {
List<UnifiedLoanRecord> result = apiInstance.listUnifiedLoanRecords()
.type(type)
.currency(currency)
.page(page)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#listUnifiedLoanRecords");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| type | String | The types of lending records, borrow - indicates the action of borrowing funds, repay - indicates the action of repaying the borrowed funds | [optional] |
| currency | String | Retrieve data of the specified currency | [optional] |
| page | Integer | Page number | [optional] [default to 1] |
| limit | Integer | Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [optional] [default to 100] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
List<UniLoanInterestRecord> listUnifiedLoanInterestRecords().currency(currency).page(page).limit(limit).from(from).to(to).type(type).execute();
List interest records
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
Integer page = 1; // Integer | Page number
Integer limit = 100; // Integer | Maximum response items. Default: 100, minimum: 1, Maximum: 100
Long from = 1627706330L; // Long | Start timestamp of the query
Long to = 1635329650L; // Long | Time range ending, default to current time
String type = "platform"; // String | Loan type, platform loan - platform, leverage loan - margin, if not passed, defaults to margin
try {
List<UniLoanInterestRecord> result = apiInstance.listUnifiedLoanInterestRecords()
.currency(currency)
.page(page)
.limit(limit)
.from(from)
.to(to)
.type(type)
.execute();
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#listUnifiedLoanInterestRecords");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Retrieve data of the specified currency | [optional] |
| page | Integer | Page number | [optional] [default to 1] |
| limit | Integer | Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [optional] [default to 100] |
| from | Long | Start timestamp of the query | [optional] |
| to | Long | Time range ending, default to current time | [optional] |
| type | String | Loan type, platform loan - platform, leverage loan - margin, if not passed, defaults to margin | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
UnifiedRiskUnits getUnifiedRiskUnits()
Get user risk unit details
Retrieve user risk unit details, only valid in portfolio margin mode
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
try {
UnifiedRiskUnits result = apiInstance.getUnifiedRiskUnits();
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#getUnifiedRiskUnits");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
UnifiedModeSet getUnifiedMode()
Query mode of the unified account
Unified account mode: - `classic`: Classic account mode - `multi_currency`: Cross-currency margin mode - `portfolio`: Portfolio margin mode - `single_currency`: Single-currency margin mode
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
try {
UnifiedModeSet result = apiInstance.getUnifiedMode();
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#getUnifiedMode");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
setUnifiedMode(unifiedModeSet)
Set mode of the unified account
Switching each account mode only requires passing the parameters of the corresponding account mode, and supports turning on or off the configuration switch in the corresponding account mode when switching the account mode - When opening the classic account mode, mode=classic ``` PUT /unified/unified_mode { "mode": "classic" } ``` - Open the cross-currency margin mode, mode=multi_currency ``` PUT /unified/unified_mode { "mode": "multi_currency", "settings": { "usdt_futures": true } } ``` - When the portfolio margin mode is enabled, mode=portfolio ``` PUT /unified/unified_mode { "mode": "portfolio", "settings": { "spot_hedge": true } } ``` - When opening a single currency margin mode, mode=single_currency ``` PUT /unified/unified_mode { "mode": "single_currency" } ```
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
UnifiedModeSet unifiedModeSet = new UnifiedModeSet(); // UnifiedModeSet |
try {
apiInstance.setUnifiedMode(unifiedModeSet);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#setUnifiedMode");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| unifiedModeSet | UnifiedModeSet |
null (empty response body)
- Content-Type: application/json
- Accept: Not defined
| Status code | Description | Response headers |
|---|---|---|
| 204 | Success | - |
Map<String, String> getUnifiedEstimateRate(currencies)
Get unified estimate rate
Due to fluctuations in lending depth, hourly interest rates may vary, and thus, I cannot provide exact rates. When a currency is not supported, the interest rate returned will be an empty string.
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
List<String> currencies = Arrays.asList(); // List<String> | Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies.
try {
Map<String, String> result = apiInstance.getUnifiedEstimateRate(currencies);
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#getUnifiedEstimateRate");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencies | List<String> | Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies. |
Map<String, String>
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
List<UnifiedDiscount> listCurrencyDiscountTiers()
List currency discount tiers
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
try {
List<UnifiedDiscount> result = apiInstance.listCurrencyDiscountTiers();
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#listCurrencyDiscountTiers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}This endpoint does not need any parameter.
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
List<UnifiedMarginTiers> listLoanMarginTiers()
List loan margin tiers
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
try {
List<UnifiedMarginTiers> result = apiInstance.listLoanMarginTiers();
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#listLoanMarginTiers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}This endpoint does not need any parameter.
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
UnifiedPortfolioOutput calculatePortfolioMargin(unifiedPortfolioInput)
Portfolio margin calculator
Portfolio Margin Calculator When inputting a simulated position portfolio, each position includes the position name and quantity held, supporting markets within the range of BTC and ETH perpetual contracts, options, and spot markets. When inputting simulated orders, each order includes the market identifier, order price, and order quantity, supporting markets within the range of BTC and ETH perpetual contracts, options, and spot markets. Market orders are not included.
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
UnifiedPortfolioInput unifiedPortfolioInput = new UnifiedPortfolioInput(); // UnifiedPortfolioInput |
try {
UnifiedPortfolioOutput result = apiInstance.calculatePortfolioMargin(unifiedPortfolioInput);
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#calculatePortfolioMargin");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| unifiedPortfolioInput | UnifiedPortfolioInput |
No authorization required
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
UnifiedLeverageConfig getUserLeverageCurrencyConfig(currency)
Minimum currency leverage that can be set
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
String currency = "BTC"; // String | Currency
try {
UnifiedLeverageConfig result = apiInstance.getUserLeverageCurrencyConfig(currency);
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#getUserLeverageCurrencyConfig");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Currency |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
UnifiedLeverageSetting getUserLeverageCurrencySetting().currency(currency).execute();
Get the leverage multiple of the user currency
Get the user's currency leverage. If currency is not passed, query all currencies.
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
String currency = "BTC"; // String | Currency
try {
UnifiedLeverageSetting result = apiInstance.getUserLeverageCurrencySetting()
.currency(currency)
.execute();
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#getUserLeverageCurrencySetting");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Currency | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
setUserLeverageCurrencySetting(unifiedLeverageSetting)
Set the loan currency leverage
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.auth.*;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4
defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
UnifiedLeverageSetting unifiedLeverageSetting = new UnifiedLeverageSetting(); // UnifiedLeverageSetting |
try {
apiInstance.setUserLeverageCurrencySetting(unifiedLeverageSetting);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#setUserLeverageCurrencySetting");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| unifiedLeverageSetting | UnifiedLeverageSetting |
null (empty response body)
- Content-Type: application/json
- Accept: Not defined
| Status code | Description | Response headers |
|---|---|---|
| 204 | Success | - |
List<UnifiedCurrency> listUnifiedCurrencies().currency(currency).execute();
List of loan currencies supported by unified account
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
String currency = "BTC"; // String | Currency
try {
List<UnifiedCurrency> result = apiInstance.listUnifiedCurrencies()
.currency(currency)
.execute();
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#listUnifiedCurrencies");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Currency | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
UnifiedHistoryLoanRate getHistoryLoanRate(currency).tier(tier).page(page).limit(limit).execute();
get historical lending rates
// Import classes:
import io.gate.gateapi.ApiClient;
import io.gate.gateapi.ApiException;
import io.gate.gateapi.Configuration;
import io.gate.gateapi.GateApiException;
import io.gate.gateapi.models.*;
import io.gate.gateapi.api.UnifiedApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
UnifiedApi apiInstance = new UnifiedApi(defaultClient);
String currency = "USDT"; // String | Currency
String tier = "1"; // String | The VIP level of the floating rate that needs to be queried
Integer page = 1; // Integer | Page number
Integer limit = 100; // Integer | Maximum response items. Default: 100, minimum: 1, Maximum: 100
try {
UnifiedHistoryLoanRate result = apiInstance.getHistoryLoanRate(currency)
.tier(tier)
.page(page)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiException e) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiException e) {
System.err.println("Exception when calling UnifiedApi#getHistoryLoanRate");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Currency | |
| tier | String | The VIP level of the floating rate that needs to be queried | [optional] |
| page | Integer | Page number | [optional] [default to 1] |
| limit | Integer | Maximum response items. Default: 100, minimum: 1, Maximum: 100 | [optional] [default to 100] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |