[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
751 lines (589 loc) · 25.5 KB

CollateralLoanApi.md

File metadata and controls

751 lines (589 loc) · 25.5 KB

Io.Gate.GateApi.Api.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 (int? page = null, int? limit = null, string collateralCurrency = null, string borrowCurrency = null)

List Orders

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class ListCollateralLoanOrdersExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new CollateralLoanApi(config);
            var page = 1;  // int? | Page number (optional)  (default to 1)
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var collateralCurrency = "BTC";  // string | Collateral (optional) 
            var borrowCurrency = "USDT";  // string | Borrowed currency (optional) 

            try
            {
                // List Orders
                List<CollateralOrder> result = apiInstance.ListCollateralLoanOrders(page, limit, collateralCurrency, borrowCurrency);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CollateralLoanApi.ListCollateralLoanOrders: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
page int? Page number [optional] [default to 1]
limit int? 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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateCollateralLoan

OrderResp CreateCollateralLoan (CreateCollateralOrder createCollateralOrder)

Place order

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class CreateCollateralLoanExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new CollateralLoanApi(config);
            var createCollateralOrder = new CreateCollateralOrder(); // CreateCollateralOrder | 

            try
            {
                // Place order
                OrderResp result = apiInstance.CreateCollateralLoan(createCollateralOrder);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CollateralLoanApi.CreateCollateralLoan: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetCollateralLoanOrderDetail

CollateralOrder GetCollateralLoanOrderDetail (long orderId)

Get a single order

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class GetCollateralLoanOrderDetailExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new CollateralLoanApi(config);
            var orderId = 100001;  // long | Order ID returned on successful order creation

            try
            {
                // Get a single order
                CollateralOrder result = apiInstance.GetCollateralLoanOrderDetail(orderId);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CollateralLoanApi.GetCollateralLoanOrderDetail: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

RepayCollateralLoan

RepayResp RepayCollateralLoan (RepayLoan repayLoan)

Repayment

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class RepayCollateralLoanExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new CollateralLoanApi(config);
            var repayLoan = new RepayLoan(); // RepayLoan | 

            try
            {
                // Repayment
                RepayResp result = apiInstance.RepayCollateralLoan(repayLoan);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CollateralLoanApi.RepayCollateralLoan: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListRepayRecords

List<RepayRecord> ListRepayRecords (string source, string borrowCurrency = null, string collateralCurrency = null, int? page = null, int? limit = null, long? from = null, long? to = null)

Repayment history

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class ListRepayRecordsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new CollateralLoanApi(config);
            var source = "repay";  // string | Operation type: repay - Regular repayment, liquidate - Liquidation
            var borrowCurrency = "USDT";  // string | Borrowed currency (optional) 
            var collateralCurrency = "BTC";  // string | Collateral (optional) 
            var page = 1;  // int? | Page number (optional)  (default to 1)
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var from = 1609459200;  // long? | Start timestamp of the query (optional) 
            var to = 1609459200;  // long? | Time range ending, default to current time (optional) 

            try
            {
                // Repayment history
                List<RepayRecord> result = apiInstance.ListRepayRecords(source, borrowCurrency, collateralCurrency, page, limit, from, to);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CollateralLoanApi.ListRepayRecords: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
source string Operation type: repay - Regular repayment, liquidate - Liquidation
borrowCurrency string Borrowed currency [optional]
collateralCurrency string Collateral [optional]
page int? Page number [optional] [default to 1]
limit int? 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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListCollateralRecords

List<CollateralRecord> ListCollateralRecords (int? page = null, int? limit = null, long? from = null, long? to = null, string borrowCurrency = null, string collateralCurrency = null)

Query collateral adjustment records

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class ListCollateralRecordsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new CollateralLoanApi(config);
            var page = 1;  // int? | Page number (optional)  (default to 1)
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var from = 1609459200;  // long? | Start timestamp of the query (optional) 
            var to = 1609459200;  // long? | Time range ending, default to current time (optional) 
            var borrowCurrency = "USDT";  // string | Borrowed currency (optional) 
            var collateralCurrency = "BTC";  // string | Collateral (optional) 

            try
            {
                // Query collateral adjustment records
                List<CollateralRecord> result = apiInstance.ListCollateralRecords(page, limit, from, to, borrowCurrency, collateralCurrency);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CollateralLoanApi.ListCollateralRecords: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
page int? Page number [optional] [default to 1]
limit int? 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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

OperateCollateral

void OperateCollateral (CollateralAlign collateralAlign)

Increase or redeem collateral

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class OperateCollateralExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new CollateralLoanApi(config);
            var collateralAlign = new CollateralAlign(); // CollateralAlign | 

            try
            {
                // Increase or redeem collateral
                apiInstance.OperateCollateral(collateralAlign);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CollateralLoanApi.OperateCollateral: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
collateralAlign CollateralAlign

Return type

void (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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetUserTotalAmount

UserTotalAmount GetUserTotalAmount ()

Query the total borrowing and collateral amount for the user

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class GetUserTotalAmountExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new CollateralLoanApi(config);

            try
            {
                // Query the total borrowing and collateral amount for the user
                UserTotalAmount result = apiInstance.GetUserTotalAmount();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CollateralLoanApi.GetUserTotalAmount: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetUserLtvInfo

UserLtvInfo GetUserLtvInfo (string collateralCurrency, string borrowCurrency)

Query user's collateralization ratio

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class GetUserLtvInfoExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            config.SetGateApiV4KeyPair("YOUR_API_KEY", "YOUR_API_SECRET");

            var apiInstance = new CollateralLoanApi(config);
            var collateralCurrency = "BTC";  // string | Collateral
            var borrowCurrency = "USDT";  // string | Borrowed currency

            try
            {
                // Query user's collateralization ratio
                UserLtvInfo result = apiInstance.GetUserLtvInfo(collateralCurrency, borrowCurrency);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CollateralLoanApi.GetUserLtvInfo: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListCollateralCurrencies

List<CollateralLoanCurrency> ListCollateralCurrencies (string loanCurrency = null)

Query supported borrowing and collateral currencies

Example

using System.Collections.Generic;
using System.Diagnostics;
using Io.Gate.GateApi.Api;
using Io.Gate.GateApi.Client;
using Io.Gate.GateApi.Model;

namespace Example
{
    public class ListCollateralCurrenciesExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new CollateralLoanApi(config);
            var 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. (optional) 

            try
            {
                // Query supported borrowing and collateral currencies
                List<CollateralLoanCurrency> result = apiInstance.ListCollateralCurrencies(loanCurrency);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CollateralLoanApi.ListCollateralCurrencies: " + e.Message);
                Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]