Skip to content

Latest commit

 

History

History
1547 lines (1217 loc) · 48.3 KB

File metadata and controls

1547 lines (1217 loc) · 48.3 KB

Io.Gate.GateApi.Api.CFDApi

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

Method HTTP request Description
QueryMt5AccountInfo GET /tradfi/users/mt5-account Query MT5 account information
QueryCategories GET /tradfi/symbols/categories Query trading symbol categories
QuerySymbolCommissions GET /tradfi/symbols/commissions Query symbol commission rates
QuerySymbols GET /tradfi/symbols Query trading symbol list
QuerySymbolDetail GET /tradfi/symbols/detail Query trading symbol details
QuerySymbolKline GET /tradfi/symbols/{symbol}/klines Query trading symbol klines
QuerySymbolTicker GET /tradfi/symbols/{symbol}/tickers Query trading symbol ticker
CreateTradFiUser POST /tradfi/users Create CFD user
QueryUserAssets GET /tradfi/users/assets Query account assets
QueryTransaction GET /tradfi/transactions Query Fund Transfer In/Out Records
CreateTransaction POST /tradfi/transactions Fund transfer
QueryOrderList GET /tradfi/orders Query active order list
CreateTradFiOrder POST /tradfi/orders Create order
UpdateOrder PUT /tradfi/orders/{order_id} Modify order
DeleteOrder DELETE /tradfi/orders/{order_id} Cancel order
QueryOrderHistoryList GET /tradfi/orders/history Query historical order list
QueryOrderLog GET /tradfi/orders/log/{log_id} Get order details by log ID
QueryPositionList GET /tradfi/positions Query active position list
UpdatePosition PUT /tradfi/positions/{position_id} Modify position
ClosePosition POST /tradfi/positions/{position_id}/close Close position
QueryPositionHistoryList GET /tradfi/positions/history Query historical position list

QueryMt5AccountInfo

Mt5Account QueryMt5AccountInfo ()

