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 |
ListFuturesRiskLimitTiers | 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 |
AmendBatchFutureOrders | POST /futures/{settle}/batch_amend_orders | Batch modify orders with specified IDs |
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 |
List<Contract> ListFuturesContracts (string settle, int? limit = null, int? offset = null)
List all futures contracts
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);
}
}
}
}
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] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Contract GetFuturesContract (string settle, string contract)
Get a single contract
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
contract | string | Futures contract |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Contract information | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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
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);
}
}
}
}
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] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Order book retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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
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);
}
}
}
}
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] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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
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);
}
}
}
}
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"] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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
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);
}
}
}
}
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"] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<FuturesTicker> ListFuturesTickers (string settle, string contract = null)
List futures tickers
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
contract | string | Futures contract, return related data only if specified | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<FundingRateRecord> ListFuturesFundingRateHistory (string settle, string contract, int? limit = null, long? from = null, long? to = null)
Funding rate history
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)
var from = 1547706332; // long? | Start timestamp (optional)
var to = 1547706332; // long? | End timestamp (optional)
try
{
// Funding rate history
List<FundingRateRecord> result = apiInstance.ListFuturesFundingRateHistory(settle, contract, limit, from, to);
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);
}
}
}
}
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] |
from | long? | Start timestamp | [optional] |
to | long? | End timestamp | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | History retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<InsuranceRecord> ListFuturesInsuranceLedger (string settle, int? limit = null)
Futures insurance balance history
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);
}
}
}
}
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] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<ContractStat> ListContractStats (string settle, string contract, long? from = null, string interval = null, int? limit = null)
Futures stats
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);
}
}
}
}
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] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesIndexConstituents GetIndexConstituents (string settle, string index)
Get index constituents
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
index | string | Index name |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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.
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);
}
}
}
}
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] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<FuturesLimitRiskTiers> ListFuturesRiskLimitTiers (string settle, string contract = null, int? limit = null, int? offset = null)
List risk limit tiers
When the 'contract' parameter is not passed, the default is to query the risk limits for the top 100 markets.'Limit' and 'offset' correspond to pagination queries at the market level, not to the length of the returned array. This only takes effect when the 'contract' parameter is empty.
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 ListFuturesRiskLimitTiersExample
{
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 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 risk limit tiers
List<FuturesLimitRiskTiers> result = apiInstance.ListFuturesRiskLimitTiers(settle, contract, limit, offset);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling FuturesApi.ListFuturesRiskLimitTiers: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
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] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesAccount ListFuturesAccounts (string settle)
Query futures account
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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.
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);
}
}
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<Position> ListPositions (string settle, bool? holding = null, int? limit = null, int? offset = null)
List all positions of a user
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);
}
}
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position GetPosition (string settle, string contract)
Get single position
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
contract | string | Futures contract |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Position information | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position UpdatePositionMargin (string settle, string contract, string change)
Update position margin
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);
}
}
}
}
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. |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Position information | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position UpdatePositionLeverage (string settle, string contract, string leverage, string crossLeverageLimit = null)
Update position leverage
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);
}
}
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Position information | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Position UpdatePositionRiskLimit (string settle, string contract, string riskLimit)
Update position risk limit
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 = "1000000"; // string | New Risk Limit Value
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
contract | string | Futures contract | |
riskLimit | string | New Risk Limit Value |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Position information | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
dualMode | bool | Whether to enable dual mode |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Updated | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<Position> GetDualModePosition (string settle, string contract)
Retrieve position detail in dual mode
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
contract | string | Futures contract |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<Position> UpdateDualModePositionMargin (string settle, string contract, string change, string dualSide)
Update position margin in dual mode
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);
}
}
}
}
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 |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<Position> UpdateDualModePositionLeverage (string settle, string contract, string leverage, string crossLeverageLimit = null)
Update position leverage in dual mode
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);
}
}
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<Position> UpdateDualModePositionRiskLimit (string settle, string contract, string riskLimit)
Update position risk limit in dual mode
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 = "1000000"; // string | New Risk Limit Value
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
contract | string | Futures contract | |
riskLimit | string | New Risk Limit Value |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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
.
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);
}
}
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
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]
FuturesOrder CreateFuturesOrder (string settle, FuturesOrder futuresOrder, long? xGateExptime = null)
Create a futures order
- Creating futures orders requires
size
, which is number of contracts instead of currency amount. You can usequanto_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 - Setreduce_only
totrue
can keep the position from changing side when reducing position size - In single position mode, to close a position, you need to setsize
to 0 andclose
totrue
- In dual position mode, to close one side position, you need to setauto_size
side,reduce_only
to true andsize
to 0 - Setstp_act
to decide the strategy of self-trade prevention. For detailed usage, refer to thestp_act
parameter in request body
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 |
var xGateExptime = 1689560679123; // long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected (optional)
try
{
// Create a futures order
FuturesOrder result = apiInstance.CreateFuturesOrder(settle, futuresOrder, xGateExptime);
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
futuresOrder | FuturesOrder | ||
xGateExptime | long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected | [optional] |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
201 | Order details | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<FuturesOrder> CancelFuturesOrders (string settle, string contract, long? xGateExptime = null, string side = null)
Cancel all open
orders matched
Zero-filled order cannot be retrieved 10 minutes after order cancellation
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 xGateExptime = 1689560679123; // long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected (optional)
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, xGateExptime, 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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
contract | string | Futures contract | |
xGateExptime | long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected | [optional] |
side | string | All bids or asks. Both included if not specified | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | All orders matched cancelled | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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
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);
}
}
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
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]
List<BatchFuturesOrder> CreateBatchFuturesOrder (string settle, List futuresOrder, long? xGateExptime = null)
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, thelabel
field is included to indicate the cause of the error - In the rate limiting, each order is counted individually
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> |
var xGateExptime = 1689560679123; // long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected (optional)
try
{
// Create a batch of futures orders
List<BatchFuturesOrder> result = apiInstance.CreateBatchFuturesOrder(settle, futuresOrder, xGateExptime);
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
futuresOrder | List<FuturesOrder> | ||
xGateExptime | long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected | [optional] |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Request is completed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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.
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);
}
}
}
}
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. |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Order details | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesOrder AmendFuturesOrder (string settle, string orderId, FuturesOrderAmendment futuresOrderAmendment, long? xGateExptime = null)
Amend an order
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 |
var xGateExptime = 1689560679123; // long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected (optional)
try
{
// Amend an order
FuturesOrder result = apiInstance.AmendFuturesOrder(settle, orderId, futuresOrderAmendment, xGateExptime);
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);
}
}
}
}
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 | ||
xGateExptime | long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected | [optional] |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Order details | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesOrder CancelFuturesOrder (string settle, string orderId, long? xGateExptime = null)
Cancel a single order
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.
var xGateExptime = 1689560679123; // long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected (optional)
try
{
// Cancel a single order
FuturesOrder result = apiInstance.CancelFuturesOrder(settle, orderId, xGateExptime);
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);
}
}
}
}
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. | |
xGateExptime | long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Order details | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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
.
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);
}
}
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
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]
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
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);
}
}
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
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]
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
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);
}
}
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<FuturesLiquidate> ListLiquidates (string settle, string contract = null, int? limit = null, int? at = null)
List liquidation history
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);
}
}
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<FuturesAutoDeleverage> ListAutoDeleverages (string settle, string contract = null, int? limit = null, int? at = null)
List Auto-Deleveraging History
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);
}
}
}
}
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] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
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.
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
countdownCancelAllFuturesTask | CountdownCancelAllFuturesTask |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Set countdown successfully | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Dictionary<string, FuturesFee> GetFuturesFee (string settle, string contract = null)
Query user trading fee rates
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
contract | string | Futures contract, return related data only if specified | [optional] |
Dictionary<string, FuturesFee>
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Successfully retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<FutureCancelOrderResult> CancelBatchFutureOrders (string settle, List requestBody, long? xGateExptime = null)
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.
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> |
var xGateExptime = 1689560679123; // long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected (optional)
try
{
// Cancel a batch of orders with an ID list
List<FutureCancelOrderResult> result = apiInstance.CancelBatchFutureOrders(settle, requestBody, xGateExptime);
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
requestBody | List<string> | ||
xGateExptime | long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected | [optional] |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Order cancellation operation completed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<BatchFuturesOrder> AmendBatchFutureOrders (string settle, List batchAmendOrderReq, long? xGateExptime = null)
Batch modify orders with specified IDs
You can specify multiple different order IDs. You can only modify up to 10 orders in one request.
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 AmendBatchFutureOrdersExample
{
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 batchAmendOrderReq = new List<BatchAmendOrderReq>(); // List<BatchAmendOrderReq> |
var xGateExptime = 1689560679123; // long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected (optional)
try
{
// Batch modify orders with specified IDs
List<BatchFuturesOrder> result = apiInstance.AmendBatchFutureOrders(settle, batchAmendOrderReq, xGateExptime);
Debug.WriteLine(result);
}
catch (GateApiException e)
{
Debug.Print("Exception when calling FuturesApi.AmendBatchFutureOrders: " + e.Message);
Debug.Print("Exception label: {0}, message: {1}", e.ErrorLabel, e.ErrorMessage);
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
batchAmendOrderReq | List<BatchAmendOrderReq> | ||
xGateExptime | long? | Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected | [optional] |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Request is completed | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<FuturesPriceTriggeredOrder> ListPriceTriggeredOrders (string settle, string status, string contract = null, int? limit = null, int? offset = null)
List all auto orders
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);
}
}
}
}
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] |
List<FuturesPriceTriggeredOrder>
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | List retrieved | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TriggerOrderResponse CreatePriceTriggeredOrder (string settle, FuturesPriceTriggeredOrder futuresPriceTriggeredOrder)
Create a price-triggered order
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
futuresPriceTriggeredOrder | FuturesPriceTriggeredOrder |
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
201 | Order created | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
List<FuturesPriceTriggeredOrder> CancelPriceTriggeredOrderList (string settle, string contract = null)
Cancel all open orders
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, return related data only if specified (optional)
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
contract | string | Futures contract, return related data only if specified | [optional] |
List<FuturesPriceTriggeredOrder>
- Content-Type: Not defined
- Accept: application/json
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]
FuturesPriceTriggeredOrder GetPriceTriggeredOrder (string settle, string orderId)
Get a price-triggered order
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
orderId | string | Retrieve the data of the order with the specified ID |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Auto order detail | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
FuturesPriceTriggeredOrder CancelPriceTriggeredOrder (string settle, string orderId)
cancel a price-triggered order
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);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
settle | string | Settle currency | |
orderId | string | Retrieve the data of the order with the specified ID |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Auto order detail | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]