[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
740 lines (578 loc) · 26.2 KB

CollateralLoanApi.md

File metadata and controls

740 lines (578 loc) · 26.2 KB

CollateralLoanApi

All URIs are relative to https://api.gateio.ws/api/v4

Method HTTP request Description
listCollateralLoanOrders GET /loan/collateral/orders List Orders
createCollateralLoan POST /loan/collateral/orders Place order
getCollateralLoanOrderDetail GET /loan/collateral/orders/{order_id} Get a single order
repayCollateralLoan POST /loan/collateral/repay Repayment
listRepayRecords GET /loan/collateral/repay_records Repayment history
listCollateralRecords GET /loan/collateral/collaterals Query collateral adjustment records
operateCollateral POST /loan/collateral/collaterals Increase or redeem collateral
getUserTotalAmount GET /loan/collateral/total_amount Query the total borrowing and collateral amount for the user
getUserLtvInfo GET /loan/collateral/ltv Query user's collateralization ratio
listCollateralCurrencies GET /loan/collateral/currencies Query supported borrowing and collateral currencies

listCollateralLoanOrders

List<CollateralOrder> listCollateralLoanOrders().page(page).limit(limit).collateralCurrency(collateralCurrency).borrowCurrency(borrowCurrency).execute();

List Orders

Example

// 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.CollateralLoanApi;

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

        CollateralLoanApi apiInstance = new CollateralLoanApi(defaultClient);
        Integer page = 1; // Integer | Page number
        Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
        String collateralCurrency = "BTC"; // String | Collateral
        String borrowCurrency = "USDT"; // String | Borrowed currency
        try {
            List<CollateralOrder> result = apiInstance.listCollateralLoanOrders()
                        .page(page)
                        .limit(limit)
                        .collateralCurrency(collateralCurrency)
                        .borrowCurrency(borrowCurrency)
                        .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 CollateralLoanApi#listCollateralLoanOrders");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
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]
collateralCurrency String Collateral [optional]
borrowCurrency String Borrowed currency [optional]

Return type

List<CollateralOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 List retrieved -

createCollateralLoan

OrderResp createCollateralLoan(createCollateralOrder)

Place order

Example

// 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.CollateralLoanApi;

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

        CollateralLoanApi apiInstance = new CollateralLoanApi(defaultClient);
        CreateCollateralOrder createCollateralOrder = new CreateCollateralOrder(); // CreateCollateralOrder | 
        try {
            OrderResp result = apiInstance.createCollateralLoan(createCollateralOrder);
            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 CollateralLoanApi#createCollateralLoan");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
createCollateralOrder CreateCollateralOrder

Return type

OrderResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success -

getCollateralLoanOrderDetail

CollateralOrder getCollateralLoanOrderDetail(orderId)

Get a single order

Example

// 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.CollateralLoanApi;

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

        CollateralLoanApi apiInstance = new CollateralLoanApi(defaultClient);
        Long orderId = 100001L; // Long | Order ID returned on successful order creation
        try {
            CollateralOrder result = apiInstance.getCollateralLoanOrderDetail(orderId);
            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 CollateralLoanApi#getCollateralLoanOrderDetail");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
orderId Long Order ID returned on successful order creation

Return type

CollateralOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Success -

repayCollateralLoan

RepayResp repayCollateralLoan(repayLoan)

Repayment

Example

// 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.CollateralLoanApi;

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

        CollateralLoanApi apiInstance = new CollateralLoanApi(defaultClient);
        RepayLoan repayLoan = new RepayLoan(); // RepayLoan | 
        try {
            RepayResp result = apiInstance.repayCollateralLoan(repayLoan);
            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 CollateralLoanApi#repayCollateralLoan");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
repayLoan RepayLoan

Return type

RepayResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Operated successfully -

listRepayRecords

List<RepayRecord> listRepayRecords(source).borrowCurrency(borrowCurrency).collateralCurrency(collateralCurrency).page(page).limit(limit).from(from).to(to).execute();

Repayment history

Example

// 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.CollateralLoanApi;

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

        CollateralLoanApi apiInstance = new CollateralLoanApi(defaultClient);
        String source = "repay"; // String | Operation type: repay - Regular repayment, liquidate - Liquidation
        String borrowCurrency = "USDT"; // String | Borrowed currency
        String collateralCurrency = "BTC"; // String | Collateral
        Integer page = 1; // Integer | Page number
        Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
        Long from = 1609459200L; // Long | Start timestamp of the query
        Long to = 1609459200L; // Long | Time range ending, default to current time
        try {
            List<RepayRecord> result = apiInstance.listRepayRecords(source)
                        .borrowCurrency(borrowCurrency)
                        .collateralCurrency(collateralCurrency)
                        .page(page)
                        .limit(limit)
                        .from(from)
                        .to(to)
                        .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 CollateralLoanApi#listRepayRecords");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
source String Operation type: repay - Regular repayment, liquidate - Liquidation
borrowCurrency String Borrowed currency [optional]
collateralCurrency String Collateral [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]
from Long Start timestamp of the query [optional]
to Long Time range ending, default to current time [optional]

Return type

List<RepayRecord>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successfully retrieved -

listCollateralRecords

List<CollateralRecord> listCollateralRecords().page(page).limit(limit).from(from).to(to).borrowCurrency(borrowCurrency).collateralCurrency(collateralCurrency).execute();

Query collateral adjustment records

Example

// 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.CollateralLoanApi;

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

        CollateralLoanApi apiInstance = new CollateralLoanApi(defaultClient);
        Integer page = 1; // Integer | Page number
        Integer limit = 100; // Integer | Maximum number of records to be returned in a single list
        Long from = 1609459200L; // Long | Start timestamp of the query
        Long to = 1609459200L; // Long | Time range ending, default to current time
        String borrowCurrency = "USDT"; // String | Borrowed currency
        String collateralCurrency = "BTC"; // String | Collateral
        try {
            List<CollateralRecord> result = apiInstance.listCollateralRecords()
                        .page(page)
                        .limit(limit)
                        .from(from)
                        .to(to)
                        .borrowCurrency(borrowCurrency)
                        .collateralCurrency(collateralCurrency)
                        .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 CollateralLoanApi#listCollateralRecords");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
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]
from Long Start timestamp of the query [optional]
to Long Time range ending, default to current time [optional]
borrowCurrency String Borrowed currency [optional]
collateralCurrency String Collateral [optional]

Return type

List<CollateralRecord>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successfully retrieved -

operateCollateral

operateCollateral(collateralAlign)

Increase or redeem collateral

Example

// 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.CollateralLoanApi;

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

        CollateralLoanApi apiInstance = new CollateralLoanApi(defaultClient);
        CollateralAlign collateralAlign = new CollateralAlign(); // CollateralAlign | 
        try {
            apiInstance.operateCollateral(collateralAlign);
        } 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 CollateralLoanApi#operateCollateral");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
collateralAlign CollateralAlign

Return type

null (empty response body)

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
204 Operated successfully -

getUserTotalAmount

UserTotalAmount getUserTotalAmount()

Query the total borrowing and collateral amount for the user

Example

// 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.CollateralLoanApi;

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

        CollateralLoanApi apiInstance = new CollateralLoanApi(defaultClient);
        try {
            UserTotalAmount result = apiInstance.getUserTotalAmount();
            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 CollateralLoanApi#getUserTotalAmount");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

This endpoint does not need any parameter.

Return type

UserTotalAmount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successfully retrieved -

getUserLtvInfo

UserLtvInfo getUserLtvInfo(collateralCurrency, borrowCurrency)

Query user's collateralization ratio

Example

// 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.CollateralLoanApi;

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

        CollateralLoanApi apiInstance = new CollateralLoanApi(defaultClient);
        String collateralCurrency = "BTC"; // String | Collateral
        String borrowCurrency = "USDT"; // String | Borrowed currency
        try {
            UserLtvInfo result = apiInstance.getUserLtvInfo(collateralCurrency, borrowCurrency);
            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 CollateralLoanApi#getUserLtvInfo");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
collateralCurrency String Collateral
borrowCurrency String Borrowed currency

Return type

UserLtvInfo

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successfully retrieved -

listCollateralCurrencies

List<CollateralLoanCurrency> listCollateralCurrencies().loanCurrency(loanCurrency).execute();

Query supported borrowing and collateral currencies

Example

// 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.CollateralLoanApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("https://api.gateio.ws/api/v4");

        CollateralLoanApi apiInstance = new CollateralLoanApi(defaultClient);
        String loanCurrency = "BTC"; // String | The parameter loan_currency is used to specify the borrowing currency. If loan_currency is not provided, the API will return all supported borrowing currencies. If loan_currency is provided, the API will return an array of collateral currencies supported for the specified borrowing currency.
        try {
            List<CollateralLoanCurrency> result = apiInstance.listCollateralCurrencies()
                        .loanCurrency(loanCurrency)
                        .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 CollateralLoanApi#listCollateralCurrencies");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
loanCurrency String The parameter loan_currency is used to specify the borrowing currency. If loan_currency is not provided, the API will return all supported borrowing currencies. If loan_currency is provided, the API will return an array of collateral currencies supported for the specified borrowing currency. [optional]

Return type

List<CollateralLoanCurrency>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successfully retrieved -