Skip to content

Latest commit

 

History

History
1325 lines (1032 loc) · 45.1 KB

UnifiedApi.md

File metadata and controls

1325 lines (1032 loc) · 45.1 KB

Io.Gate.GateApi.Api.UnifiedApi

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

Method HTTP request Description
ListUnifiedAccounts GET /unified/accounts Get unified account information
GetUnifiedBorrowable GET /unified/borrowable Query about the maximum borrowing for the unified account
GetUnifiedTransferable GET /unified/transferable Query about the maximum transferable for the unified account
ListUnifiedLoans GET /unified/loans List loans
CreateUnifiedLoan POST /unified/loans Borrow or repay
ListUnifiedLoanRecords GET /unified/loan_records Get load records
ListUnifiedLoanInterestRecords GET /unified/interest_records List interest records
GetUnifiedRiskUnits GET /unified/risk_units Get user risk unit details
GetUnifiedMode GET /unified/unified_mode Query mode of the unified account
SetUnifiedMode PUT /unified/unified_mode Set mode of the unified account
GetUnifiedEstimateRate GET /unified/estimate_rate Get unified estimate rate
ListCurrencyDiscountTiers GET /unified/currency_discount_tiers List currency discount tiers
ListLoanMarginTiers GET /unified/loan_margin_tiers List loan margin tiers
CalculatePortfolioMargin POST /unified/portfolio_calculator Portfolio margin calculator
GetUserLeverageCurrencyConfig GET /unified/leverage/user_currency_config Minimum currency leverage that can be set
GetUserLeverageCurrencySetting GET /unified/leverage/user_currency_setting Get the leverage multiple of the user currency
SetUserLeverageCurrencySetting POST /unified/leverage/user_currency_setting Set the loan currency leverage
GetHistoryLoanRate GET /unified/history_loan_rate get historical lending rates

ListUnifiedAccounts

UnifiedAccount ListUnifiedAccounts (string currency = null, string subUid = null)

Get unified account information

