All URIs are relative to https://api.gateio.ws/api/v4
| Method | HTTP request | Description |
|---|---|---|
| listMarginCurrencyPairs | GET /margin/currency_pairs | List all supported currency pairs supported in margin trading |
| getMarginCurrencyPair | GET /margin/currency_pairs/{currency_pair} | Query one single margin currency pair |
| listFundingBook | GET /margin/funding_book | Order book of lending loans |
| 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 |
| listLoans | GET /margin/loans | List all loans |
| createLoan | POST /margin/loans | Lend or borrow |
| mergeLoans | POST /margin/merged_loans | Merge multiple lending loans |
| getLoan | GET /margin/loans/{loan_id} | Retrieve one single loan detail |
| cancelLoan | DELETE /margin/loans/{loan_id} | Cancel lending loan |
| updateLoan | PATCH /margin/loans/{loan_id} | Modify a loan |
| listLoanRepayments | GET /margin/loans/{loan_id}/repayment | List loan repayment records |
| repayLoan | POST /margin/loans/{loan_id}/repayment | Repay a loan |
| listLoanRecords | GET /margin/loan_records | List repayment records of a specific loan |
| getLoanRecord | GET /margin/loan_records/{loan_record_id} | Get one single loan record |
| updateLoanRecord | PATCH /margin/loan_records/{loan_record_id} | Modify a loan record |
| 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 |
| getMarginBorrowable | GET /margin/borrowable | Get the max borrowable amount for a specific margin currency |
| listCrossMarginCurrencies | GET /margin/cross/currencies | Currencies supported by cross margin. |
| getCrossMarginCurrency | GET /margin/cross/currencies/{currency} | Retrieve detail of one single currency supported by cross margin |
| getCrossMarginAccount | GET /margin/cross/accounts | Retrieve cross margin account |
| listCrossMarginAccountBook | GET /margin/cross/account_book | Retrieve cross margin account change history |
| listCrossMarginLoans | GET /margin/cross/loans | List cross margin borrow history |
| createCrossMarginLoan | POST /margin/cross/loans | Create a cross margin borrow loan |
| getCrossMarginLoan | GET /margin/cross/loans/{loan_id} | Retrieve single borrow loan detail |
| listCrossMarginRepayments | GET /margin/cross/repayments | Retrieve cross margin repayments |
| repayCrossMarginLoan | POST /margin/cross/repayments | Repay cross margin loan |
| getCrossMarginTransferable | GET /margin/cross/transferable | Get the max transferable amount for a specific cross margin currency |
| getCrossMarginBorrowable | GET /margin/cross/borrowable | Get the max borrowable amount for a specific cross margin currency |
List<MarginCurrencyPair> listMarginCurrencyPairs()
List all supported currency pairs supported in margin trading
// 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.MarginApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
MarginApi apiInstance = new MarginApi(defaultClient);
try {
List<MarginCurrencyPair> result = apiInstance.listMarginCurrencyPairs();
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 MarginApi#listMarginCurrencyPairs");
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 | List retrieved | - |
MarginCurrencyPair getMarginCurrencyPair(currencyPair)
Query one single margin currency pair
// 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.MarginApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
MarginApi apiInstance = new MarginApi(defaultClient);
String currencyPair = "BTC_USDT"; // String | Margin currency pair
try {
MarginCurrencyPair result = apiInstance.getMarginCurrencyPair(currencyPair);
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 MarginApi#getMarginCurrencyPair");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | String | Margin currency pair |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
List<FundingBookItem> listFundingBook(currency)
Order book of lending 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.models.*;
import io.gate.gateapi.api.MarginApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
MarginApi apiInstance = new MarginApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
try {
List<FundingBookItem> result = apiInstance.listFundingBook(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 MarginApi#listFundingBook");
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 |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order book retrieved | - |
List<MarginAccount> listMarginAccounts().currencyPair(currencyPair).execute();
Margin account list
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String currencyPair = "BTC_USDT"; // String | Currency pair
try {
List<MarginAccount> result = apiInstance.listMarginAccounts()
.currencyPair(currencyPair)
.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 MarginApi#listMarginAccounts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currencyPair | String | Currency pair | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
List<MarginAccountBook> listMarginAccountBook().currency(currency).currencyPair(currencyPair).from(from).to(to).page(page).limit(limit).execute();
List margin account balance change history
Only transferals from and to margin account are provided for now. Time range allows 30 days at most
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String currency = "currency_example"; // String | List records related to specified currency only. If specified, `currency_pair` is also required.
String currencyPair = "currencyPair_example"; // String | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided
Long from = 56L; // Long | Time range beginning, default to 7 days before current time
Long to = 56L; // Long | Time range ending, default to current time
Integer page = 1; // Integer | Page number
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
try {
List<MarginAccountBook> result = apiInstance.listMarginAccountBook()
.currency(currency)
.currencyPair(currencyPair)
.from(from)
.to(to)
.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 MarginApi#listMarginAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | List records related to specified currency only. If specified, `currency_pair` is also required. | [optional] |
| currencyPair | String | List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided | [optional] |
| from | Long | Time range beginning, default to 7 days before current time | [optional] |
| to | Long | Time range ending, default to current time | [optional] |
| page | Integer | Page number | [optional] [default to 1] |
| limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
List<FundingAccount> listFundingAccounts().currency(currency).execute();
Funding account list
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
try {
List<FundingAccount> result = apiInstance.listFundingAccounts()
.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 MarginApi#listFundingAccounts");
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] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
List<Loan> listLoans(status, side).currency(currency).currencyPair(currencyPair).sortBy(sortBy).reverseSort(reverseSort).page(page).limit(limit).execute();
List all 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String status = "open"; // String | Loan status
String side = "lend"; // String | Lend or borrow
String currency = "BTC"; // String | Retrieve data of the specified currency
String currencyPair = "BTC_USDT"; // String | Currency pair
String sortBy = "rate"; // String | Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time`
Boolean reverseSort = false; // Boolean | Whether to sort in descending order. Default to `true`
Integer page = 1; // Integer | Page number
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
try {
List<Loan> result = apiInstance.listLoans(status, side)
.currency(currency)
.currencyPair(currencyPair)
.sortBy(sortBy)
.reverseSort(reverseSort)
.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 MarginApi#listLoans");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| status | String | Loan status | [enum: open, loaned, finished, auto_repaid] |
| side | String | Lend or borrow | [enum: lend, borrow] |
| currency | String | Retrieve data of the specified currency | [optional] |
| currencyPair | String | Currency pair | [optional] |
| sortBy | String | Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time` | [optional] [enum: create_time, rate] |
| reverseSort | Boolean | Whether to sort in descending order. Default to `true` | [optional] |
| page | Integer | Page number | [optional] [default to 1] |
| limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
Loan createLoan(loan)
Lend or borrow
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
Loan loan = new Loan(); // Loan |
try {
Loan result = apiInstance.createLoan(loan);
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 MarginApi#createLoan");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| loan | Loan |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 201 | Loan created | - |
Loan mergeLoans(currency, ids)
Merge multiple lending 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
String ids = "123,234,345"; // String | A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request
try {
Loan result = apiInstance.mergeLoans(currency, ids);
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 MarginApi#mergeLoans");
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 | |
| ids | String | A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 201 | Loans merged | - |
Loan getLoan(loanId, side)
Retrieve one single loan detail
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String loanId = "12345"; // String | Loan ID
String side = "lend"; // String | Lend or borrow
try {
Loan result = apiInstance.getLoan(loanId, side);
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 MarginApi#getLoan");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| loanId | String | Loan ID | |
| side | String | Lend or borrow | [enum: lend, borrow] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
Loan cancelLoan(loanId, currency)
Cancel lending loan
Only lent loans can be cancelled
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String loanId = "12345"; // String | Loan ID
String currency = "BTC"; // String | Retrieve data of the specified currency
try {
Loan result = apiInstance.cancelLoan(loanId, 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 MarginApi#cancelLoan");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| loanId | String | Loan ID | |
| currency | String | Retrieve data of the specified currency |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Order cancelled | - |
Loan updateLoan(loanId, loanPatch)
Modify a loan
Only `auto_renew` modification is supported currently
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String loanId = "12345"; // String | Loan ID
LoanPatch loanPatch = new LoanPatch(); // LoanPatch |
try {
Loan result = apiInstance.updateLoan(loanId, loanPatch);
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 MarginApi#updateLoan");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| loanId | String | Loan ID | |
| loanPatch | LoanPatch |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Updated | - |
List<Repayment> listLoanRepayments(loanId)
List loan repayment 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String loanId = "12345"; // String | Loan ID
try {
List<Repayment> result = apiInstance.listLoanRepayments(loanId);
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 MarginApi#listLoanRepayments");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| loanId | String | Loan ID |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
Loan repayLoan(loanId, repayRequest)
Repay a loan
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String loanId = "12345"; // String | Loan ID
RepayRequest repayRequest = new RepayRequest(); // RepayRequest |
try {
Loan result = apiInstance.repayLoan(loanId, repayRequest);
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 MarginApi#repayLoan");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| loanId | String | Loan ID | |
| repayRequest | RepayRequest |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Loan repaid | - |
List<LoanRecord> listLoanRecords(loanId).status(status).page(page).limit(limit).execute();
List repayment records of a specific loan
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String loanId = "12345"; // String | Loan ID
String status = "loaned"; // String | Loan record status
Integer page = 1; // Integer | Page number
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
try {
List<LoanRecord> result = apiInstance.listLoanRecords(loanId)
.status(status)
.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 MarginApi#listLoanRecords");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| loanId | String | Loan ID | |
| status | String | Loan record status | [optional] [enum: loaned, finished] |
| page | Integer | Page number | [optional] [default to 1] |
| limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
LoanRecord getLoanRecord(loanRecordId, loanId)
Get one single loan record
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String loanRecordId = "12345"; // String | Loan record ID
String loanId = "12345"; // String | Loan ID
try {
LoanRecord result = apiInstance.getLoanRecord(loanRecordId, loanId);
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 MarginApi#getLoanRecord");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| loanRecordId | String | Loan record ID | |
| loanId | String | Loan ID |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Detail retrieved | - |
LoanRecord updateLoanRecord(loanRecordId, loanPatch)
Modify a loan record
Only `auto_renew` modification is supported currently
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String loanRecordId = "12345"; // String | Loan record ID
LoanPatch loanPatch = new LoanPatch(); // LoanPatch |
try {
LoanRecord result = apiInstance.updateLoanRecord(loanRecordId, loanPatch);
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 MarginApi#updateLoanRecord");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| loanRecordId | String | Loan record ID | |
| loanPatch | LoanPatch |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Loan record updated | - |
AutoRepaySetting getAutoRepayStatus()
Retrieve user auto repayment setting
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
try {
AutoRepaySetting result = apiInstance.getAutoRepayStatus();
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 MarginApi#getAutoRepayStatus");
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 | Current auto repayment setting | - |
AutoRepaySetting setAutoRepay(status)
Update user's auto repayment setting
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String status = "on"; // String | New auto repayment status. `on` - enabled, `off` - disabled
try {
AutoRepaySetting result = apiInstance.setAutoRepay(status);
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 MarginApi#setAutoRepay");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| status | String | New auto repayment status. `on` - enabled, `off` - disabled |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Current auto repayment setting | - |
MarginTransferable getMarginTransferable(currency).currencyPair(currencyPair).execute();
Get the max transferable amount for a specific margin 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
String currencyPair = "BTC_USDT"; // String | Currency pair
try {
MarginTransferable result = apiInstance.getMarginTransferable(currency)
.currencyPair(currencyPair)
.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 MarginApi#getMarginTransferable");
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 | |
| currencyPair | String | Currency pair | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
MarginBorrowable getMarginBorrowable(currency).currencyPair(currencyPair).execute();
Get the max borrowable amount for a specific margin 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
String currencyPair = "BTC_USDT"; // String | Currency pair
try {
MarginBorrowable result = apiInstance.getMarginBorrowable(currency)
.currencyPair(currencyPair)
.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 MarginApi#getMarginBorrowable");
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 | |
| currencyPair | String | Currency pair | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
List<CrossMarginCurrency> listCrossMarginCurrencies()
Currencies supported by cross margin.
// 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.MarginApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
MarginApi apiInstance = new MarginApi(defaultClient);
try {
List<CrossMarginCurrency> result = apiInstance.listCrossMarginCurrencies();
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 MarginApi#listCrossMarginCurrencies");
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 | List retrieved | - |
CrossMarginCurrency getCrossMarginCurrency(currency)
Retrieve detail of one single currency supported by cross margin
// 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.MarginApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
MarginApi apiInstance = new MarginApi(defaultClient);
String currency = "BTC"; // String | Currency name
try {
CrossMarginCurrency result = apiInstance.getCrossMarginCurrency(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 MarginApi#getCrossMarginCurrency");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Currency name |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
CrossMarginAccount getCrossMarginAccount()
Retrieve cross margin 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
try {
CrossMarginAccount result = apiInstance.getCrossMarginAccount();
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 MarginApi#getCrossMarginAccount");
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 | - |
List<CrossMarginAccountBook> listCrossMarginAccountBook().currency(currency).from(from).to(to).page(page).limit(limit).type(type).execute();
Retrieve cross margin account change history
Record time range cannot exceed 30 days
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String currency = "currency_example"; // String | Filter by currency
Long from = 56L; // Long | Time range beginning, default to 7 days before current time
Long to = 56L; // Long | Time range ending, default to current time
Integer page = 1; // Integer | Page number
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
String type = "borrow"; // String | Only retrieve changes of the specified type. All types will be returned if not specified.
try {
List<CrossMarginAccountBook> result = apiInstance.listCrossMarginAccountBook()
.currency(currency)
.from(from)
.to(to)
.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 MarginApi#listCrossMarginAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | Filter by currency | [optional] |
| from | Long | Time range beginning, default to 7 days before current time | [optional] |
| to | Long | Time range ending, default to current time | [optional] |
| page | Integer | Page number | [optional] [default to 1] |
| limit | Integer | 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] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
List<CrossMarginLoan> listCrossMarginLoans(status).currency(currency).limit(limit).offset(offset).reverse(reverse).execute();
List cross margin borrow history
Sort by creation time in descending order by default. Set `reverse=false` to return ascending results.
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
Integer status = 56; // Integer | Filter by status. Supported values are 2 and 3.
String currency = "currency_example"; // String | Filter by currency
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
Integer offset = 0; // Integer | List offset, starting from 0
Boolean reverse = true; // Boolean | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results
try {
List<CrossMarginLoan> result = apiInstance.listCrossMarginLoans(status)
.currency(currency)
.limit(limit)
.offset(offset)
.reverse(reverse)
.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 MarginApi#listCrossMarginLoans");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| status | Integer | Filter by status. Supported values are 2 and 3. | |
| currency | String | Filter by currency | [optional] |
| limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
| offset | Integer | 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 true] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
CrossMarginLoan createCrossMarginLoan(crossMarginLoan)
Create a cross margin borrow loan
Borrow amount cannot be less than currency minimum borrow amount
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
CrossMarginLoan crossMarginLoan = new CrossMarginLoan(); // CrossMarginLoan |
try {
CrossMarginLoan result = apiInstance.createCrossMarginLoan(crossMarginLoan);
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 MarginApi#createCrossMarginLoan");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| crossMarginLoan | CrossMarginLoan |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully borrowed | - |
CrossMarginLoan getCrossMarginLoan(loanId)
Retrieve single borrow loan detail
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String loanId = "12345"; // String | Borrow loan ID
try {
CrossMarginLoan result = apiInstance.getCrossMarginLoan(loanId);
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 MarginApi#getCrossMarginLoan");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| loanId | String | Borrow loan ID |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Successfully retrieved | - |
List<CrossMarginRepayment> listCrossMarginRepayments().currency(currency).loanId(loanId).limit(limit).offset(offset).reverse(reverse).execute();
Retrieve cross margin repayments
Sort by creation time in descending order by default. Set `reverse=false` to return ascending results.
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String currency = "BTC"; // String |
String loanId = "12345"; // String |
Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
Integer offset = 0; // Integer | List offset, starting from 0
Boolean reverse = true; // Boolean | Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results
try {
List<CrossMarginRepayment> result = apiInstance.listCrossMarginRepayments()
.currency(currency)
.loanId(loanId)
.limit(limit)
.offset(offset)
.reverse(reverse)
.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 MarginApi#listCrossMarginRepayments");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| currency | String | [optional] | |
| loanId | String | [optional] | |
| limit | Integer | Maximum number of records to be returned in a single list | [optional] [default to 100] |
| offset | Integer | 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 true] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | List retrieved | - |
List<CrossMarginLoan> repayCrossMarginLoan(crossMarginRepayRequest)
Repay cross margin loan
// 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
CrossMarginRepayRequest crossMarginRepayRequest = new CrossMarginRepayRequest(); // CrossMarginRepayRequest |
try {
List<CrossMarginLoan> result = apiInstance.repayCrossMarginLoan(crossMarginRepayRequest);
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 MarginApi#repayCrossMarginLoan");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| crossMarginRepayRequest | CrossMarginRepayRequest |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Loan repaid | - |
CrossMarginTransferable getCrossMarginTransferable(currency)
Get the max transferable amount for a specific cross margin 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
try {
CrossMarginTransferable result = apiInstance.getCrossMarginTransferable(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 MarginApi#getCrossMarginTransferable");
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 | - |
CrossMarginBorrowable getCrossMarginBorrowable(currency)
Get the max borrowable amount for a specific cross margin 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.MarginApi;
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");
MarginApi apiInstance = new MarginApi(defaultClient);
String currency = "BTC"; // String | Retrieve data of the specified currency
try {
CrossMarginBorrowable result = apiInstance.getCrossMarginBorrowable(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 MarginApi#getCrossMarginBorrowable");
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 | - |