[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
3556 lines (2815 loc) · 130 KB

FuturesApi.md

File metadata and controls

3556 lines (2815 loc) · 130 KB

Io.Gate.GateApi.Api.FuturesApi

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

Method HTTP request Description
ListFuturesContracts GET /futures/{settle}/contracts List all futures contracts
GetFuturesContract GET /futures/{settle}/contracts/{contract} Get a single contract
ListFuturesOrderBook GET /futures/{settle}/order_book Futures order book
ListFuturesTrades GET /futures/{settle}/trades Futures trading history
ListFuturesCandlesticks GET /futures/{settle}/candlesticks Get futures candlesticks
ListFuturesPremiumIndex GET /futures/{settle}/premium_index Premium Index K-Line
ListFuturesTickers GET /futures/{settle}/tickers List futures tickers
ListFuturesFundingRateHistory GET /futures/{settle}/funding_rate Funding rate history
ListFuturesInsuranceLedger GET /futures/{settle}/insurance Futures insurance balance history
ListContractStats GET /futures/{settle}/contract_stats Futures stats
GetIndexConstituents GET /futures/{settle}/index_constituents/{index} Get index constituents
ListLiquidatedOrders GET /futures/{settle}/liq_orders Retrieve liquidation history
ListRiskLimitTiers GET /futures/{settle}/risk_limit_tiers List risk limit tiers
ListFuturesAccounts GET /futures/{settle}/accounts Query futures account
ListFuturesAccountBook GET /futures/{settle}/account_book Query account book
ListPositions GET /futures/{settle}/positions List all positions of a user
GetPosition GET /futures/{settle}/positions/{contract} Get single position
UpdatePositionMargin POST /futures/{settle}/positions/{contract}/margin Update position margin
UpdatePositionLeverage POST /futures/{settle}/positions/{contract}/leverage Update position leverage
UpdatePositionRiskLimit POST /futures/{settle}/positions/{contract}/risk_limit Update position risk limit
SetDualMode POST /futures/{settle}/dual_mode Enable or disable dual mode
GetDualModePosition GET /futures/{settle}/dual_comp/positions/{contract} Retrieve position detail in dual mode
UpdateDualModePositionMargin POST /futures/{settle}/dual_comp/positions/{contract}/margin Update position margin in dual mode
UpdateDualModePositionLeverage POST /futures/{settle}/dual_comp/positions/{contract}/leverage Update position leverage in dual mode
UpdateDualModePositionRiskLimit POST /futures/{settle}/dual_comp/positions/{contract}/risk_limit Update position risk limit in dual mode
ListFuturesOrders GET /futures/{settle}/orders List futures orders
CreateFuturesOrder POST /futures/{settle}/orders Create a futures order
CancelFuturesOrders DELETE /futures/{settle}/orders Cancel all `open` orders matched
GetOrdersWithTimeRange GET /futures/{settle}/orders_timerange List Futures Orders By Time Range
CreateBatchFuturesOrder POST /futures/{settle}/batch_orders Create a batch of futures orders
GetFuturesOrder GET /futures/{settle}/orders/{order_id} Get a single order
AmendFuturesOrder PUT /futures/{settle}/orders/{order_id} Amend an order
CancelFuturesOrder DELETE /futures/{settle}/orders/{order_id} Cancel a single order
GetMyTrades GET /futures/{settle}/my_trades List personal trading history
GetMyTradesWithTimeRange GET /futures/{settle}/my_trades_timerange List personal trading history by time range
ListPositionClose GET /futures/{settle}/position_close List position close history
ListLiquidates GET /futures/{settle}/liquidates List liquidation history
ListAutoDeleverages GET /futures/{settle}/auto_deleverages List Auto-Deleveraging History
CountdownCancelAllFutures POST /futures/{settle}/countdown_cancel_all Countdown cancel orders
GetFuturesFee GET /futures/{settle}/fee Query user trading fee rates
CancelBatchFutureOrders POST /futures/{settle}/batch_cancel_orders Cancel a batch of orders with an ID list
ListPriceTriggeredOrders GET /futures/{settle}/price_orders List all auto orders
CreatePriceTriggeredOrder POST /futures/{settle}/price_orders Create a price-triggered order
CancelPriceTriggeredOrderList DELETE /futures/{settle}/price_orders Cancel all open orders
GetPriceTriggeredOrder GET /futures/{settle}/price_orders/{order_id} Get a price-triggered order
CancelPriceTriggeredOrder DELETE /futures/{settle}/price_orders/{order_id} cancel a price-triggered order

ListFuturesContracts

List<Contract> ListFuturesContracts (string settle, int? limit = null, int? offset = null)

List all futures contracts

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 ListFuturesContractsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var offset = 0;  // int? | List offset, starting from 0 (optional)  (default to 0)

            try
            {
                // List all futures contracts
                List<Contract> result = apiInstance.ListFuturesContracts(settle, limit, offset);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListFuturesContracts: " + 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
settle string Settle currency
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
offset int? List offset, starting from 0 [optional] [default to 0]

Return type

List<Contract>

Authorization

No authorization required

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]

GetFuturesContract

Contract GetFuturesContract (string settle, string contract)

Get a single contract

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 GetFuturesContractExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract

            try
            {
                // Get a single contract
                Contract result = apiInstance.GetFuturesContract(settle, contract);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.GetFuturesContract: " + 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
settle string Settle currency
contract string Futures contract

Return type

Contract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Contract information -

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

ListFuturesOrderBook

FuturesOrderBook ListFuturesOrderBook (string settle, string contract, string interval = null, int? limit = null, bool? withId = null)

Futures order book

Bids will be sorted by price from high to low, while asks sorted reversely

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 ListFuturesOrderBookExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var interval = "\"0\"";  // string | Order depth. 0 means no aggregation is applied. default to 0 (optional)  (default to "0")
            var limit = 10;  // int? | Maximum number of order depth data in asks or bids (optional)  (default to 10)
            var withId = false;  // bool? | Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional)  (default to false)

            try
            {
                // Futures order book
                FuturesOrderBook result = apiInstance.ListFuturesOrderBook(settle, contract, interval, limit, withId);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListFuturesOrderBook: " + 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
settle string Settle currency
contract string Futures contract
interval string Order depth. 0 means no aggregation is applied. default to 0 [optional] [default to "0"]
limit int? Maximum number of order depth data in asks or bids [optional] [default to 10]
withId bool? Whether the order book update ID will be returned. This ID increases by 1 on every order book update [optional] [default to false]

Return type

FuturesOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Order book retrieved -

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

ListFuturesTrades

List<FuturesTrade> ListFuturesTrades (string settle, string contract, int? limit = null, int? offset = null, string lastId = null, long? from = null, long? to = null)

Futures trading 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 ListFuturesTradesExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var offset = 0;  // int? | List offset, starting from 0 (optional)  (default to 0)
            var lastId = "12345";  // string | Specify the starting point for this list based on a previously retrieved id  This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) 
            var from = 1546905600;  // long? | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned.  (optional) 
            var to = 1546935600;  // long? | Specify end time in Unix seconds, default to current time (optional) 

            try
            {
                // Futures trading history
                List<FuturesTrade> result = apiInstance.ListFuturesTrades(settle, contract, limit, offset, lastId, from, to);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListFuturesTrades: " + 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
settle string Settle currency
contract string Futures contract
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
offset int? List offset, starting from 0 [optional] [default to 0]
lastId string Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range [optional]
from long? Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. [optional]
to long? Specify end time in Unix seconds, default to current time [optional]

Return type

List<FuturesTrade>

Authorization

No authorization required

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]

ListFuturesCandlesticks

List<FuturesCandlestick> ListFuturesCandlesticks (string settle, string contract, long? from = null, long? to = null, int? limit = null, string interval = null)

Get futures candlesticks

Return specified contract candlesticks. If prefix contract with mark_, the contract's mark price candlesticks are returned; if prefix with index_, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying from, to and interval

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 ListFuturesCandlesticksExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var from = 1546905600;  // long? | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) 
            var to = 1546935600;  // long? | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) 
            var limit = 100;  // int? | Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional)  (default to 100)
            var interval = "\"5m\"";  // string | Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0.  Note that 30d means 1 natual month, not 30 days (optional)  (default to "5m")

            try
            {
                // Get futures candlesticks
                List<FuturesCandlestick> result = apiInstance.ListFuturesCandlesticks(settle, contract, from, to, limit, interval);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListFuturesCandlesticks: " + 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
settle string Settle currency
contract string Futures contract
from long? Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified [optional]
to long? End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time [optional]
limit int? Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. [optional] [default to 100]
interval string Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0. Note that 30d means 1 natual month, not 30 days [optional] [default to "5m"]

Return type

List<FuturesCandlestick>

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]

ListFuturesPremiumIndex

List<FuturesPremiumIndex> ListFuturesPremiumIndex (string settle, string contract, long? from = null, long? to = null, int? limit = null, string interval = null)

Premium Index K-Line

Maximum of 1000 points can be returned in a query. Be sure not to exceed the limit when specifying from, to and interval

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 ListFuturesPremiumIndexExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var from = 1546905600;  // long? | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional) 
            var to = 1546935600;  // long? | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) 
            var limit = 100;  // int? | Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional)  (default to 100)
            var interval = "\"5m\"";  // string | Interval time between data points (optional)  (default to "5m")

            try
            {
                // Premium Index K-Line
                List<FuturesPremiumIndex> result = apiInstance.ListFuturesPremiumIndex(settle, contract, from, to, limit, interval);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListFuturesPremiumIndex: " + 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
settle string Settle currency
contract string Futures contract
from long? Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified [optional]
to long? End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time [optional]
limit int? Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. [optional] [default to 100]
interval string Interval time between data points [optional] [default to "5m"]

Return type

List<FuturesPremiumIndex>

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]

ListFuturesTickers

List<FuturesTicker> ListFuturesTickers (string settle, string contract = null)

List futures tickers

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 ListFuturesTickersExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 

            try
            {
                // List futures tickers
                List<FuturesTicker> result = apiInstance.ListFuturesTickers(settle, contract);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListFuturesTickers: " + 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
settle string Settle currency
contract string Futures contract, return related data only if specified [optional]

Return type

List<FuturesTicker>

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]

ListFuturesFundingRateHistory

List<FundingRateRecord> ListFuturesFundingRateHistory (string settle, string contract, int? limit = null)

Funding rate 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 ListFuturesFundingRateHistoryExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)

            try
            {
                // Funding rate history
                List<FundingRateRecord> result = apiInstance.ListFuturesFundingRateHistory(settle, contract, limit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListFuturesFundingRateHistory: " + 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
settle string Settle currency
contract string Futures contract
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]

Return type

List<FundingRateRecord>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 History retrieved -

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

ListFuturesInsuranceLedger

List<InsuranceRecord> ListFuturesInsuranceLedger (string settle, int? limit = null)

Futures insurance balance 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 ListFuturesInsuranceLedgerExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)

            try
            {
                // Futures insurance balance history
                List<InsuranceRecord> result = apiInstance.ListFuturesInsuranceLedger(settle, limit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListFuturesInsuranceLedger: " + 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
settle string Settle currency
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]

Return type

List<InsuranceRecord>

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]

ListContractStats

List<ContractStat> ListContractStats (string settle, string contract, long? from = null, string interval = null, int? limit = null)

Futures stats

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 ListContractStatsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var from = 1604561000;  // long? | Start timestamp (optional) 
            var interval = "\"5m\"";  // string |  (optional)  (default to "5m")
            var limit = 30;  // int? |  (optional)  (default to 30)

            try
            {
                // Futures stats
                List<ContractStat> result = apiInstance.ListContractStats(settle, contract, from, interval, limit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListContractStats: " + 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
settle string Settle currency
contract string Futures contract
from long? Start timestamp [optional]
interval string [optional] [default to "5m"]
limit int? [optional] [default to 30]

Return type

List<ContractStat>

Authorization

No authorization required

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]

GetIndexConstituents

FuturesIndexConstituents GetIndexConstituents (string settle, string index)

Get index constituents

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 GetIndexConstituentsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var index = "BTC_USDT";  // string | Index name

            try
            {
                // Get index constituents
                FuturesIndexConstituents result = apiInstance.GetIndexConstituents(settle, index);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.GetIndexConstituents: " + 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
settle string Settle currency
index string Index name

Return type

FuturesIndexConstituents

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]

ListLiquidatedOrders

List<FuturesLiqOrder> ListLiquidatedOrders (string settle, string contract = null, long? from = null, long? to = null, int? limit = null)

Retrieve liquidation history

Interval between from and to cannot exceeds 3600. Some private fields will not be returned in public endpoints. Refer to field description for detail.

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 ListLiquidatedOrdersExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 
            var from = 1547706332;  // long? | Start timestamp (optional) 
            var to = 1547706332;  // long? | End timestamp (optional) 
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)

            try
            {
                // Retrieve liquidation history
                List<FuturesLiqOrder> result = apiInstance.ListLiquidatedOrders(settle, contract, from, to, limit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListLiquidatedOrders: " + 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
settle string Settle currency
contract string Futures contract, return related data only if specified [optional]
from long? Start timestamp [optional]
to long? End timestamp [optional]
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]

Return type

List<FuturesLiqOrder>

Authorization

No authorization required

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]

ListRiskLimitTiers

List<FuturesLimitRiskTiers> ListRiskLimitTiers (string settle, string contract)

List risk limit 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 ListRiskLimitTiersExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.gateio.ws/api/v4";
            var apiInstance = new FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract

            try
            {
                // List risk limit tiers
                List<FuturesLimitRiskTiers> result = apiInstance.ListRiskLimitTiers(settle, contract);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListRiskLimitTiers: " + 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
settle string Settle currency
contract string Futures contract

Return type

List<FuturesLimitRiskTiers>

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]

ListFuturesAccounts

FuturesAccount ListFuturesAccounts (string settle)

Query futures 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 ListFuturesAccountsExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency

            try
            {
                // Query futures account
                FuturesAccount result = apiInstance.ListFuturesAccounts(settle);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListFuturesAccounts: " + 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
settle string Settle currency

Return type

FuturesAccount

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]

ListFuturesAccountBook

List<FuturesAccountBook> ListFuturesAccountBook (string settle, string contract = null, int? limit = null, int? offset = null, long? from = null, long? to = null, string type = null)

Query account book

If the contract field is provided, it can only filter records that include this field after 2023-10-30.

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 ListFuturesAccountBookExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var offset = 0;  // int? | List offset, starting from 0 (optional)  (default to 0)
            var from = 1547706332;  // long? | Start timestamp (optional) 
            var to = 1547706332;  // long? | End timestamp (optional) 
            var type = "dnw";  // string | Changing Type:  - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate - bonus_offset: bouns deduction (optional) 

            try
            {
                // Query account book
                List<FuturesAccountBook> result = apiInstance.ListFuturesAccountBook(settle, contract, limit, offset, from, to, type);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListFuturesAccountBook: " + 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
settle string Settle currency
contract string Futures contract, return related data only if specified [optional]
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
offset int? List offset, starting from 0 [optional] [default to 0]
from long? Start timestamp [optional]
to long? End timestamp [optional]
type string Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate - bonus_offset: bouns deduction [optional]

Return type

List<FuturesAccountBook>

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]

ListPositions

List<Position> ListPositions (string settle, bool? holding = null, int? limit = null, int? offset = null)

List all positions of a 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 ListPositionsExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var holding = true;  // bool? | Return only real positions - true, return all - false. (optional) 
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var offset = 0;  // int? | List offset, starting from 0 (optional)  (default to 0)

            try
            {
                // List all positions of a user
                List<Position> result = apiInstance.ListPositions(settle, holding, limit, offset);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListPositions: " + 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
settle string Settle currency
holding bool? Return only real positions - true, return all - false. [optional]
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
offset int? List offset, starting from 0 [optional] [default to 0]

Return type

List<Position>

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]

GetPosition

Position GetPosition (string settle, string contract)

Get single 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 GetPositionExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract

            try
            {
                // Get single position
                Position result = apiInstance.GetPosition(settle, contract);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.GetPosition: " + 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
settle string Settle currency
contract string Futures contract

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Position information -

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

UpdatePositionMargin

Position UpdatePositionMargin (string settle, string contract, string change)

Update position margin

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 UpdatePositionMarginExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var change = "0.01";  // string | Margin change. Use positive number to increase margin, negative number otherwise.

            try
            {
                // Update position margin
                Position result = apiInstance.UpdatePositionMargin(settle, contract, change);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.UpdatePositionMargin: " + 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
settle string Settle currency
contract string Futures contract
change string Margin change. Use positive number to increase margin, negative number otherwise.

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Position information -

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

UpdatePositionLeverage

Position UpdatePositionLeverage (string settle, string contract, string leverage, string crossLeverageLimit = null)

Update position 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 UpdatePositionLeverageExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var leverage = "10";  // string | New position leverage
            var crossLeverageLimit = "10";  // string | Cross margin leverage(valid only when `leverage` is 0) (optional) 

            try
            {
                // Update position leverage
                Position result = apiInstance.UpdatePositionLeverage(settle, contract, leverage, crossLeverageLimit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.UpdatePositionLeverage: " + 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
settle string Settle currency
contract string Futures contract
leverage string New position leverage
crossLeverageLimit string Cross margin leverage(valid only when `leverage` is 0) [optional]

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Position information -

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

UpdatePositionRiskLimit

Position UpdatePositionRiskLimit (string settle, string contract, string riskLimit)

Update position risk limit

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 UpdatePositionRiskLimitExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var riskLimit = "10";  // string | New position risk limit

            try
            {
                // Update position risk limit
                Position result = apiInstance.UpdatePositionRiskLimit(settle, contract, riskLimit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.UpdatePositionRiskLimit: " + 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
settle string Settle currency
contract string Futures contract
riskLimit string New position risk limit

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Position information -

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

SetDualMode

FuturesAccount SetDualMode (string settle, bool dualMode)

Enable or disable dual mode

Before setting dual mode, make sure all positions are closed and no orders are open

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 SetDualModeExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var dualMode = true;  // bool | Whether to enable dual mode

            try
            {
                // Enable or disable dual mode
                FuturesAccount result = apiInstance.SetDualMode(settle, dualMode);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.SetDualMode: " + 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
settle string Settle currency
dualMode bool Whether to enable dual mode

Return type

FuturesAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Updated -

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

GetDualModePosition

List<Position> GetDualModePosition (string settle, string contract)

Retrieve position detail in dual 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 GetDualModePositionExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract

            try
            {
                // Retrieve position detail in dual mode
                List<Position> result = apiInstance.GetDualModePosition(settle, contract);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.GetDualModePosition: " + 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
settle string Settle currency
contract string Futures contract

Return type

List<Position>

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]

UpdateDualModePositionMargin

List<Position> UpdateDualModePositionMargin (string settle, string contract, string change, string dualSide)

Update position margin in dual 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 UpdateDualModePositionMarginExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var change = "0.01";  // string | Margin change. Use positive number to increase margin, negative number otherwise.
            var dualSide = "dual_long";  // string | Long or short position

            try
            {
                // Update position margin in dual mode
                List<Position> result = apiInstance.UpdateDualModePositionMargin(settle, contract, change, dualSide);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.UpdateDualModePositionMargin: " + 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
settle string Settle currency
contract string Futures contract
change string Margin change. Use positive number to increase margin, negative number otherwise.
dualSide string Long or short position

Return type

List<Position>

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]

UpdateDualModePositionLeverage

List<Position> UpdateDualModePositionLeverage (string settle, string contract, string leverage, string crossLeverageLimit = null)

Update position leverage in dual 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 UpdateDualModePositionLeverageExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var leverage = "10";  // string | New position leverage
            var crossLeverageLimit = "10";  // string | Cross margin leverage(valid only when `leverage` is 0) (optional) 

            try
            {
                // Update position leverage in dual mode
                List<Position> result = apiInstance.UpdateDualModePositionLeverage(settle, contract, leverage, crossLeverageLimit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.UpdateDualModePositionLeverage: " + 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
settle string Settle currency
contract string Futures contract
leverage string New position leverage
crossLeverageLimit string Cross margin leverage(valid only when `leverage` is 0) [optional]

Return type

List<Position>

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]

UpdateDualModePositionRiskLimit

List<Position> UpdateDualModePositionRiskLimit (string settle, string contract, string riskLimit)

Update position risk limit in dual 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 UpdateDualModePositionRiskLimitExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var riskLimit = "10";  // string | New position risk limit

            try
            {
                // Update position risk limit in dual mode
                List<Position> result = apiInstance.UpdateDualModePositionRiskLimit(settle, contract, riskLimit);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.UpdateDualModePositionRiskLimit: " + 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
settle string Settle currency
contract string Futures contract
riskLimit string New position risk limit

Return type

List<Position>

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]

ListFuturesOrders

List<FuturesOrder> ListFuturesOrders (string settle, string status, string contract = null, int? limit = null, int? offset = null, string lastId = null)

List futures orders

  • Zero-fill order cannot be retrieved for 10 minutes after cancellation - Historical orders, by default, only data within the past 6 months is supported. If you need to query data for a longer period, please use GET /futures/{settle}/orders_timerange.

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 ListFuturesOrdersExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var status = "open";  // string | Only list the orders with this status
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var offset = 0;  // int? | List offset, starting from 0 (optional)  (default to 0)
            var lastId = "12345";  // string | Specify list staring point using the `id` of last record in previous list-query results (optional) 

            try
            {
                // List futures orders
                List<FuturesOrder> result = apiInstance.ListFuturesOrders(settle, status, contract, limit, offset, lastId);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListFuturesOrders: " + 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
settle string Settle currency
status string Only list the orders with this status
contract string Futures contract, return related data only if specified [optional]
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
offset int? List offset, starting from 0 [optional] [default to 0]
lastId string Specify list staring point using the `id` of last record in previous list-query results [optional]

Return type

List<FuturesOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 List retrieved * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified

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

CreateFuturesOrder

FuturesOrder CreateFuturesOrder (string settle, FuturesOrder futuresOrder)

Create a futures order

  • Creating futures orders requires size, which is number of contracts instead of currency amount. You can use quanto_multiplier in contract detail response to know how much currency 1 size contract represents - Zero-filled order cannot be retrieved 10 minutes after order cancellation. You will get a 404 not found for such orders - Set reduce_only to true can keep the position from changing side when reducing position size - In single position mode, to close a position, you need to set size to 0 and close to true - In dual position mode, to close one side position, you need to set auto_size side, reduce_only to true and size to 0 - Set stp_act to decide the strategy of self-trade prevention. For detailed usage, refer to the stp_act parameter in request body

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 CreateFuturesOrderExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var futuresOrder = new FuturesOrder(); // FuturesOrder | 

            try
            {
                // Create a futures order
                FuturesOrder result = apiInstance.CreateFuturesOrder(settle, futuresOrder);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.CreateFuturesOrder: " + 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
settle string Settle currency
futuresOrder FuturesOrder

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 Order details -

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

CancelFuturesOrders

List<FuturesOrder> CancelFuturesOrders (string settle, string contract, string side = null)

Cancel all open orders matched

Zero-filled order cannot be retrieved 10 minutes after order cancellation

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 CancelFuturesOrdersExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract
            var side = "ask";  // string | All bids or asks. Both included if not specified (optional) 

            try
            {
                // Cancel all `open` orders matched
                List<FuturesOrder> result = apiInstance.CancelFuturesOrders(settle, contract, side);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.CancelFuturesOrders: " + 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
settle string Settle currency
contract string Futures contract
side string All bids or asks. Both included if not specified [optional]

Return type

List<FuturesOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 All orders matched cancelled -

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

GetOrdersWithTimeRange

List<FuturesOrder> GetOrdersWithTimeRange (string settle, string contract = null, long? from = null, long? to = null, int? limit = null, int? offset = null)

List Futures Orders By Time Range

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 GetOrdersWithTimeRangeExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 
            var from = 1547706332;  // long? | Start timestamp (optional) 
            var to = 1547706332;  // long? | End timestamp (optional) 
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var offset = 0;  // int? | List offset, starting from 0 (optional)  (default to 0)

            try
            {
                // List Futures Orders By Time Range
                List<FuturesOrder> result = apiInstance.GetOrdersWithTimeRange(settle, contract, from, to, limit, offset);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.GetOrdersWithTimeRange: " + 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
settle string Settle currency
contract string Futures contract, return related data only if specified [optional]
from long? Start timestamp [optional]
to long? End timestamp [optional]
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
offset int? List offset, starting from 0 [optional] [default to 0]

Return type

List<FuturesOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 List retrieved * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified

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

CreateBatchFuturesOrder

List<BatchFuturesOrder> CreateBatchFuturesOrder (string settle, List futuresOrder)

Create a batch of futures orders

  • Up to 10 orders per request - If any of the order's parameters are missing or in the wrong format, all of them will not be executed, and a http status 400 error will be returned directly - If the parameters are checked and passed, all are executed. Even if there is a business logic error in the middle (such as insufficient funds), it will not affect other execution orders - The returned result is in array format, and the order corresponds to the orders in the request body - In the returned result, the succeeded field of type bool indicates whether the execution was successful or not - If the execution is successful, the normal order content is included; if the execution fails, the label field is included to indicate the cause of the error - In the rate limiting, each order is counted individually

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 CreateBatchFuturesOrderExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var futuresOrder = new List<FuturesOrder>(); // List<FuturesOrder> | 

            try
            {
                // Create a batch of futures orders
                List<BatchFuturesOrder> result = apiInstance.CreateBatchFuturesOrder(settle, futuresOrder);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.CreateBatchFuturesOrder: " + 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
settle string Settle currency
futuresOrder List<FuturesOrder>

Return type

List<BatchFuturesOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Request is completed -

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

GetFuturesOrder

FuturesOrder GetFuturesOrder (string settle, string orderId)

Get a single order

  • Zero-fill order cannot be retrieved for 10 minutes after cancellation - Historical orders, by default, only data within the past 6 months is supported.

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 GetFuturesOrderExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var orderId = "12345";  // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook.  When the order is finished, it can be checked within 60 seconds after the end of the order.  After that, only order ID is accepted.

            try
            {
                // Get a single order
                FuturesOrder result = apiInstance.GetFuturesOrder(settle, orderId);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.GetFuturesOrder: " + 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
settle string Settle currency
orderId string Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted.

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Order details -

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

AmendFuturesOrder

FuturesOrder AmendFuturesOrder (string settle, string orderId, FuturesOrderAmendment futuresOrderAmendment)

Amend an 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 AmendFuturesOrderExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var orderId = "12345";  // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook.  When the order is finished, it can be checked within 60 seconds after the end of the order.  After that, only order ID is accepted.
            var futuresOrderAmendment = new FuturesOrderAmendment(); // FuturesOrderAmendment | 

            try
            {
                // Amend an order
                FuturesOrder result = apiInstance.AmendFuturesOrder(settle, orderId, futuresOrderAmendment);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.AmendFuturesOrder: " + 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
settle string Settle currency
orderId string Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted.
futuresOrderAmendment FuturesOrderAmendment

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Order details -

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

CancelFuturesOrder

FuturesOrder CancelFuturesOrder (string settle, string orderId)

Cancel 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 CancelFuturesOrderExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var orderId = "12345";  // string | Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook.  When the order is finished, it can be checked within 60 seconds after the end of the order.  After that, only order ID is accepted.

            try
            {
                // Cancel a single order
                FuturesOrder result = apiInstance.CancelFuturesOrder(settle, orderId);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.CancelFuturesOrder: " + 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
settle string Settle currency
orderId string Order ID returned, or user custom ID(i.e., `text` field). Operations based on custom ID can only be checked when the order is in orderbook. When the order is finished, it can be checked within 60 seconds after the end of the order. After that, only order ID is accepted.

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Order details -

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

GetMyTrades

List<MyFuturesTrade> GetMyTrades (string settle, string contract = null, long? order = null, int? limit = null, int? offset = null, string lastId = null)

List personal trading history

By default, only data within the past 6 months is supported. If you need to query data for a longer period, please use GET /futures/{settle}/my_trades_timerange.

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 GetMyTradesExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 
            var order = 12345;  // long? | Futures order ID, return related data only if specified (optional) 
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var offset = 0;  // int? | List offset, starting from 0 (optional)  (default to 0)
            var lastId = "12345";  // string | Specify the starting point for this list based on a previously retrieved id  This parameter is deprecated. If you need to iterate through and retrieve more records, we recommend using 'GET /futures/{settle}/my_trades_timerange'. (optional) 

            try
            {
                // List personal trading history
                List<MyFuturesTrade> result = apiInstance.GetMyTrades(settle, contract, order, limit, offset, lastId);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.GetMyTrades: " + 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
settle string Settle currency
contract string Futures contract, return related data only if specified [optional]
order long? Futures order ID, return related data only if specified [optional]
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
offset int? List offset, starting from 0 [optional] [default to 0]
lastId string Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. If you need to iterate through and retrieve more records, we recommend using 'GET /futures/{settle}/my_trades_timerange'. [optional]

Return type

List<MyFuturesTrade>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 List retrieved * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified

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

GetMyTradesWithTimeRange

List<MyFuturesTradeTimeRange> GetMyTradesWithTimeRange (string settle, string contract = null, long? from = null, long? to = null, int? limit = null, int? offset = null, string role = null)

List personal trading history by time range

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 GetMyTradesWithTimeRangeExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 
            var from = 1547706332;  // long? | Start timestamp (optional) 
            var to = 1547706332;  // long? | End timestamp (optional) 
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var offset = 0;  // int? | List offset, starting from 0 (optional)  (default to 0)
            var role = "maker";  // string | Query role, maker or taker. (optional) 

            try
            {
                // List personal trading history by time range
                List<MyFuturesTradeTimeRange> result = apiInstance.GetMyTradesWithTimeRange(settle, contract, from, to, limit, offset, role);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.GetMyTradesWithTimeRange: " + 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
settle string Settle currency
contract string Futures contract, return related data only if specified [optional]
from long? Start timestamp [optional]
to long? End timestamp [optional]
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
offset int? List offset, starting from 0 [optional] [default to 0]
role string Query role, maker or taker. [optional]

Return type

List<MyFuturesTradeTimeRange>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 List retrieved * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified

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

ListPositionClose

List<PositionClose> ListPositionClose (string settle, string contract = null, int? limit = null, int? offset = null, long? from = null, long? to = null, string side = null, string pnl = null)

List position close 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 ListPositionCloseExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var offset = 0;  // int? | List offset, starting from 0 (optional)  (default to 0)
            var from = 1547706332;  // long? | Start timestamp (optional) 
            var to = 1547706332;  // long? | End timestamp (optional) 
            var side = "short";  // string | Query side.  long or shot (optional) 
            var pnl = "profit";  // string | Query profit or loss (optional) 

            try
            {
                // List position close history
                List<PositionClose> result = apiInstance.ListPositionClose(settle, contract, limit, offset, from, to, side, pnl);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListPositionClose: " + 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
settle string Settle currency
contract string Futures contract, return related data only if specified [optional]
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
offset int? List offset, starting from 0 [optional] [default to 0]
from long? Start timestamp [optional]
to long? End timestamp [optional]
side string Query side. long or shot [optional]
pnl string Query profit or loss [optional]

Return type

List<PositionClose>

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]

ListLiquidates

List<FuturesLiquidate> ListLiquidates (string settle, string contract = null, int? limit = null, int? at = null)

List liquidation 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 ListLiquidatesExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var at = 0;  // int? | Specify a liquidation timestamp (optional)  (default to 0)

            try
            {
                // List liquidation history
                List<FuturesLiquidate> result = apiInstance.ListLiquidates(settle, contract, limit, at);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListLiquidates: " + 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
settle string Settle currency
contract string Futures contract, return related data only if specified [optional]
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
at int? Specify a liquidation timestamp [optional] [default to 0]

Return type

List<FuturesLiquidate>

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]

ListAutoDeleverages

List<FuturesAutoDeleverage> ListAutoDeleverages (string settle, string contract = null, int? limit = null, int? at = null)

List Auto-Deleveraging 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 ListAutoDeleveragesExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var at = 0;  // int? | Specify an auto-deleveraging timestamp (optional)  (default to 0)

            try
            {
                // List Auto-Deleveraging History
                List<FuturesAutoDeleverage> result = apiInstance.ListAutoDeleverages(settle, contract, limit, at);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListAutoDeleverages: " + 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
settle string Settle currency
contract string Futures contract, return related data only if specified [optional]
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
at int? Specify an auto-deleveraging timestamp [optional] [default to 0]

Return type

List<FuturesAutoDeleverage>

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]

CountdownCancelAllFutures

TriggerTime CountdownCancelAllFutures (string settle, CountdownCancelAllFuturesTask countdownCancelAllFuturesTask)

Countdown cancel orders

When the timeout set by the user is reached, if there is no cancel or set a new countdown, the related pending orders will be automatically cancelled. This endpoint can be called repeatedly to set a new countdown or cancel the countdown. For example, call this endpoint at 30s intervals, each countdowntimeout is set to 30s. If this endpoint is not called again within 30 seconds, all pending orders on the specified market will be automatically cancelled, if no market is specified, all market pending orders will be cancelled. If the timeout is set to 0 within 30 seconds, the countdown timer will expire and the cacnel function will be cancelled.

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 CountdownCancelAllFuturesExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var countdownCancelAllFuturesTask = new CountdownCancelAllFuturesTask(); // CountdownCancelAllFuturesTask | 

            try
            {
                // Countdown cancel orders
                TriggerTime result = apiInstance.CountdownCancelAllFutures(settle, countdownCancelAllFuturesTask);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.CountdownCancelAllFutures: " + 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
settle string Settle currency
countdownCancelAllFuturesTask CountdownCancelAllFuturesTask

Return type

TriggerTime

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Set countdown successfully -

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

GetFuturesFee

Dictionary<string, FuturesFee> GetFuturesFee (string settle, string contract = null)

Query user trading fee 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 GetFuturesFeeExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 

            try
            {
                // Query user trading fee rates
                Dictionary<string, FuturesFee> result = apiInstance.GetFuturesFee(settle, contract);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.GetFuturesFee: " + 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
settle string Settle currency
contract string Futures contract, return related data only if specified [optional]

Return type

Dictionary<string, FuturesFee>

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]

CancelBatchFutureOrders

List<FutureCancelOrderResult> CancelBatchFutureOrders (string settle, List requestBody)

Cancel a batch of orders with an ID list

Multiple distinct order ID list can be specified。Each request can cancel a maximum of 20 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 CancelBatchFutureOrdersExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var requestBody = new List<string>(); // List<string> | 

            try
            {
                // Cancel a batch of orders with an ID list
                List<FutureCancelOrderResult> result = apiInstance.CancelBatchFutureOrders(settle, requestBody);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.CancelBatchFutureOrders: " + 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
settle string Settle currency
requestBody List<string>

Return type

List<FutureCancelOrderResult>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Order cancellation operation completed -

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

ListPriceTriggeredOrders

List<FuturesPriceTriggeredOrder> ListPriceTriggeredOrders (string settle, string status, string contract = null, int? limit = null, int? offset = null)

List all auto 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 ListPriceTriggeredOrdersExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var status = "status_example";  // string | Only list the orders with this status
            var contract = "BTC_USDT";  // string | Futures contract, return related data only if specified (optional) 
            var limit = 100;  // int? | Maximum number of records to be returned in a single list (optional)  (default to 100)
            var offset = 0;  // int? | List offset, starting from 0 (optional)  (default to 0)

            try
            {
                // List all auto orders
                List<FuturesPriceTriggeredOrder> result = apiInstance.ListPriceTriggeredOrders(settle, status, contract, limit, offset);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.ListPriceTriggeredOrders: " + 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
settle string Settle currency
status string Only list the orders with this status
contract string Futures contract, return related data only if specified [optional]
limit int? Maximum number of records to be returned in a single list [optional] [default to 100]
offset int? List offset, starting from 0 [optional] [default to 0]

Return type

List<FuturesPriceTriggeredOrder>

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]

CreatePriceTriggeredOrder

TriggerOrderResponse CreatePriceTriggeredOrder (string settle, FuturesPriceTriggeredOrder futuresPriceTriggeredOrder)

Create a price-triggered 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 CreatePriceTriggeredOrderExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var futuresPriceTriggeredOrder = new FuturesPriceTriggeredOrder(); // FuturesPriceTriggeredOrder | 

            try
            {
                // Create a price-triggered order
                TriggerOrderResponse result = apiInstance.CreatePriceTriggeredOrder(settle, futuresPriceTriggeredOrder);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.CreatePriceTriggeredOrder: " + 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
settle string Settle currency
futuresPriceTriggeredOrder FuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 Order created -

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

CancelPriceTriggeredOrderList

List<FuturesPriceTriggeredOrder> CancelPriceTriggeredOrderList (string settle, string contract)

Cancel all open 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 CancelPriceTriggeredOrderListExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var contract = "BTC_USDT";  // string | Futures contract

            try
            {
                // Cancel all open orders
                List<FuturesPriceTriggeredOrder> result = apiInstance.CancelPriceTriggeredOrderList(settle, contract);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.CancelPriceTriggeredOrderList: " + 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
settle string Settle currency
contract string Futures contract

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Batch cancellation request accepted. Query order status by listing orders -

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

GetPriceTriggeredOrder

FuturesPriceTriggeredOrder GetPriceTriggeredOrder (string settle, string orderId)

Get a price-triggered 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 GetPriceTriggeredOrderExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var orderId = "orderId_example";  // string | Retrieve the data of the order with the specified ID

            try
            {
                // Get a price-triggered order
                FuturesPriceTriggeredOrder result = apiInstance.GetPriceTriggeredOrder(settle, orderId);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.GetPriceTriggeredOrder: " + 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
settle string Settle currency
orderId string Retrieve the data of the order with the specified ID

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Auto order detail -

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

CancelPriceTriggeredOrder

FuturesPriceTriggeredOrder CancelPriceTriggeredOrder (string settle, string orderId)

cancel a price-triggered 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 CancelPriceTriggeredOrderExample
    {
        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 FuturesApi(config);
            var settle = "usdt";  // string | Settle currency
            var orderId = "orderId_example";  // string | Retrieve the data of the order with the specified ID

            try
            {
                // cancel a price-triggered order
                FuturesPriceTriggeredOrder result = apiInstance.CancelPriceTriggeredOrder(settle, orderId);
                Debug.WriteLine(result);
            }
            catch (GateApiException e)
            {
                Debug.Print("Exception when calling FuturesApi.CancelPriceTriggeredOrder: " + 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
settle string Settle currency
orderId string Retrieve the data of the order with the specified ID

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Auto order detail -

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