The assets of each currency in the account will be adjusted according to their liquidity, defined by corresponding adjustment coefficients, and then uniformly converted to USD to calculate the total asset value and position value of the account. You can refer to the Formula in the documentation

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 ListUnifiedAccountsExample
    {
        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 UnifiedApi(config);
            var currency = "BTC";  // string | Retrieve data of the specified currency (optional) 
            var subUid = "10001";  // string | Sub account user ID (optional) 

            try
            {
                // Get unified account information
                UnifiedAccount result = apiInstance.ListUnifiedAccounts(currency, subUid);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.ListUnifiedAccounts: " + 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
currency string Retrieve data of the specified currency [optional]
subUid string Sub account user ID [optional]

Return type

UnifiedAccount

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]

GetUnifiedBorrowable

UnifiedBorrowable GetUnifiedBorrowable (string currency)

Query about the maximum borrowing for the unified account

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 GetUnifiedBorrowableExample
    {
        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 UnifiedApi(config);
            var currency = "BTC";  // string | Retrieve data of the specified currency

            try
            {
                // Query about the maximum borrowing for the unified account
                UnifiedBorrowable result = apiInstance.GetUnifiedBorrowable(currency);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.GetUnifiedBorrowable: " + 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
currency string Retrieve data of the specified currency

Return type

UnifiedBorrowable

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]

GetUnifiedTransferable

UnifiedTransferable GetUnifiedTransferable (string currency)

Query about the maximum transferable for the unified account

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 GetUnifiedTransferableExample
    {
        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 UnifiedApi(config);
            var currency = "BTC";  // string | Retrieve data of the specified currency

            try
            {
                // Query about the maximum transferable for the unified account
                UnifiedTransferable result = apiInstance.GetUnifiedTransferable(currency);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.GetUnifiedTransferable: " + 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
currency string Retrieve data of the specified currency

Return type

UnifiedTransferable

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]

ListUnifiedLoans

List<UniLoan> ListUnifiedLoans (string currency = null, int? page = null, int? limit = null, string type = null)

List loans

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 ListUnifiedLoansExample
    {
        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 UnifiedApi(config);
            var currency = "BTC";  // string | Retrieve data of the specified currency (optional) 
            var page = 1;  // int? | Page number (optional)  (default to 1)
            var limit = 100;  // int? | Maximum response items.  Default: 100, minimum: 1, Maximum: 100 (optional)  (default to 100)
            var type = "platform";  // string | Loan type, platform - platform, margin - margin (optional) 

            try
            {
                // List loans
                List<UniLoan> result = apiInstance.ListUnifiedLoans(currency, page, limit, type);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.ListUnifiedLoans: " + 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
currency string Retrieve data of the specified currency [optional]
page int? Page number [optional] [default to 1]
limit int? Maximum response items. Default: 100, minimum: 1, Maximum: 100 [optional] [default to 100]
type string Loan type, platform - platform, margin - margin [optional]

Return type

List<UniLoan>

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]

CreateUnifiedLoan

void CreateUnifiedLoan (UnifiedLoan unifiedLoan)

Borrow or repay

When borrowing, it is essential to ensure that the borrowed amount is not below the minimum borrowing threshold for the specific cryptocurrency and does not exceed the maximum borrowing limit set by the platform and the user. The interest on the loan will be automatically deducted from the account at regular intervals. It is the user's responsibility to manage the repayment of the borrowed amount. For repayment, the option to repay the entire borrowed amount is available by setting the parameter repaid_all=true

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 CreateUnifiedLoanExample
    {
        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 UnifiedApi(config);
            var unifiedLoan = new UnifiedLoan(); // UnifiedLoan | 

            try
            {
                // Borrow or repay
                apiInstance.CreateUnifiedLoan(unifiedLoan);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.CreateUnifiedLoan: " + 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
unifiedLoan UnifiedLoan

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]

ListUnifiedLoanRecords

List<UnifiedLoanRecord> ListUnifiedLoanRecords (string type = null, string currency = null, int? page = null, int? limit = null)

Get load 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 ListUnifiedLoanRecordsExample
    {
        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 UnifiedApi(config);
            var type = "type_example";  // string | The types of lending records, borrow - indicates the action of borrowing funds, repay - indicates the action of repaying the borrowed funds (optional) 
            var currency = "BTC";  // string | Retrieve data of the specified currency (optional) 
            var page = 1;  // int? | Page number (optional)  (default to 1)
            var limit = 100;  // int? | Maximum response items.  Default: 100, minimum: 1, Maximum: 100 (optional)  (default to 100)

            try
            {
                // Get load records
                List<UnifiedLoanRecord> result = apiInstance.ListUnifiedLoanRecords(type, currency, page, limit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.ListUnifiedLoanRecords: " + 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
type string The types of lending records, borrow - indicates the action of borrowing funds, repay - indicates the action of repaying the borrowed funds [optional]
currency string Retrieve data of the specified currency [optional]
page int? Page number [optional] [default to 1]
limit int? Maximum response items. Default: 100, minimum: 1, Maximum: 100 [optional] [default to 100]

Return type

List<UnifiedLoanRecord>

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]

ListUnifiedLoanInterestRecords

List<UniLoanInterestRecord> ListUnifiedLoanInterestRecords (string currency = null, int? page = null, int? limit = null, long? from = null, long? to = null, string type = null)

List interest 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 ListUnifiedLoanInterestRecordsExample
    {
        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 UnifiedApi(config);
            var currency = "BTC";  // string | Retrieve data of the specified currency (optional) 
            var page = 1;  // int? | Page number (optional)  (default to 1)
            var limit = 100;  // int? | Maximum response items.  Default: 100, minimum: 1, Maximum: 100 (optional)  (default to 100)
            var from = 1627706330;  // long? | Start timestamp of the query (optional) 
            var to = 1635329650;  // long? | Time range ending, default to current time (optional) 
            var type = "platform";  // string | Loan type, platform loan - platform, leverage loan - margin, if not passed, defaults to margin (optional) 

            try
            {
                // List interest records
                List<UniLoanInterestRecord> result = apiInstance.ListUnifiedLoanInterestRecords(currency, page, limit, from, to, type);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.ListUnifiedLoanInterestRecords: " + 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
currency string Retrieve data of the specified currency [optional]
page int? Page number [optional] [default to 1]
limit int? Maximum response items. Default: 100, minimum: 1, Maximum: 100 [optional] [default to 100]
from long? Start timestamp of the query [optional]
to long? Time range ending, default to current time [optional]
type string Loan type, platform loan - platform, leverage loan - margin, if not passed, defaults to margin [optional]

Return type

List<UniLoanInterestRecord>

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]

GetUnifiedRiskUnits

UnifiedRiskUnits GetUnifiedRiskUnits ()

Get user risk unit details

Retrieve user risk unit details, only valid in portfolio margin mode

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 GetUnifiedRiskUnitsExample
    {
        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 UnifiedApi(config);

            try
            {
                // Get user risk unit details
                UnifiedRiskUnits result = apiInstance.GetUnifiedRiskUnits();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.GetUnifiedRiskUnits: " + 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

UnifiedRiskUnits

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]

GetUnifiedMode

UnifiedModeSet GetUnifiedMode ()

Query mode of the unified account

Unified account mode: - classic: Classic account mode - multi_currency: Cross-currency margin mode - portfolio: Portfolio margin mode - single_currency: Single-currency margin mode

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 GetUnifiedModeExample
    {
        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 UnifiedApi(config);

            try
            {
                // Query mode of the unified account
                UnifiedModeSet result = apiInstance.GetUnifiedMode();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.GetUnifiedMode: " + 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

UnifiedModeSet

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]

SetUnifiedMode

void SetUnifiedMode (UnifiedModeSet unifiedModeSet)

Set mode of the unified account

Switching each account mode only requires passing the parameters of the corresponding account mode, and supports turning on or off the configuration switch in the corresponding account mode when switching the account mode - When opening the classic account mode, mode=classic PUT /unified/unified_mode { \"mode\": \"classic\" } - Open the cross-currency margin mode, mode=multi_currency PUT /unified/unified_mode { \"mode\": \"multi_currency\", \"settings\": { \"usdt_futures\": true } } - When the portfolio margin mode is enabled, mode=portfolio PUT /unified/unified_mode { \"mode\": \"portfolio\", \"settings\": { \"spot_hedge\": true } } - When opening a single currency margin mode, mode=single_currency PUT /unified/unified_mode { \"mode\": \"single_currency\" }

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 SetUnifiedModeExample
    {
        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 UnifiedApi(config);
            var unifiedModeSet = new UnifiedModeSet(); // UnifiedModeSet | 

            try
            {
                // Set mode of the unified account
                apiInstance.SetUnifiedMode(unifiedModeSet);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.SetUnifiedMode: " + 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
unifiedModeSet UnifiedModeSet

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 Success -

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

GetUnifiedEstimateRate

Dictionary<string, string> GetUnifiedEstimateRate (List currencies)

Get unified estimate rate

Due to fluctuations in lending depth, hourly interest rates may vary, and thus, I cannot provide exact rates. When a currency is not supported, the interest rate returned will be an empty string.

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 GetUnifiedEstimateRateExample
    {
        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 UnifiedApi(config);
            var currencies = new List<string>(); // List<string> | Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies.

            try
            {
                // Get unified estimate rate
                Dictionary<string, string> result = apiInstance.GetUnifiedEstimateRate(currencies);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.GetUnifiedEstimateRate: " + 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
currencies List<string> Specify the currency names for querying in an array, separated by commas, with a maximum of 10 currencies.

Return type

Dictionary<string, string>

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]

ListCurrencyDiscountTiers

List<UnifiedDiscount> ListCurrencyDiscountTiers ()

List currency discount tiers

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

            try
            {
                // List currency discount tiers
                List<UnifiedDiscount> result = apiInstance.ListCurrencyDiscountTiers();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.ListCurrencyDiscountTiers: " + 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

List<UnifiedDiscount>

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]

ListLoanMarginTiers

List<UnifiedMarginTiers> ListLoanMarginTiers ()

List loan margin tiers

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

            try
            {
                // List loan margin tiers
                List<UnifiedMarginTiers> result = apiInstance.ListLoanMarginTiers();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.ListLoanMarginTiers: " + 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

List<UnifiedMarginTiers>

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]

CalculatePortfolioMargin

UnifiedPortfolioOutput CalculatePortfolioMargin (UnifiedPortfolioInput unifiedPortfolioInput)

Portfolio margin calculator

Portfolio Margin Calculator When inputting a simulated position portfolio, each position includes the position name and quantity held, supporting markets within the range of BTC and ETH perpetual contracts, options, and spot markets. When inputting simulated orders, each order includes the market identifier, order price, and order quantity, supporting markets within the range of BTC and ETH perpetual contracts, options, and spot markets. Market orders are not included.

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 CalculatePortfolioMarginExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new UnifiedApi(config);
            var unifiedPortfolioInput = new UnifiedPortfolioInput(); // UnifiedPortfolioInput | 

            try
            {
                // Portfolio margin calculator
                UnifiedPortfolioOutput result = apiInstance.CalculatePortfolioMargin(unifiedPortfolioInput);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.CalculatePortfolioMargin: " + 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
unifiedPortfolioInput UnifiedPortfolioInput

Return type

UnifiedPortfolioOutput

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • 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]

GetUserLeverageCurrencyConfig

UnifiedLeverageConfig GetUserLeverageCurrencyConfig (string currency)

Minimum currency leverage that can be set

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 GetUserLeverageCurrencyConfigExample
    {
        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 UnifiedApi(config);
            var currency = "BTC";  // string | Currency

            try
            {
                // Minimum currency leverage that can be set
                UnifiedLeverageConfig result = apiInstance.GetUserLeverageCurrencyConfig(currency);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.GetUserLeverageCurrencyConfig: " + 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
currency string Currency

Return type

UnifiedLeverageConfig

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]

GetUserLeverageCurrencySetting

UnifiedLeverageSetting GetUserLeverageCurrencySetting (string currency = null)

Get the leverage multiple of the user currency

Get the user's currency leverage. If currency is not passed, query all 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 GetUserLeverageCurrencySettingExample
    {
        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 UnifiedApi(config);
            var currency = "BTC";  // string | Currency (optional) 

            try
            {
                // Get the leverage multiple of the user currency
                UnifiedLeverageSetting result = apiInstance.GetUserLeverageCurrencySetting(currency);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.GetUserLeverageCurrencySetting: " + 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
currency string Currency [optional]

Return type

UnifiedLeverageSetting

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]

SetUserLeverageCurrencySetting

void SetUserLeverageCurrencySetting (UnifiedLeverageSetting unifiedLeverageSetting)

Set the loan currency leverage

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 SetUserLeverageCurrencySettingExample
    {
        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 UnifiedApi(config);
            var unifiedLeverageSetting = new UnifiedLeverageSetting(); // UnifiedLeverageSetting | 

            try
            {
                // Set the loan currency leverage
                apiInstance.SetUserLeverageCurrencySetting(unifiedLeverageSetting);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.SetUserLeverageCurrencySetting: " + 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
unifiedLeverageSetting UnifiedLeverageSetting

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 Success -

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

GetHistoryLoanRate

UnifiedHistoryLoanRate GetHistoryLoanRate (string currency, string tier = null, int? page = null, int? limit = null)

get historical lending rates

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 GetHistoryLoanRateExample
    {
        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 UnifiedApi(config);
            var currency = "USDT";  // string | Currency
            var tier = "1";  // string | The VIP level of the floating rate that needs to be queried (optional) 
            var page = 1;  // int? | Page number (optional)  (default to 1)
            var limit = 100;  // int? | Maximum response items.  Default: 100, minimum: 1, Maximum: 100 (optional)  (default to 100)

            try
            {
                // get historical lending rates
                UnifiedHistoryLoanRate result = apiInstance.GetHistoryLoanRate(currency, tier, page, limit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling UnifiedApi.GetHistoryLoanRate: " + 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
currency string Currency
tier string The VIP level of the floating rate that needs to be queried [optional]
page int? Page number [optional] [default to 1]
limit int? Maximum response items. Default: 100, minimum: 1, Maximum: 100 [optional] [default to 100]

Return type

UnifiedHistoryLoanRate

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]