Query MT5 account information

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 QueryMt5AccountInfoExample
    {
        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 CFDApi(config);

            try
            {
                // Query MT5 account information
                Mt5Account result = apiInstance.QueryMt5AccountInfo();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QueryMt5AccountInfo: " + 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

Mt5Account

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

QueryCategories

Categories QueryCategories ()

Query trading symbol categories

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

            try
            {
                // Query trading symbol categories
                Categories result = apiInstance.QueryCategories();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QueryCategories: " + 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

Categories

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

QuerySymbolCommissions

SymbolCommissions QuerySymbolCommissions (string symbols = null, string categoryCode = null)

Query symbol commission 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 QuerySymbolCommissionsExample
    {
        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 CFDApi(config);
            var symbols = "AUDUSD,XAUUSD";  // string | List of symbol codes (multiple codes separated by commas). At least one of symbol and category_code is required (optional) 
            var categoryCode = "forex-外汇,metal-金属,index-指数,commodity-大宗商品,stock-股票";  // string | List of category codes (multiple codes separated by commas). When provided together with symbols, filters symbols by category. At least one of symbol and category_code is required (optional) 

            try
            {
                // Query symbol commission rates
                SymbolCommissions result = apiInstance.QuerySymbolCommissions(symbols, categoryCode);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QuerySymbolCommissions: " + 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
symbols string List of symbol codes (multiple codes separated by commas). At least one of symbol and category_code is required [optional]
categoryCode string List of category codes (multiple codes separated by commas). When provided together with symbols, filters symbols by category. At least one of symbol and category_code is required [optional]

Return type

SymbolCommissions

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

QuerySymbols

Symbols QuerySymbols ()

Query trading symbol list

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

            try
            {
                // Query trading symbol list
                Symbols result = apiInstance.QuerySymbols();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QuerySymbols: " + 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

Symbols

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

QuerySymbolDetail

ContractDetail QuerySymbolDetail (string symbols)

Query trading symbol details

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 QuerySymbolDetailExample
    {
        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 CFDApi(config);
            var symbols = "EURUSD,XAGUSD";  // string | Trading symbol code list (comma-separated, max 10 symbols)

            try
            {
                // Query trading symbol details
                ContractDetail result = apiInstance.QuerySymbolDetail(symbols);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QuerySymbolDetail: " + 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
symbols string Trading symbol code list (comma-separated, max 10 symbols)

Return type

ContractDetail

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

QuerySymbolKline

Klines QuerySymbolKline (string symbol, string klineType, long? beginTime = null, long? endTime = null, int? limit = null)

Query trading symbol klines

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 QuerySymbolKlineExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new CFDApi(config);
            var symbol = "EURUSD";  // string | Trading symbol code
            var klineType = "1m";  // string | Kline type (time period)
            var beginTime = 1769378400;  // long? | Start time (Unix timestamp in seconds) (optional) 
            var endTime = 1769464800;  // long? | End time (Unix timestamp in seconds) (optional) 
            var limit = 100;  // int? | Kline limit (max 500, error if exceeded) (optional) 

            try
            {
                // Query trading symbol klines
                Klines result = apiInstance.QuerySymbolKline(symbol, klineType, beginTime, endTime, limit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QuerySymbolKline: " + 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
symbol string Trading symbol code
klineType string Kline type (time period)
beginTime long? Start time (Unix timestamp in seconds) [optional]
endTime long? End time (Unix timestamp in seconds) [optional]
limit int? Kline limit (max 500, error if exceeded) [optional]

Return type

Klines

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

QuerySymbolTicker

TradFiTicker QuerySymbolTicker (string symbol)

Query trading symbol ticker

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 QuerySymbolTickerExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new CFDApi(config);
            var symbol = "EURUSD";  // string | Trading symbol code

            try
            {
                // Query trading symbol ticker
                TradFiTicker result = apiInstance.QuerySymbolTicker(symbol);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QuerySymbolTicker: " + 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
symbol string Trading symbol code

Return type

TradFiTicker

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

CreateTradFiUser

CreateUserResp CreateTradFiUser ()

Create CFD 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 CreateTradFiUserExample
    {
        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 CFDApi(config);

            try
            {
                // Create CFD user
                CreateUserResp result = apiInstance.CreateTradFiUser();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.CreateTradFiUser: " + 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

CreateUserResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Account opened successfully -
400 Request failed -

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

QueryUserAssets

UserAssetResp QueryUserAssets ()

Query account assets

Query account assets

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 QueryUserAssetsExample
    {
        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 CFDApi(config);

            try
            {
                // Query account assets
                UserAssetResp result = apiInstance.QueryUserAssets();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QueryUserAssets: " + 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

UserAssetResp

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

QueryTransaction

TransactionList QueryTransaction (long? beginTime = null, long? endTime = null, string type = null, int? page = null, int? pageSize = null)

Query Fund Transfer In/Out 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 QueryTransactionExample
    {
        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 CFDApi(config);
            var beginTime = 1704067200;  // long? | Start Time (Second-level Timestamp) (optional) 
            var endTime = 1706745599;  // long? | End Time (Second-level Timestamp) (optional) 
            var type = "withdraw";  // string | Transaction Type (deposit - transfer in, withdraw - transfer out, dividend - dividend payment, fill_negative - cover negative balance) (optional) 
            var page = 1;  // int? | page number (optional) 
            var pageSize = 20;  // int? | Number per page, default 10, maximum 50 (optional) 

            try
            {
                // Query Fund Transfer In/Out Records
                TransactionList result = apiInstance.QueryTransaction(beginTime, endTime, type, page, pageSize);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QueryTransaction: " + 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
beginTime long? Start Time (Second-level Timestamp) [optional]
endTime long? End Time (Second-level Timestamp) [optional]
type string Transaction Type (deposit - transfer in, withdraw - transfer out, dividend - dividend payment, fill_negative - cover negative balance) [optional]
page int? page number [optional]
pageSize int? Number per page, default 10, maximum 50 [optional]

Return type

TransactionList

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

CreateTransaction

CreateTransaction CreateTransaction (TradFiTransactionRequest tradFiTransactionRequest)

Fund transfer

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 CreateTransactionExample
    {
        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 CFDApi(config);
            var tradFiTransactionRequest = new TradFiTransactionRequest(); // TradFiTransactionRequest | 

            try
            {
                // Fund transfer
                CreateTransaction result = apiInstance.CreateTransaction(tradFiTransactionRequest);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.CreateTransaction: " + 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
tradFiTransactionRequest TradFiTransactionRequest

Return type

CreateTransaction

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

QueryOrderList

OrderList QueryOrderList ()

Query active order list

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 QueryOrderListExample
    {
        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 CFDApi(config);

            try
            {
                // Query active order list
                OrderList result = apiInstance.QueryOrderList();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QueryOrderList: " + 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

OrderList

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

CreateTradFiOrder

CreateOrder2 CreateTradFiOrder (TradFiOrderRequest tradFiOrderRequest)

Create 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 CreateTradFiOrderExample
    {
        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 CFDApi(config);
            var tradFiOrderRequest = new TradFiOrderRequest(); // TradFiOrderRequest | 

            try
            {
                // Create order
                CreateOrder2 result = apiInstance.CreateTradFiOrder(tradFiOrderRequest);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.CreateTradFiOrder: " + 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
tradFiOrderRequest TradFiOrderRequest

Return type

CreateOrder2

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Order placed successfully -
400 Request failed -

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

UpdateOrder

UpdateOrder UpdateOrder (int orderId, TradFiOrderUpdateRequest tradFiOrderUpdateRequest)

Modify 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 UpdateOrderExample
    {
        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 CFDApi(config);
            var orderId = 1223;  // int | Order ID
            var tradFiOrderUpdateRequest = new TradFiOrderUpdateRequest(); // TradFiOrderUpdateRequest | 

            try
            {
                // Modify order
                UpdateOrder result = apiInstance.UpdateOrder(orderId, tradFiOrderUpdateRequest);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.UpdateOrder: " + 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 int Order ID
tradFiOrderUpdateRequest TradFiOrderUpdateRequest

Return type

UpdateOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

DeleteOrder

Object DeleteOrder (int orderId)

Cancel 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 DeleteOrderExample
    {
        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 CFDApi(config);
            var orderId = 1223;  // int | Order ID

            try
            {
                // Cancel order
                Object result = apiInstance.DeleteOrder(orderId);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.DeleteOrder: " + 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 int Order ID

Return type

Object

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Deleted successfully -
400 Request failed -

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

QueryOrderHistoryList

OrderHistoryList QueryOrderHistoryList (long? beginTime = null, long? endTime = null, string symbol = null, int? side = null)

Query historical order list

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 QueryOrderHistoryListExample
    {
        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 CFDApi(config);
            var beginTime = 1769397000;  // long? | Start time (Unix timestamp in seconds), earliest query is one month ago (optional) 
            var endTime = 1769398000;  // long? | End time (Unix timestamp in seconds) (optional) 
            var symbol = "USDCAD";  // string | Currency pair (optional) 
            var side = 2;  // int? | Side (1=sell, 2=buy) (optional) 

            try
            {
                // Query historical order list
                OrderHistoryList result = apiInstance.QueryOrderHistoryList(beginTime, endTime, symbol, side);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QueryOrderHistoryList: " + 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
beginTime long? Start time (Unix timestamp in seconds), earliest query is one month ago [optional]
endTime long? End time (Unix timestamp in seconds) [optional]
symbol string Currency pair [optional]
side int? Side (1=sell, 2=buy) [optional]

Return type

OrderHistoryList

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

QueryOrderLog

OrderLog QueryOrderLog (int logId)

Get order details by log ID

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 QueryOrderLogExample
    {
        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 CFDApi(config);
            var logId = 1223;  // int | log_id returned from the order placement API

            try
            {
                // Get order details by log ID
                OrderLog result = apiInstance.QueryOrderLog(logId);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QueryOrderLog: " + 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
logId int log_id returned from the order placement API

Return type

OrderLog

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

QueryPositionList

PositionList QueryPositionList ()

Query active position list

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 QueryPositionListExample
    {
        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 CFDApi(config);

            try
            {
                // Query active position list
                PositionList result = apiInstance.QueryPositionList();
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QueryPositionList: " + 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

PositionList

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

UpdatePosition

UpdatePosition UpdatePosition (int positionId, TradFiPositionUpdateRequest tradFiPositionUpdateRequest)

Modify position

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 UpdatePositionExample
    {
        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 CFDApi(config);
            var positionId = 1223;  // int | Position ID
            var tradFiPositionUpdateRequest = new TradFiPositionUpdateRequest(); // TradFiPositionUpdateRequest | 

            try
            {
                // Modify position
                UpdatePosition result = apiInstance.UpdatePosition(positionId, tradFiPositionUpdateRequest);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.UpdatePosition: " + 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
positionId int Position ID
tradFiPositionUpdateRequest TradFiPositionUpdateRequest

Return type

UpdatePosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

ClosePosition

DeletePosition ClosePosition (int positionId, TradFiClosePositionRequest tradFiClosePositionRequest)

Close position

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 ClosePositionExample
    {
        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 CFDApi(config);
            var positionId = 1223;  // int | Position ID
            var tradFiClosePositionRequest = new TradFiClosePositionRequest(); // TradFiClosePositionRequest | 

            try
            {
                // Close position
                DeletePosition result = apiInstance.ClosePosition(positionId, tradFiClosePositionRequest);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.ClosePosition: " + 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
positionId int Position ID
tradFiClosePositionRequest TradFiClosePositionRequest

Return type

DeletePosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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

QueryPositionHistoryList

PositionHistoryList QueryPositionHistoryList (long? page = null, long? pageSize = null, long? beginTime = null, long? endTime = null, string symbol = null, string positionDir = null)

Query historical position list

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 QueryPositionHistoryListExample
    {
        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 CFDApi(config);
            var page = 1;  // long? | Page number; defaults to 1 if omitted. (optional) 
            var pageSize = 10;  // long? | Page size; defaults to 10 if omitted. Maximum 100. (optional) 
            var beginTime = 56;  // long? | Start Time (Unix Timestamp, seconds). The earliest queryable time is one month ago (optional) 
            var endTime = 56;  // long? | End time (timestamp in seconds) (optional) 
            var symbol = "symbol_example";  // string | Trading symbol (e.g., EURUSD) (optional) 
            var positionDir = "positionDir_example";  // string | Position direction (Long=long position, Short=short position) (optional) 

            try
            {
                // Query historical position list
                PositionHistoryList result = apiInstance.QueryPositionHistoryList(page, pageSize, beginTime, endTime, symbol, positionDir);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling CFDApi.QueryPositionHistoryList: " + 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 long? Page number; defaults to 1 if omitted. [optional]
pageSize long? Page size; defaults to 10 if omitted. Maximum 100. [optional]
beginTime long? Start Time (Unix Timestamp, seconds). The earliest queryable time is one month ago [optional]
endTime long? End time (timestamp in seconds) [optional]
symbol string Trading symbol (e.g., EURUSD) [optional]
positionDir string Position direction (Long=long position, Short=short position) [optional]

Return type

PositionHistoryList

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request success -
400 Request failed -

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