Latest commit

History

History
2174 lines (1707 loc) · 82.5 KB

File metadata and controls

2174 lines (1707 loc) · 82.5 KB

DeliveryApi

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

MethodHTTP requestDescription
listDeliveryContractsGET /delivery/{settle}/contractsQuery all futures contracts
getDeliveryContractGET /delivery/{settle}/contracts/{contract}Query single contract information
listDeliveryOrderBookGET /delivery/{settle}/order_bookQuery futures market depth information
listDeliveryTradesGET /delivery/{settle}/tradesFutures market transaction records
listDeliveryCandlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
listDeliveryTickersGET /delivery/{settle}/tickersGet all futures trading statistics
listDeliveryInsuranceLedgerGET /delivery/{settle}/insuranceFutures market insurance fund history
listDeliveryAccountsGET /delivery/{settle}/accountsGet futures account
listDeliveryAccountBookGET /delivery/{settle}/account_bookQuery futures account change history
listDeliveryPositionsGET /delivery/{settle}/positionsGet user position list
getDeliveryPositionGET /delivery/{settle}/positions/{contract}Get single position information
updateDeliveryPositionMarginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
updateDeliveryPositionLeveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
updateDeliveryPositionRiskLimitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
listDeliveryOrdersGET /delivery/{settle}/ordersQuery futures order list
createDeliveryOrderPOST /delivery/{settle}/ordersPlace futures order
cancelDeliveryOrdersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
getDeliveryOrderGET /delivery/{settle}/orders/{order_id}Query single order details
cancelDeliveryOrderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
getMyDeliveryTradesGET /delivery/{settle}/my_tradesQuery personal trading records
listDeliveryPositionCloseGET /delivery/{settle}/position_closeQuery position close history
listDeliveryLiquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
listDeliverySettlementsGET /delivery/{settle}/settlementsQuery settlement records
listDeliveryRiskLimitTiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
listPriceTriggeredDeliveryOrdersGET /delivery/{settle}/price_ordersQuery auto order list
createPriceTriggeredDeliveryOrderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancelPriceTriggeredDeliveryOrderListDELETE /delivery/{settle}/price_ordersCancel all auto orders
getPriceTriggeredDeliveryOrderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancelPriceTriggeredDeliveryOrderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

listDeliveryContracts

List<DeliveryContract> listDeliveryContracts(settle)

Query all futures contracts

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryContract> result = apiInstance.listDeliveryContracts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryContracts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryContract>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryContract

DeliveryContract getDeliveryContract(settle, contract)

Query single contract information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryContractresult = apiInstance.getDeliveryContract(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryContract");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Contract information-

listDeliveryOrderBook

DeliveryOrderBook listDeliveryOrderBook(settle, contract).interval(interval).limit(limit).withId(withId).execute();

Query futures market depth information

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringinterval = "0"; // String | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0Integerlimit = 10; // Integer | Number of depth levelsBooleanwithId = false; // Boolean | Whether to return depth update ID. This ID increments by 1 each time the depth changestry {
DeliveryOrderBookresult = apiInstance.listDeliveryOrderBook(settle, contract)
.interval(interval)
.limit(limit)
.withId(withId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrderBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
intervalStringPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to 0] [enum: 0, 0.1, 0.01]
limitIntegerNumber of depth levels[optional] [default to 10]
withIdBooleanWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to false]

Return type

DeliveryOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

listDeliveryTrades

List<DeliveryTrade> listDeliveryTrades(settle, contract).limit(limit).lastId(lastId).from(from).to(to).execute();

Futures market transaction records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listStringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rangLongfrom = 1546905600L; // 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. Longto = 1546935600L; // Long | Specify end time in Unix seconds, default to current time.try {
List<DeliveryTrade> result = apiInstance.listDeliveryTrades(settle, contract)
.limit(limit)
.lastId(lastId)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rang[optional]
fromLongSpecify 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]
toLongSpecify end time in Unix seconds, default to current time.[optional]

Return type

List<DeliveryTrade>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryCandlesticks

List<DeliveryCandlestick> listDeliveryCandlesticks(settle, contract).from(from).to(to).limit(limit).interval(interval).execute();

Futures market K-line chart

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongfrom = 1546905600L; // Long | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specifiedLongto = 1546935600L; // Long | Specify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precisionIntegerlimit = 100; // Integer | Maximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.Stringinterval = "5m"; // String | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial timetry {
List<DeliveryCandlestick> result = apiInstance.listDeliveryCandlesticks(settle, contract)
.from(from)
.to(to)
.limit(limit)
.interval(interval)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryCandlesticks");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
fromLongStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
toLongSpecify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precision[optional]
limitIntegerMaximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.[optional] [default to 100]
intervalStringTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to 5m] [enum: 10s, 30s, 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 7d, 1w, 30d]

Return type

List<DeliveryCandlestick>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryTickers

List<DeliveryTicker> listDeliveryTickers(settle).contract(contract).execute();

Get all futures trading statistics

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
List<DeliveryTicker> result = apiInstance.listDeliveryTickers(settle)
.contract(contract)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTickers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]

Return type

List<DeliveryTicker>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryInsuranceLedger

List<InsuranceRecord> listDeliveryInsuranceLedger(settle).limit(limit).execute();

Futures market insurance fund history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<InsuranceRecord> result = apiInstance.listDeliveryInsuranceLedger(settle)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryInsuranceLedger");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<InsuranceRecord>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryAccounts

DeliveryAccount listDeliveryAccounts(settle)

Get futures account

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
DeliveryAccountresult = apiInstance.listDeliveryAccounts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccounts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

DeliveryAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryAccountBook

List<DeliveryAccountBook> listDeliveryAccountBook(settle).limit(limit).from(from).to(to).type(type).execute();

Query futures account change history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listLongfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestampStringtype = "dnw"; // String | Change types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebatestry {
List<DeliveryAccountBook> result = apiInstance.listDeliveryAccountBook(settle)
.limit(limit)
.from(from)
.to(to)
.type(type)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
fromLongStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
toLongTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typeStringChange types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebates[optional] [enum: dnw, pnl, fee, refr, fund, point_dnw, point_fee, point_refr]

Return type

List<DeliveryAccountBook>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryPositions

List<DeliveryPosition> listDeliveryPositions(settle)

Get user position list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryPosition> result = apiInstance.listDeliveryPositions(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositions");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryPosition>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryPosition

DeliveryPosition getDeliveryPosition(settle, contract)

Get single position information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryPositionresult = apiInstance.getDeliveryPosition(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryPosition");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionMargin

DeliveryPosition updateDeliveryPositionMargin(settle, contract, change)

Update position margin

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringchange = "0.01"; // String | Margin change amount, positive number increases, negative number decreasestry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionMargin(settle, contract, change);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionMargin");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
changeStringMargin change amount, positive number increases, negative number decreases

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionLeverage

DeliveryPosition updateDeliveryPositionLeverage(settle, contract, leverage)

Update position leverage

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringleverage = "10"; // String | New position leveragetry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionLeverage(settle, contract, leverage);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionLeverage");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
leverageStringNew position leverage

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionRiskLimit

DeliveryPosition updateDeliveryPositionRiskLimit(settle, contract, riskLimit)

Update position risk limit

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringriskLimit = "10"; // String | New position risk limittry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionRiskLimit(settle, contract, riskLimit);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionRiskLimit");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
riskLimitStringNew position risk limit

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

listDeliveryOrders

List<DeliveryOrder> listDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query futures order list

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "open"; // String | Query order list based on statusStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryOrder> result = apiInstance.listDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

createDeliveryOrder

DeliveryOrder createDeliveryOrder(settle, deliveryOrder)

Place futures order

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyDeliveryOrderdeliveryOrder = newDeliveryOrder(); // DeliveryOrder | try {
DeliveryOrderresult = apiInstance.createDeliveryOrder(settle, deliveryOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
deliveryOrderDeliveryOrder

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

cancelDeliveryOrders

List<DeliveryOrder> cancelDeliveryOrders(settle, contract, side)

Cancel all orders with 'open' status

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringside = "ask"; // String | Specify all bids or all asks, both included if not specifiedtry {
List<DeliveryOrder> result = apiInstance.cancelDeliveryOrders(settle, contract, side);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
sideStringSpecify all bids or all asks, both included if not specified[optional] [enum: ask, bid]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

getDeliveryOrder

DeliveryOrder getDeliveryOrder(settle, orderId)

Query single order details

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.getDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

cancelDeliveryOrder

DeliveryOrder cancelDeliveryOrder(settle, orderId)

Cancel single order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.cancelDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

getMyDeliveryTrades

List<DeliveryMyTrade> getMyDeliveryTrades(settle).contract(contract).order(order).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query personal trading records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongorder = 12345L; // Long | Futures order ID, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryMyTrade> result = apiInstance.getMyDeliveryTrades(settle)
.contract(contract)
.order(order)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getMyDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
orderLongFutures order ID, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryMyTrade>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

listDeliveryPositionClose

List<DeliveryPositionClose> listDeliveryPositionClose(settle).contract(contract).limit(limit).execute();

Query position close history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<DeliveryPositionClose> result = apiInstance.listDeliveryPositionClose(settle)
.contract(contract)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositionClose");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<DeliveryPositionClose>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryLiquidates

List<DeliveryLiquidate> listDeliveryLiquidates(settle).contract(contract).limit(limit).at(at).execute();

Query liquidation history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify liquidation timestamptry {
List<DeliveryLiquidate> result = apiInstance.listDeliveryLiquidates(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryLiquidates");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify liquidation timestamp[optional] [default to 0]

Return type

List<DeliveryLiquidate>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliverySettlements

List<DeliverySettlement> listDeliverySettlements(settle).contract(contract).limit(limit).at(at).execute();

Query settlement records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify settlement timestamptry {
List<DeliverySettlement> result = apiInstance.listDeliverySettlements(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliverySettlements");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify settlement timestamp[optional] [default to 0]

Return type

List<DeliverySettlement>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryRiskLimitTiers

List<DeliveryLimitRiskTiers> listDeliveryRiskLimitTiers(settle).contract(contract).limit(limit).offset(offset).execute();

Query 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.

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<DeliveryLimitRiskTiers> result = apiInstance.listDeliveryRiskLimitTiers(settle)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryRiskLimitTiers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<DeliveryLimitRiskTiers>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listPriceTriggeredDeliveryOrders

List<FuturesPriceTriggeredOrder> listPriceTriggeredDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).execute();

Query auto order list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "status_example"; // String | Query order list based on statusStringcontract = "BTC_USDT"; // String | Futures contract, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<FuturesPriceTriggeredOrder> result = apiInstance.listPriceTriggeredDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listPriceTriggeredDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

createPriceTriggeredDeliveryOrder

TriggerOrderResponse createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder)

Create price-triggered order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyFuturesPriceTriggeredOrderfuturesPriceTriggeredOrder = newFuturesPriceTriggeredOrder(); // FuturesPriceTriggeredOrder | try {
TriggerOrderResponseresult = apiInstance.createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
futuresPriceTriggeredOrderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

cancelPriceTriggeredDeliveryOrderList

List<FuturesPriceTriggeredOrder> cancelPriceTriggeredDeliveryOrderList(settle, contract)

Cancel all auto orders

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT"; // String | Futures contracttry {
List<FuturesPriceTriggeredOrder> result = apiInstance.cancelPriceTriggeredDeliveryOrderList(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrderList");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancel request is received and processed. Success is determined based on the order list-

getPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder getPriceTriggeredDeliveryOrder(settle, orderId)

Query single auto order details

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.getPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-

cancelPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder cancelPriceTriggeredDeliveryOrder(settle, orderId)

Cancel single auto order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.cancelPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Latest commit

History

History
2174 lines (1707 loc) · 82.5 KB

File metadata and controls

2174 lines (1707 loc) · 82.5 KB

DeliveryApi

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

MethodHTTP requestDescription
listDeliveryContractsGET /delivery/{settle}/contractsQuery all futures contracts
getDeliveryContractGET /delivery/{settle}/contracts/{contract}Query single contract information
listDeliveryOrderBookGET /delivery/{settle}/order_bookQuery futures market depth information
listDeliveryTradesGET /delivery/{settle}/tradesFutures market transaction records
listDeliveryCandlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
listDeliveryTickersGET /delivery/{settle}/tickersGet all futures trading statistics
listDeliveryInsuranceLedgerGET /delivery/{settle}/insuranceFutures market insurance fund history
listDeliveryAccountsGET /delivery/{settle}/accountsGet futures account
listDeliveryAccountBookGET /delivery/{settle}/account_bookQuery futures account change history
listDeliveryPositionsGET /delivery/{settle}/positionsGet user position list
getDeliveryPositionGET /delivery/{settle}/positions/{contract}Get single position information
updateDeliveryPositionMarginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
updateDeliveryPositionLeveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
updateDeliveryPositionRiskLimitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
listDeliveryOrdersGET /delivery/{settle}/ordersQuery futures order list
createDeliveryOrderPOST /delivery/{settle}/ordersPlace futures order
cancelDeliveryOrdersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
getDeliveryOrderGET /delivery/{settle}/orders/{order_id}Query single order details
cancelDeliveryOrderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
getMyDeliveryTradesGET /delivery/{settle}/my_tradesQuery personal trading records
listDeliveryPositionCloseGET /delivery/{settle}/position_closeQuery position close history
listDeliveryLiquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
listDeliverySettlementsGET /delivery/{settle}/settlementsQuery settlement records
listDeliveryRiskLimitTiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
listPriceTriggeredDeliveryOrdersGET /delivery/{settle}/price_ordersQuery auto order list
createPriceTriggeredDeliveryOrderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancelPriceTriggeredDeliveryOrderListDELETE /delivery/{settle}/price_ordersCancel all auto orders
getPriceTriggeredDeliveryOrderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancelPriceTriggeredDeliveryOrderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

listDeliveryContracts

List<DeliveryContract> listDeliveryContracts(settle)

Query all futures contracts

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryContract> result = apiInstance.listDeliveryContracts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryContracts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryContract>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryContract

DeliveryContract getDeliveryContract(settle, contract)

Query single contract information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryContractresult = apiInstance.getDeliveryContract(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryContract");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Contract information-

listDeliveryOrderBook

DeliveryOrderBook listDeliveryOrderBook(settle, contract).interval(interval).limit(limit).withId(withId).execute();

Query futures market depth information

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringinterval = "0"; // String | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0Integerlimit = 10; // Integer | Number of depth levelsBooleanwithId = false; // Boolean | Whether to return depth update ID. This ID increments by 1 each time the depth changestry {
DeliveryOrderBookresult = apiInstance.listDeliveryOrderBook(settle, contract)
.interval(interval)
.limit(limit)
.withId(withId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrderBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
intervalStringPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to 0] [enum: 0, 0.1, 0.01]
limitIntegerNumber of depth levels[optional] [default to 10]
withIdBooleanWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to false]

Return type

DeliveryOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

listDeliveryTrades

List<DeliveryTrade> listDeliveryTrades(settle, contract).limit(limit).lastId(lastId).from(from).to(to).execute();

Futures market transaction records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listStringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rangLongfrom = 1546905600L; // 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. Longto = 1546935600L; // Long | Specify end time in Unix seconds, default to current time.try {
List<DeliveryTrade> result = apiInstance.listDeliveryTrades(settle, contract)
.limit(limit)
.lastId(lastId)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rang[optional]
fromLongSpecify 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]
toLongSpecify end time in Unix seconds, default to current time.[optional]

Return type

List<DeliveryTrade>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryCandlesticks

List<DeliveryCandlestick> listDeliveryCandlesticks(settle, contract).from(from).to(to).limit(limit).interval(interval).execute();

Futures market K-line chart

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongfrom = 1546905600L; // Long | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specifiedLongto = 1546935600L; // Long | Specify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precisionIntegerlimit = 100; // Integer | Maximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.Stringinterval = "5m"; // String | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial timetry {
List<DeliveryCandlestick> result = apiInstance.listDeliveryCandlesticks(settle, contract)
.from(from)
.to(to)
.limit(limit)
.interval(interval)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryCandlesticks");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
fromLongStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
toLongSpecify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precision[optional]
limitIntegerMaximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.[optional] [default to 100]
intervalStringTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to 5m] [enum: 10s, 30s, 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 7d, 1w, 30d]

Return type

List<DeliveryCandlestick>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryTickers

List<DeliveryTicker> listDeliveryTickers(settle).contract(contract).execute();

Get all futures trading statistics

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
List<DeliveryTicker> result = apiInstance.listDeliveryTickers(settle)
.contract(contract)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTickers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]

Return type

List<DeliveryTicker>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryInsuranceLedger

List<InsuranceRecord> listDeliveryInsuranceLedger(settle).limit(limit).execute();

Futures market insurance fund history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<InsuranceRecord> result = apiInstance.listDeliveryInsuranceLedger(settle)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryInsuranceLedger");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<InsuranceRecord>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryAccounts

DeliveryAccount listDeliveryAccounts(settle)

Get futures account

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
DeliveryAccountresult = apiInstance.listDeliveryAccounts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccounts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

DeliveryAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryAccountBook

List<DeliveryAccountBook> listDeliveryAccountBook(settle).limit(limit).from(from).to(to).type(type).execute();

Query futures account change history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listLongfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestampStringtype = "dnw"; // String | Change types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebatestry {
List<DeliveryAccountBook> result = apiInstance.listDeliveryAccountBook(settle)
.limit(limit)
.from(from)
.to(to)
.type(type)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
fromLongStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
toLongTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typeStringChange types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebates[optional] [enum: dnw, pnl, fee, refr, fund, point_dnw, point_fee, point_refr]

Return type

List<DeliveryAccountBook>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryPositions

List<DeliveryPosition> listDeliveryPositions(settle)

Get user position list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryPosition> result = apiInstance.listDeliveryPositions(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositions");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryPosition>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryPosition

DeliveryPosition getDeliveryPosition(settle, contract)

Get single position information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryPositionresult = apiInstance.getDeliveryPosition(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryPosition");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionMargin

DeliveryPosition updateDeliveryPositionMargin(settle, contract, change)

Update position margin

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringchange = "0.01"; // String | Margin change amount, positive number increases, negative number decreasestry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionMargin(settle, contract, change);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionMargin");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
changeStringMargin change amount, positive number increases, negative number decreases

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionLeverage

DeliveryPosition updateDeliveryPositionLeverage(settle, contract, leverage)

Update position leverage

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringleverage = "10"; // String | New position leveragetry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionLeverage(settle, contract, leverage);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionLeverage");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
leverageStringNew position leverage

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionRiskLimit

DeliveryPosition updateDeliveryPositionRiskLimit(settle, contract, riskLimit)

Update position risk limit

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringriskLimit = "10"; // String | New position risk limittry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionRiskLimit(settle, contract, riskLimit);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionRiskLimit");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
riskLimitStringNew position risk limit

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

listDeliveryOrders

List<DeliveryOrder> listDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query futures order list

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "open"; // String | Query order list based on statusStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryOrder> result = apiInstance.listDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

createDeliveryOrder

DeliveryOrder createDeliveryOrder(settle, deliveryOrder)

Place futures order

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyDeliveryOrderdeliveryOrder = newDeliveryOrder(); // DeliveryOrder | try {
DeliveryOrderresult = apiInstance.createDeliveryOrder(settle, deliveryOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
deliveryOrderDeliveryOrder

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

cancelDeliveryOrders

List<DeliveryOrder> cancelDeliveryOrders(settle, contract, side)

Cancel all orders with 'open' status

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringside = "ask"; // String | Specify all bids or all asks, both included if not specifiedtry {
List<DeliveryOrder> result = apiInstance.cancelDeliveryOrders(settle, contract, side);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
sideStringSpecify all bids or all asks, both included if not specified[optional] [enum: ask, bid]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

getDeliveryOrder

DeliveryOrder getDeliveryOrder(settle, orderId)

Query single order details

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.getDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

cancelDeliveryOrder

DeliveryOrder cancelDeliveryOrder(settle, orderId)

Cancel single order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.cancelDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

getMyDeliveryTrades

List<DeliveryMyTrade> getMyDeliveryTrades(settle).contract(contract).order(order).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query personal trading records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongorder = 12345L; // Long | Futures order ID, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryMyTrade> result = apiInstance.getMyDeliveryTrades(settle)
.contract(contract)
.order(order)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getMyDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
orderLongFutures order ID, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryMyTrade>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

listDeliveryPositionClose

List<DeliveryPositionClose> listDeliveryPositionClose(settle).contract(contract).limit(limit).execute();

Query position close history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<DeliveryPositionClose> result = apiInstance.listDeliveryPositionClose(settle)
.contract(contract)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositionClose");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<DeliveryPositionClose>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryLiquidates

List<DeliveryLiquidate> listDeliveryLiquidates(settle).contract(contract).limit(limit).at(at).execute();

Query liquidation history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify liquidation timestamptry {
List<DeliveryLiquidate> result = apiInstance.listDeliveryLiquidates(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryLiquidates");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify liquidation timestamp[optional] [default to 0]

Return type

List<DeliveryLiquidate>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliverySettlements

List<DeliverySettlement> listDeliverySettlements(settle).contract(contract).limit(limit).at(at).execute();

Query settlement records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify settlement timestamptry {
List<DeliverySettlement> result = apiInstance.listDeliverySettlements(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliverySettlements");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify settlement timestamp[optional] [default to 0]

Return type

List<DeliverySettlement>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryRiskLimitTiers

List<DeliveryLimitRiskTiers> listDeliveryRiskLimitTiers(settle).contract(contract).limit(limit).offset(offset).execute();

Query 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.

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<DeliveryLimitRiskTiers> result = apiInstance.listDeliveryRiskLimitTiers(settle)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryRiskLimitTiers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<DeliveryLimitRiskTiers>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listPriceTriggeredDeliveryOrders

List<FuturesPriceTriggeredOrder> listPriceTriggeredDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).execute();

Query auto order list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "status_example"; // String | Query order list based on statusStringcontract = "BTC_USDT"; // String | Futures contract, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<FuturesPriceTriggeredOrder> result = apiInstance.listPriceTriggeredDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listPriceTriggeredDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

createPriceTriggeredDeliveryOrder

TriggerOrderResponse createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder)

Create price-triggered order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyFuturesPriceTriggeredOrderfuturesPriceTriggeredOrder = newFuturesPriceTriggeredOrder(); // FuturesPriceTriggeredOrder | try {
TriggerOrderResponseresult = apiInstance.createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
futuresPriceTriggeredOrderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

cancelPriceTriggeredDeliveryOrderList

List<FuturesPriceTriggeredOrder> cancelPriceTriggeredDeliveryOrderList(settle, contract)

Cancel all auto orders

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT"; // String | Futures contracttry {
List<FuturesPriceTriggeredOrder> result = apiInstance.cancelPriceTriggeredDeliveryOrderList(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrderList");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancel request is received and processed. Success is determined based on the order list-

getPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder getPriceTriggeredDeliveryOrder(settle, orderId)

Query single auto order details

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.getPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-

cancelPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder cancelPriceTriggeredDeliveryOrder(settle, orderId)

Cancel single auto order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.cancelPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

History
2174 lines (1707 loc) · 82.5 KB

File metadata and controls

2174 lines (1707 loc) · 82.5 KB

DeliveryApi

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

MethodHTTP requestDescription
listDeliveryContractsGET /delivery/{settle}/contractsQuery all futures contracts
getDeliveryContractGET /delivery/{settle}/contracts/{contract}Query single contract information
listDeliveryOrderBookGET /delivery/{settle}/order_bookQuery futures market depth information
listDeliveryTradesGET /delivery/{settle}/tradesFutures market transaction records
listDeliveryCandlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
listDeliveryTickersGET /delivery/{settle}/tickersGet all futures trading statistics
listDeliveryInsuranceLedgerGET /delivery/{settle}/insuranceFutures market insurance fund history
listDeliveryAccountsGET /delivery/{settle}/accountsGet futures account
listDeliveryAccountBookGET /delivery/{settle}/account_bookQuery futures account change history
listDeliveryPositionsGET /delivery/{settle}/positionsGet user position list
getDeliveryPositionGET /delivery/{settle}/positions/{contract}Get single position information
updateDeliveryPositionMarginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
updateDeliveryPositionLeveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
updateDeliveryPositionRiskLimitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
listDeliveryOrdersGET /delivery/{settle}/ordersQuery futures order list
createDeliveryOrderPOST /delivery/{settle}/ordersPlace futures order
cancelDeliveryOrdersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
getDeliveryOrderGET /delivery/{settle}/orders/{order_id}Query single order details
cancelDeliveryOrderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
getMyDeliveryTradesGET /delivery/{settle}/my_tradesQuery personal trading records
listDeliveryPositionCloseGET /delivery/{settle}/position_closeQuery position close history
listDeliveryLiquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
listDeliverySettlementsGET /delivery/{settle}/settlementsQuery settlement records
listDeliveryRiskLimitTiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
listPriceTriggeredDeliveryOrdersGET /delivery/{settle}/price_ordersQuery auto order list
createPriceTriggeredDeliveryOrderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancelPriceTriggeredDeliveryOrderListDELETE /delivery/{settle}/price_ordersCancel all auto orders
getPriceTriggeredDeliveryOrderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancelPriceTriggeredDeliveryOrderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

listDeliveryContracts

List<DeliveryContract> listDeliveryContracts(settle)

Query all futures contracts

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryContract> result = apiInstance.listDeliveryContracts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryContracts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryContract>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryContract

DeliveryContract getDeliveryContract(settle, contract)

Query single contract information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryContractresult = apiInstance.getDeliveryContract(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryContract");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Contract information-

listDeliveryOrderBook

DeliveryOrderBook listDeliveryOrderBook(settle, contract).interval(interval).limit(limit).withId(withId).execute();

Query futures market depth information

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringinterval = "0"; // String | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0Integerlimit = 10; // Integer | Number of depth levelsBooleanwithId = false; // Boolean | Whether to return depth update ID. This ID increments by 1 each time the depth changestry {
DeliveryOrderBookresult = apiInstance.listDeliveryOrderBook(settle, contract)
.interval(interval)
.limit(limit)
.withId(withId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrderBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
intervalStringPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to 0] [enum: 0, 0.1, 0.01]
limitIntegerNumber of depth levels[optional] [default to 10]
withIdBooleanWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to false]

Return type

DeliveryOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

listDeliveryTrades

List<DeliveryTrade> listDeliveryTrades(settle, contract).limit(limit).lastId(lastId).from(from).to(to).execute();

Futures market transaction records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listStringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rangLongfrom = 1546905600L; // 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. Longto = 1546935600L; // Long | Specify end time in Unix seconds, default to current time.try {
List<DeliveryTrade> result = apiInstance.listDeliveryTrades(settle, contract)
.limit(limit)
.lastId(lastId)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rang[optional]
fromLongSpecify 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]
toLongSpecify end time in Unix seconds, default to current time.[optional]

Return type

List<DeliveryTrade>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryCandlesticks

List<DeliveryCandlestick> listDeliveryCandlesticks(settle, contract).from(from).to(to).limit(limit).interval(interval).execute();

Futures market K-line chart

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongfrom = 1546905600L; // Long | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specifiedLongto = 1546935600L; // Long | Specify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precisionIntegerlimit = 100; // Integer | Maximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.Stringinterval = "5m"; // String | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial timetry {
List<DeliveryCandlestick> result = apiInstance.listDeliveryCandlesticks(settle, contract)
.from(from)
.to(to)
.limit(limit)
.interval(interval)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryCandlesticks");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
fromLongStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
toLongSpecify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precision[optional]
limitIntegerMaximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.[optional] [default to 100]
intervalStringTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to 5m] [enum: 10s, 30s, 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 7d, 1w, 30d]

Return type

List<DeliveryCandlestick>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryTickers

List<DeliveryTicker> listDeliveryTickers(settle).contract(contract).execute();

Get all futures trading statistics

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
List<DeliveryTicker> result = apiInstance.listDeliveryTickers(settle)
.contract(contract)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTickers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]

Return type

List<DeliveryTicker>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryInsuranceLedger

List<InsuranceRecord> listDeliveryInsuranceLedger(settle).limit(limit).execute();

Futures market insurance fund history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<InsuranceRecord> result = apiInstance.listDeliveryInsuranceLedger(settle)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryInsuranceLedger");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<InsuranceRecord>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryAccounts

DeliveryAccount listDeliveryAccounts(settle)

Get futures account

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
DeliveryAccountresult = apiInstance.listDeliveryAccounts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccounts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

DeliveryAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryAccountBook

List<DeliveryAccountBook> listDeliveryAccountBook(settle).limit(limit).from(from).to(to).type(type).execute();

Query futures account change history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listLongfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestampStringtype = "dnw"; // String | Change types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebatestry {
List<DeliveryAccountBook> result = apiInstance.listDeliveryAccountBook(settle)
.limit(limit)
.from(from)
.to(to)
.type(type)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
fromLongStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
toLongTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typeStringChange types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebates[optional] [enum: dnw, pnl, fee, refr, fund, point_dnw, point_fee, point_refr]

Return type

List<DeliveryAccountBook>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryPositions

List<DeliveryPosition> listDeliveryPositions(settle)

Get user position list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryPosition> result = apiInstance.listDeliveryPositions(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositions");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryPosition>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryPosition

DeliveryPosition getDeliveryPosition(settle, contract)

Get single position information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryPositionresult = apiInstance.getDeliveryPosition(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryPosition");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionMargin

DeliveryPosition updateDeliveryPositionMargin(settle, contract, change)

Update position margin

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringchange = "0.01"; // String | Margin change amount, positive number increases, negative number decreasestry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionMargin(settle, contract, change);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionMargin");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
changeStringMargin change amount, positive number increases, negative number decreases

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionLeverage

DeliveryPosition updateDeliveryPositionLeverage(settle, contract, leverage)

Update position leverage

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringleverage = "10"; // String | New position leveragetry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionLeverage(settle, contract, leverage);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionLeverage");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
leverageStringNew position leverage

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionRiskLimit

DeliveryPosition updateDeliveryPositionRiskLimit(settle, contract, riskLimit)

Update position risk limit

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringriskLimit = "10"; // String | New position risk limittry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionRiskLimit(settle, contract, riskLimit);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionRiskLimit");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
riskLimitStringNew position risk limit

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

listDeliveryOrders

List<DeliveryOrder> listDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query futures order list

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "open"; // String | Query order list based on statusStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryOrder> result = apiInstance.listDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

createDeliveryOrder

DeliveryOrder createDeliveryOrder(settle, deliveryOrder)

Place futures order

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyDeliveryOrderdeliveryOrder = newDeliveryOrder(); // DeliveryOrder | try {
DeliveryOrderresult = apiInstance.createDeliveryOrder(settle, deliveryOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
deliveryOrderDeliveryOrder

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

cancelDeliveryOrders

List<DeliveryOrder> cancelDeliveryOrders(settle, contract, side)

Cancel all orders with 'open' status

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringside = "ask"; // String | Specify all bids or all asks, both included if not specifiedtry {
List<DeliveryOrder> result = apiInstance.cancelDeliveryOrders(settle, contract, side);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
sideStringSpecify all bids or all asks, both included if not specified[optional] [enum: ask, bid]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

getDeliveryOrder

DeliveryOrder getDeliveryOrder(settle, orderId)

Query single order details

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.getDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

cancelDeliveryOrder

DeliveryOrder cancelDeliveryOrder(settle, orderId)

Cancel single order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.cancelDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

getMyDeliveryTrades

List<DeliveryMyTrade> getMyDeliveryTrades(settle).contract(contract).order(order).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query personal trading records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongorder = 12345L; // Long | Futures order ID, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryMyTrade> result = apiInstance.getMyDeliveryTrades(settle)
.contract(contract)
.order(order)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getMyDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
orderLongFutures order ID, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryMyTrade>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

listDeliveryPositionClose

List<DeliveryPositionClose> listDeliveryPositionClose(settle).contract(contract).limit(limit).execute();

Query position close history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<DeliveryPositionClose> result = apiInstance.listDeliveryPositionClose(settle)
.contract(contract)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositionClose");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<DeliveryPositionClose>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryLiquidates

List<DeliveryLiquidate> listDeliveryLiquidates(settle).contract(contract).limit(limit).at(at).execute();

Query liquidation history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify liquidation timestamptry {
List<DeliveryLiquidate> result = apiInstance.listDeliveryLiquidates(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryLiquidates");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify liquidation timestamp[optional] [default to 0]

Return type

List<DeliveryLiquidate>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliverySettlements

List<DeliverySettlement> listDeliverySettlements(settle).contract(contract).limit(limit).at(at).execute();

Query settlement records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify settlement timestamptry {
List<DeliverySettlement> result = apiInstance.listDeliverySettlements(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliverySettlements");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify settlement timestamp[optional] [default to 0]

Return type

List<DeliverySettlement>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryRiskLimitTiers

List<DeliveryLimitRiskTiers> listDeliveryRiskLimitTiers(settle).contract(contract).limit(limit).offset(offset).execute();

Query 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.

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<DeliveryLimitRiskTiers> result = apiInstance.listDeliveryRiskLimitTiers(settle)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryRiskLimitTiers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<DeliveryLimitRiskTiers>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listPriceTriggeredDeliveryOrders

List<FuturesPriceTriggeredOrder> listPriceTriggeredDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).execute();

Query auto order list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "status_example"; // String | Query order list based on statusStringcontract = "BTC_USDT"; // String | Futures contract, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<FuturesPriceTriggeredOrder> result = apiInstance.listPriceTriggeredDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listPriceTriggeredDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

createPriceTriggeredDeliveryOrder

TriggerOrderResponse createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder)

Create price-triggered order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyFuturesPriceTriggeredOrderfuturesPriceTriggeredOrder = newFuturesPriceTriggeredOrder(); // FuturesPriceTriggeredOrder | try {
TriggerOrderResponseresult = apiInstance.createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
futuresPriceTriggeredOrderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

cancelPriceTriggeredDeliveryOrderList

List<FuturesPriceTriggeredOrder> cancelPriceTriggeredDeliveryOrderList(settle, contract)

Cancel all auto orders

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT"; // String | Futures contracttry {
List<FuturesPriceTriggeredOrder> result = apiInstance.cancelPriceTriggeredDeliveryOrderList(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrderList");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancel request is received and processed. Success is determined based on the order list-

getPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder getPriceTriggeredDeliveryOrder(settle, orderId)

Query single auto order details

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.getPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-

cancelPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder cancelPriceTriggeredDeliveryOrder(settle, orderId)

Cancel single auto order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.cancelPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

History
2174 lines (1707 loc) · 82.5 KB

File metadata and controls

2174 lines (1707 loc) · 82.5 KB

DeliveryApi

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

MethodHTTP requestDescription
listDeliveryContractsGET /delivery/{settle}/contractsQuery all futures contracts
getDeliveryContractGET /delivery/{settle}/contracts/{contract}Query single contract information
listDeliveryOrderBookGET /delivery/{settle}/order_bookQuery futures market depth information
listDeliveryTradesGET /delivery/{settle}/tradesFutures market transaction records
listDeliveryCandlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
listDeliveryTickersGET /delivery/{settle}/tickersGet all futures trading statistics
listDeliveryInsuranceLedgerGET /delivery/{settle}/insuranceFutures market insurance fund history
listDeliveryAccountsGET /delivery/{settle}/accountsGet futures account
listDeliveryAccountBookGET /delivery/{settle}/account_bookQuery futures account change history
listDeliveryPositionsGET /delivery/{settle}/positionsGet user position list
getDeliveryPositionGET /delivery/{settle}/positions/{contract}Get single position information
updateDeliveryPositionMarginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
updateDeliveryPositionLeveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
updateDeliveryPositionRiskLimitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
listDeliveryOrdersGET /delivery/{settle}/ordersQuery futures order list
createDeliveryOrderPOST /delivery/{settle}/ordersPlace futures order
cancelDeliveryOrdersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
getDeliveryOrderGET /delivery/{settle}/orders/{order_id}Query single order details
cancelDeliveryOrderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
getMyDeliveryTradesGET /delivery/{settle}/my_tradesQuery personal trading records
listDeliveryPositionCloseGET /delivery/{settle}/position_closeQuery position close history
listDeliveryLiquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
listDeliverySettlementsGET /delivery/{settle}/settlementsQuery settlement records
listDeliveryRiskLimitTiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
listPriceTriggeredDeliveryOrdersGET /delivery/{settle}/price_ordersQuery auto order list
createPriceTriggeredDeliveryOrderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancelPriceTriggeredDeliveryOrderListDELETE /delivery/{settle}/price_ordersCancel all auto orders
getPriceTriggeredDeliveryOrderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancelPriceTriggeredDeliveryOrderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

listDeliveryContracts

List<DeliveryContract> listDeliveryContracts(settle)

Query all futures contracts

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryContract> result = apiInstance.listDeliveryContracts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryContracts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryContract>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryContract

DeliveryContract getDeliveryContract(settle, contract)

Query single contract information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryContractresult = apiInstance.getDeliveryContract(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryContract");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Contract information-

listDeliveryOrderBook

DeliveryOrderBook listDeliveryOrderBook(settle, contract).interval(interval).limit(limit).withId(withId).execute();

Query futures market depth information

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringinterval = "0"; // String | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0Integerlimit = 10; // Integer | Number of depth levelsBooleanwithId = false; // Boolean | Whether to return depth update ID. This ID increments by 1 each time the depth changestry {
DeliveryOrderBookresult = apiInstance.listDeliveryOrderBook(settle, contract)
.interval(interval)
.limit(limit)
.withId(withId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrderBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
intervalStringPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to 0] [enum: 0, 0.1, 0.01]
limitIntegerNumber of depth levels[optional] [default to 10]
withIdBooleanWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to false]

Return type

DeliveryOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

listDeliveryTrades

List<DeliveryTrade> listDeliveryTrades(settle, contract).limit(limit).lastId(lastId).from(from).to(to).execute();

Futures market transaction records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listStringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rangLongfrom = 1546905600L; // 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. Longto = 1546935600L; // Long | Specify end time in Unix seconds, default to current time.try {
List<DeliveryTrade> result = apiInstance.listDeliveryTrades(settle, contract)
.limit(limit)
.lastId(lastId)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rang[optional]
fromLongSpecify 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]
toLongSpecify end time in Unix seconds, default to current time.[optional]

Return type

List<DeliveryTrade>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryCandlesticks

List<DeliveryCandlestick> listDeliveryCandlesticks(settle, contract).from(from).to(to).limit(limit).interval(interval).execute();

Futures market K-line chart

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongfrom = 1546905600L; // Long | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specifiedLongto = 1546935600L; // Long | Specify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precisionIntegerlimit = 100; // Integer | Maximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.Stringinterval = "5m"; // String | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial timetry {
List<DeliveryCandlestick> result = apiInstance.listDeliveryCandlesticks(settle, contract)
.from(from)
.to(to)
.limit(limit)
.interval(interval)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryCandlesticks");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
fromLongStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
toLongSpecify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precision[optional]
limitIntegerMaximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.[optional] [default to 100]
intervalStringTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to 5m] [enum: 10s, 30s, 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 7d, 1w, 30d]

Return type

List<DeliveryCandlestick>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryTickers

List<DeliveryTicker> listDeliveryTickers(settle).contract(contract).execute();

Get all futures trading statistics

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
List<DeliveryTicker> result = apiInstance.listDeliveryTickers(settle)
.contract(contract)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTickers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]

Return type

List<DeliveryTicker>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryInsuranceLedger

List<InsuranceRecord> listDeliveryInsuranceLedger(settle).limit(limit).execute();

Futures market insurance fund history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<InsuranceRecord> result = apiInstance.listDeliveryInsuranceLedger(settle)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryInsuranceLedger");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<InsuranceRecord>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryAccounts

DeliveryAccount listDeliveryAccounts(settle)

Get futures account

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
DeliveryAccountresult = apiInstance.listDeliveryAccounts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccounts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

DeliveryAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryAccountBook

List<DeliveryAccountBook> listDeliveryAccountBook(settle).limit(limit).from(from).to(to).type(type).execute();

Query futures account change history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listLongfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestampStringtype = "dnw"; // String | Change types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebatestry {
List<DeliveryAccountBook> result = apiInstance.listDeliveryAccountBook(settle)
.limit(limit)
.from(from)
.to(to)
.type(type)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
fromLongStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
toLongTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typeStringChange types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebates[optional] [enum: dnw, pnl, fee, refr, fund, point_dnw, point_fee, point_refr]

Return type

List<DeliveryAccountBook>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryPositions

List<DeliveryPosition> listDeliveryPositions(settle)

Get user position list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryPosition> result = apiInstance.listDeliveryPositions(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositions");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryPosition>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryPosition

DeliveryPosition getDeliveryPosition(settle, contract)

Get single position information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryPositionresult = apiInstance.getDeliveryPosition(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryPosition");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionMargin

DeliveryPosition updateDeliveryPositionMargin(settle, contract, change)

Update position margin

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringchange = "0.01"; // String | Margin change amount, positive number increases, negative number decreasestry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionMargin(settle, contract, change);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionMargin");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
changeStringMargin change amount, positive number increases, negative number decreases

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionLeverage

DeliveryPosition updateDeliveryPositionLeverage(settle, contract, leverage)

Update position leverage

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringleverage = "10"; // String | New position leveragetry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionLeverage(settle, contract, leverage);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionLeverage");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
leverageStringNew position leverage

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionRiskLimit

DeliveryPosition updateDeliveryPositionRiskLimit(settle, contract, riskLimit)

Update position risk limit

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringriskLimit = "10"; // String | New position risk limittry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionRiskLimit(settle, contract, riskLimit);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionRiskLimit");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
riskLimitStringNew position risk limit

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

listDeliveryOrders

List<DeliveryOrder> listDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query futures order list

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "open"; // String | Query order list based on statusStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryOrder> result = apiInstance.listDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

createDeliveryOrder

DeliveryOrder createDeliveryOrder(settle, deliveryOrder)

Place futures order

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyDeliveryOrderdeliveryOrder = newDeliveryOrder(); // DeliveryOrder | try {
DeliveryOrderresult = apiInstance.createDeliveryOrder(settle, deliveryOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
deliveryOrderDeliveryOrder

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

cancelDeliveryOrders

List<DeliveryOrder> cancelDeliveryOrders(settle, contract, side)

Cancel all orders with 'open' status

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringside = "ask"; // String | Specify all bids or all asks, both included if not specifiedtry {
List<DeliveryOrder> result = apiInstance.cancelDeliveryOrders(settle, contract, side);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
sideStringSpecify all bids or all asks, both included if not specified[optional] [enum: ask, bid]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

getDeliveryOrder

DeliveryOrder getDeliveryOrder(settle, orderId)

Query single order details

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.getDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

cancelDeliveryOrder

DeliveryOrder cancelDeliveryOrder(settle, orderId)

Cancel single order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.cancelDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

getMyDeliveryTrades

List<DeliveryMyTrade> getMyDeliveryTrades(settle).contract(contract).order(order).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query personal trading records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongorder = 12345L; // Long | Futures order ID, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryMyTrade> result = apiInstance.getMyDeliveryTrades(settle)
.contract(contract)
.order(order)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getMyDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
orderLongFutures order ID, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryMyTrade>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

listDeliveryPositionClose

List<DeliveryPositionClose> listDeliveryPositionClose(settle).contract(contract).limit(limit).execute();

Query position close history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<DeliveryPositionClose> result = apiInstance.listDeliveryPositionClose(settle)
.contract(contract)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositionClose");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<DeliveryPositionClose>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryLiquidates

List<DeliveryLiquidate> listDeliveryLiquidates(settle).contract(contract).limit(limit).at(at).execute();

Query liquidation history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify liquidation timestamptry {
List<DeliveryLiquidate> result = apiInstance.listDeliveryLiquidates(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryLiquidates");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify liquidation timestamp[optional] [default to 0]

Return type

List<DeliveryLiquidate>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliverySettlements

List<DeliverySettlement> listDeliverySettlements(settle).contract(contract).limit(limit).at(at).execute();

Query settlement records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify settlement timestamptry {
List<DeliverySettlement> result = apiInstance.listDeliverySettlements(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliverySettlements");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify settlement timestamp[optional] [default to 0]

Return type

List<DeliverySettlement>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryRiskLimitTiers

List<DeliveryLimitRiskTiers> listDeliveryRiskLimitTiers(settle).contract(contract).limit(limit).offset(offset).execute();

Query 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.

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<DeliveryLimitRiskTiers> result = apiInstance.listDeliveryRiskLimitTiers(settle)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryRiskLimitTiers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<DeliveryLimitRiskTiers>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listPriceTriggeredDeliveryOrders

List<FuturesPriceTriggeredOrder> listPriceTriggeredDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).execute();

Query auto order list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "status_example"; // String | Query order list based on statusStringcontract = "BTC_USDT"; // String | Futures contract, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<FuturesPriceTriggeredOrder> result = apiInstance.listPriceTriggeredDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listPriceTriggeredDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

createPriceTriggeredDeliveryOrder

TriggerOrderResponse createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder)

Create price-triggered order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyFuturesPriceTriggeredOrderfuturesPriceTriggeredOrder = newFuturesPriceTriggeredOrder(); // FuturesPriceTriggeredOrder | try {
TriggerOrderResponseresult = apiInstance.createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
futuresPriceTriggeredOrderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

cancelPriceTriggeredDeliveryOrderList

List<FuturesPriceTriggeredOrder> cancelPriceTriggeredDeliveryOrderList(settle, contract)

Cancel all auto orders

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT"; // String | Futures contracttry {
List<FuturesPriceTriggeredOrder> result = apiInstance.cancelPriceTriggeredDeliveryOrderList(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrderList");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancel request is received and processed. Success is determined based on the order list-

getPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder getPriceTriggeredDeliveryOrder(settle, orderId)

Query single auto order details

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.getPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-

cancelPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder cancelPriceTriggeredDeliveryOrder(settle, orderId)

Cancel single auto order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.cancelPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Latest commit

History

History
2174 lines (1707 loc) · 82.5 KB

File metadata and controls

2174 lines (1707 loc) · 82.5 KB

DeliveryApi

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

MethodHTTP requestDescription
listDeliveryContractsGET /delivery/{settle}/contractsQuery all futures contracts
getDeliveryContractGET /delivery/{settle}/contracts/{contract}Query single contract information
listDeliveryOrderBookGET /delivery/{settle}/order_bookQuery futures market depth information
listDeliveryTradesGET /delivery/{settle}/tradesFutures market transaction records
listDeliveryCandlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
listDeliveryTickersGET /delivery/{settle}/tickersGet all futures trading statistics
listDeliveryInsuranceLedgerGET /delivery/{settle}/insuranceFutures market insurance fund history
listDeliveryAccountsGET /delivery/{settle}/accountsGet futures account
listDeliveryAccountBookGET /delivery/{settle}/account_bookQuery futures account change history
listDeliveryPositionsGET /delivery/{settle}/positionsGet user position list
getDeliveryPositionGET /delivery/{settle}/positions/{contract}Get single position information
updateDeliveryPositionMarginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
updateDeliveryPositionLeveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
updateDeliveryPositionRiskLimitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
listDeliveryOrdersGET /delivery/{settle}/ordersQuery futures order list
createDeliveryOrderPOST /delivery/{settle}/ordersPlace futures order
cancelDeliveryOrdersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
getDeliveryOrderGET /delivery/{settle}/orders/{order_id}Query single order details
cancelDeliveryOrderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
getMyDeliveryTradesGET /delivery/{settle}/my_tradesQuery personal trading records
listDeliveryPositionCloseGET /delivery/{settle}/position_closeQuery position close history
listDeliveryLiquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
listDeliverySettlementsGET /delivery/{settle}/settlementsQuery settlement records
listDeliveryRiskLimitTiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
listPriceTriggeredDeliveryOrdersGET /delivery/{settle}/price_ordersQuery auto order list
createPriceTriggeredDeliveryOrderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancelPriceTriggeredDeliveryOrderListDELETE /delivery/{settle}/price_ordersCancel all auto orders
getPriceTriggeredDeliveryOrderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancelPriceTriggeredDeliveryOrderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

listDeliveryContracts

List<DeliveryContract> listDeliveryContracts(settle)

Query all futures contracts

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryContract> result = apiInstance.listDeliveryContracts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryContracts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryContract>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryContract

DeliveryContract getDeliveryContract(settle, contract)

Query single contract information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryContractresult = apiInstance.getDeliveryContract(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryContract");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Contract information-

listDeliveryOrderBook

DeliveryOrderBook listDeliveryOrderBook(settle, contract).interval(interval).limit(limit).withId(withId).execute();

Query futures market depth information

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringinterval = "0"; // String | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0Integerlimit = 10; // Integer | Number of depth levelsBooleanwithId = false; // Boolean | Whether to return depth update ID. This ID increments by 1 each time the depth changestry {
DeliveryOrderBookresult = apiInstance.listDeliveryOrderBook(settle, contract)
.interval(interval)
.limit(limit)
.withId(withId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrderBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
intervalStringPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to 0] [enum: 0, 0.1, 0.01]
limitIntegerNumber of depth levels[optional] [default to 10]
withIdBooleanWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to false]

Return type

DeliveryOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

listDeliveryTrades

List<DeliveryTrade> listDeliveryTrades(settle, contract).limit(limit).lastId(lastId).from(from).to(to).execute();

Futures market transaction records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listStringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rangLongfrom = 1546905600L; // 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. Longto = 1546935600L; // Long | Specify end time in Unix seconds, default to current time.try {
List<DeliveryTrade> result = apiInstance.listDeliveryTrades(settle, contract)
.limit(limit)
.lastId(lastId)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rang[optional]
fromLongSpecify 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]
toLongSpecify end time in Unix seconds, default to current time.[optional]

Return type

List<DeliveryTrade>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryCandlesticks

List<DeliveryCandlestick> listDeliveryCandlesticks(settle, contract).from(from).to(to).limit(limit).interval(interval).execute();

Futures market K-line chart

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongfrom = 1546905600L; // Long | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specifiedLongto = 1546935600L; // Long | Specify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precisionIntegerlimit = 100; // Integer | Maximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.Stringinterval = "5m"; // String | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial timetry {
List<DeliveryCandlestick> result = apiInstance.listDeliveryCandlesticks(settle, contract)
.from(from)
.to(to)
.limit(limit)
.interval(interval)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryCandlesticks");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
fromLongStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
toLongSpecify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precision[optional]
limitIntegerMaximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.[optional] [default to 100]
intervalStringTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to 5m] [enum: 10s, 30s, 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 7d, 1w, 30d]

Return type

List<DeliveryCandlestick>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryTickers

List<DeliveryTicker> listDeliveryTickers(settle).contract(contract).execute();

Get all futures trading statistics

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
List<DeliveryTicker> result = apiInstance.listDeliveryTickers(settle)
.contract(contract)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTickers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]

Return type

List<DeliveryTicker>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryInsuranceLedger

List<InsuranceRecord> listDeliveryInsuranceLedger(settle).limit(limit).execute();

Futures market insurance fund history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<InsuranceRecord> result = apiInstance.listDeliveryInsuranceLedger(settle)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryInsuranceLedger");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<InsuranceRecord>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryAccounts

DeliveryAccount listDeliveryAccounts(settle)

Get futures account

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
DeliveryAccountresult = apiInstance.listDeliveryAccounts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccounts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

DeliveryAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryAccountBook

List<DeliveryAccountBook> listDeliveryAccountBook(settle).limit(limit).from(from).to(to).type(type).execute();

Query futures account change history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listLongfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestampStringtype = "dnw"; // String | Change types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebatestry {
List<DeliveryAccountBook> result = apiInstance.listDeliveryAccountBook(settle)
.limit(limit)
.from(from)
.to(to)
.type(type)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
fromLongStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
toLongTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typeStringChange types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebates[optional] [enum: dnw, pnl, fee, refr, fund, point_dnw, point_fee, point_refr]

Return type

List<DeliveryAccountBook>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryPositions

List<DeliveryPosition> listDeliveryPositions(settle)

Get user position list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryPosition> result = apiInstance.listDeliveryPositions(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositions");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryPosition>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryPosition

DeliveryPosition getDeliveryPosition(settle, contract)

Get single position information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryPositionresult = apiInstance.getDeliveryPosition(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryPosition");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionMargin

DeliveryPosition updateDeliveryPositionMargin(settle, contract, change)

Update position margin

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringchange = "0.01"; // String | Margin change amount, positive number increases, negative number decreasestry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionMargin(settle, contract, change);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionMargin");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
changeStringMargin change amount, positive number increases, negative number decreases

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionLeverage

DeliveryPosition updateDeliveryPositionLeverage(settle, contract, leverage)

Update position leverage

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringleverage = "10"; // String | New position leveragetry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionLeverage(settle, contract, leverage);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionLeverage");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
leverageStringNew position leverage

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionRiskLimit

DeliveryPosition updateDeliveryPositionRiskLimit(settle, contract, riskLimit)

Update position risk limit

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringriskLimit = "10"; // String | New position risk limittry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionRiskLimit(settle, contract, riskLimit);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionRiskLimit");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
riskLimitStringNew position risk limit

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

listDeliveryOrders

List<DeliveryOrder> listDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query futures order list

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "open"; // String | Query order list based on statusStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryOrder> result = apiInstance.listDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

createDeliveryOrder

DeliveryOrder createDeliveryOrder(settle, deliveryOrder)

Place futures order

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyDeliveryOrderdeliveryOrder = newDeliveryOrder(); // DeliveryOrder | try {
DeliveryOrderresult = apiInstance.createDeliveryOrder(settle, deliveryOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
deliveryOrderDeliveryOrder

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

cancelDeliveryOrders

List<DeliveryOrder> cancelDeliveryOrders(settle, contract, side)

Cancel all orders with 'open' status

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringside = "ask"; // String | Specify all bids or all asks, both included if not specifiedtry {
List<DeliveryOrder> result = apiInstance.cancelDeliveryOrders(settle, contract, side);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
sideStringSpecify all bids or all asks, both included if not specified[optional] [enum: ask, bid]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

getDeliveryOrder

DeliveryOrder getDeliveryOrder(settle, orderId)

Query single order details

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.getDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

cancelDeliveryOrder

DeliveryOrder cancelDeliveryOrder(settle, orderId)

Cancel single order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.cancelDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

getMyDeliveryTrades

List<DeliveryMyTrade> getMyDeliveryTrades(settle).contract(contract).order(order).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query personal trading records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongorder = 12345L; // Long | Futures order ID, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryMyTrade> result = apiInstance.getMyDeliveryTrades(settle)
.contract(contract)
.order(order)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getMyDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
orderLongFutures order ID, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryMyTrade>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

listDeliveryPositionClose

List<DeliveryPositionClose> listDeliveryPositionClose(settle).contract(contract).limit(limit).execute();

Query position close history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<DeliveryPositionClose> result = apiInstance.listDeliveryPositionClose(settle)
.contract(contract)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositionClose");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<DeliveryPositionClose>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryLiquidates

List<DeliveryLiquidate> listDeliveryLiquidates(settle).contract(contract).limit(limit).at(at).execute();

Query liquidation history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify liquidation timestamptry {
List<DeliveryLiquidate> result = apiInstance.listDeliveryLiquidates(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryLiquidates");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify liquidation timestamp[optional] [default to 0]

Return type

List<DeliveryLiquidate>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliverySettlements

List<DeliverySettlement> listDeliverySettlements(settle).contract(contract).limit(limit).at(at).execute();

Query settlement records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify settlement timestamptry {
List<DeliverySettlement> result = apiInstance.listDeliverySettlements(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliverySettlements");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify settlement timestamp[optional] [default to 0]

Return type

List<DeliverySettlement>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryRiskLimitTiers

List<DeliveryLimitRiskTiers> listDeliveryRiskLimitTiers(settle).contract(contract).limit(limit).offset(offset).execute();

Query 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.

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<DeliveryLimitRiskTiers> result = apiInstance.listDeliveryRiskLimitTiers(settle)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryRiskLimitTiers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<DeliveryLimitRiskTiers>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listPriceTriggeredDeliveryOrders

List<FuturesPriceTriggeredOrder> listPriceTriggeredDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).execute();

Query auto order list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "status_example"; // String | Query order list based on statusStringcontract = "BTC_USDT"; // String | Futures contract, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<FuturesPriceTriggeredOrder> result = apiInstance.listPriceTriggeredDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listPriceTriggeredDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

createPriceTriggeredDeliveryOrder

TriggerOrderResponse createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder)

Create price-triggered order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyFuturesPriceTriggeredOrderfuturesPriceTriggeredOrder = newFuturesPriceTriggeredOrder(); // FuturesPriceTriggeredOrder | try {
TriggerOrderResponseresult = apiInstance.createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
futuresPriceTriggeredOrderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

cancelPriceTriggeredDeliveryOrderList

List<FuturesPriceTriggeredOrder> cancelPriceTriggeredDeliveryOrderList(settle, contract)

Cancel all auto orders

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT"; // String | Futures contracttry {
List<FuturesPriceTriggeredOrder> result = apiInstance.cancelPriceTriggeredDeliveryOrderList(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrderList");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancel request is received and processed. Success is determined based on the order list-

getPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder getPriceTriggeredDeliveryOrder(settle, orderId)

Query single auto order details

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.getPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-

cancelPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder cancelPriceTriggeredDeliveryOrder(settle, orderId)

Cancel single auto order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.cancelPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

History
2174 lines (1707 loc) · 82.5 KB

File metadata and controls

2174 lines (1707 loc) · 82.5 KB

DeliveryApi

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

MethodHTTP requestDescription
listDeliveryContractsGET /delivery/{settle}/contractsQuery all futures contracts
getDeliveryContractGET /delivery/{settle}/contracts/{contract}Query single contract information
listDeliveryOrderBookGET /delivery/{settle}/order_bookQuery futures market depth information
listDeliveryTradesGET /delivery/{settle}/tradesFutures market transaction records
listDeliveryCandlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
listDeliveryTickersGET /delivery/{settle}/tickersGet all futures trading statistics
listDeliveryInsuranceLedgerGET /delivery/{settle}/insuranceFutures market insurance fund history
listDeliveryAccountsGET /delivery/{settle}/accountsGet futures account
listDeliveryAccountBookGET /delivery/{settle}/account_bookQuery futures account change history
listDeliveryPositionsGET /delivery/{settle}/positionsGet user position list
getDeliveryPositionGET /delivery/{settle}/positions/{contract}Get single position information
updateDeliveryPositionMarginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
updateDeliveryPositionLeveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
updateDeliveryPositionRiskLimitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
listDeliveryOrdersGET /delivery/{settle}/ordersQuery futures order list
createDeliveryOrderPOST /delivery/{settle}/ordersPlace futures order
cancelDeliveryOrdersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
getDeliveryOrderGET /delivery/{settle}/orders/{order_id}Query single order details
cancelDeliveryOrderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
getMyDeliveryTradesGET /delivery/{settle}/my_tradesQuery personal trading records
listDeliveryPositionCloseGET /delivery/{settle}/position_closeQuery position close history
listDeliveryLiquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
listDeliverySettlementsGET /delivery/{settle}/settlementsQuery settlement records
listDeliveryRiskLimitTiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
listPriceTriggeredDeliveryOrdersGET /delivery/{settle}/price_ordersQuery auto order list
createPriceTriggeredDeliveryOrderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancelPriceTriggeredDeliveryOrderListDELETE /delivery/{settle}/price_ordersCancel all auto orders
getPriceTriggeredDeliveryOrderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancelPriceTriggeredDeliveryOrderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

listDeliveryContracts

List<DeliveryContract> listDeliveryContracts(settle)

Query all futures contracts

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryContract> result = apiInstance.listDeliveryContracts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryContracts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryContract>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryContract

DeliveryContract getDeliveryContract(settle, contract)

Query single contract information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryContractresult = apiInstance.getDeliveryContract(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryContract");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Contract information-

listDeliveryOrderBook

DeliveryOrderBook listDeliveryOrderBook(settle, contract).interval(interval).limit(limit).withId(withId).execute();

Query futures market depth information

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringinterval = "0"; // String | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0Integerlimit = 10; // Integer | Number of depth levelsBooleanwithId = false; // Boolean | Whether to return depth update ID. This ID increments by 1 each time the depth changestry {
DeliveryOrderBookresult = apiInstance.listDeliveryOrderBook(settle, contract)
.interval(interval)
.limit(limit)
.withId(withId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrderBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
intervalStringPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to 0] [enum: 0, 0.1, 0.01]
limitIntegerNumber of depth levels[optional] [default to 10]
withIdBooleanWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to false]

Return type

DeliveryOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

listDeliveryTrades

List<DeliveryTrade> listDeliveryTrades(settle, contract).limit(limit).lastId(lastId).from(from).to(to).execute();

Futures market transaction records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listStringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rangLongfrom = 1546905600L; // 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. Longto = 1546935600L; // Long | Specify end time in Unix seconds, default to current time.try {
List<DeliveryTrade> result = apiInstance.listDeliveryTrades(settle, contract)
.limit(limit)
.lastId(lastId)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rang[optional]
fromLongSpecify 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]
toLongSpecify end time in Unix seconds, default to current time.[optional]

Return type

List<DeliveryTrade>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryCandlesticks

List<DeliveryCandlestick> listDeliveryCandlesticks(settle, contract).from(from).to(to).limit(limit).interval(interval).execute();

Futures market K-line chart

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongfrom = 1546905600L; // Long | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specifiedLongto = 1546935600L; // Long | Specify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precisionIntegerlimit = 100; // Integer | Maximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.Stringinterval = "5m"; // String | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial timetry {
List<DeliveryCandlestick> result = apiInstance.listDeliveryCandlesticks(settle, contract)
.from(from)
.to(to)
.limit(limit)
.interval(interval)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryCandlesticks");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
fromLongStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
toLongSpecify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precision[optional]
limitIntegerMaximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.[optional] [default to 100]
intervalStringTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to 5m] [enum: 10s, 30s, 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 7d, 1w, 30d]

Return type

List<DeliveryCandlestick>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryTickers

List<DeliveryTicker> listDeliveryTickers(settle).contract(contract).execute();

Get all futures trading statistics

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
List<DeliveryTicker> result = apiInstance.listDeliveryTickers(settle)
.contract(contract)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTickers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]

Return type

List<DeliveryTicker>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryInsuranceLedger

List<InsuranceRecord> listDeliveryInsuranceLedger(settle).limit(limit).execute();

Futures market insurance fund history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<InsuranceRecord> result = apiInstance.listDeliveryInsuranceLedger(settle)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryInsuranceLedger");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<InsuranceRecord>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryAccounts

DeliveryAccount listDeliveryAccounts(settle)

Get futures account

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
DeliveryAccountresult = apiInstance.listDeliveryAccounts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccounts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

DeliveryAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryAccountBook

List<DeliveryAccountBook> listDeliveryAccountBook(settle).limit(limit).from(from).to(to).type(type).execute();

Query futures account change history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listLongfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestampStringtype = "dnw"; // String | Change types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebatestry {
List<DeliveryAccountBook> result = apiInstance.listDeliveryAccountBook(settle)
.limit(limit)
.from(from)
.to(to)
.type(type)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
fromLongStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
toLongTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typeStringChange types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebates[optional] [enum: dnw, pnl, fee, refr, fund, point_dnw, point_fee, point_refr]

Return type

List<DeliveryAccountBook>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryPositions

List<DeliveryPosition> listDeliveryPositions(settle)

Get user position list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryPosition> result = apiInstance.listDeliveryPositions(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositions");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryPosition>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryPosition

DeliveryPosition getDeliveryPosition(settle, contract)

Get single position information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryPositionresult = apiInstance.getDeliveryPosition(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryPosition");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionMargin

DeliveryPosition updateDeliveryPositionMargin(settle, contract, change)

Update position margin

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringchange = "0.01"; // String | Margin change amount, positive number increases, negative number decreasestry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionMargin(settle, contract, change);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionMargin");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
changeStringMargin change amount, positive number increases, negative number decreases

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionLeverage

DeliveryPosition updateDeliveryPositionLeverage(settle, contract, leverage)

Update position leverage

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringleverage = "10"; // String | New position leveragetry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionLeverage(settle, contract, leverage);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionLeverage");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
leverageStringNew position leverage

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionRiskLimit

DeliveryPosition updateDeliveryPositionRiskLimit(settle, contract, riskLimit)

Update position risk limit

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringriskLimit = "10"; // String | New position risk limittry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionRiskLimit(settle, contract, riskLimit);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionRiskLimit");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
riskLimitStringNew position risk limit

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

listDeliveryOrders

List<DeliveryOrder> listDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query futures order list

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "open"; // String | Query order list based on statusStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryOrder> result = apiInstance.listDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

createDeliveryOrder

DeliveryOrder createDeliveryOrder(settle, deliveryOrder)

Place futures order

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyDeliveryOrderdeliveryOrder = newDeliveryOrder(); // DeliveryOrder | try {
DeliveryOrderresult = apiInstance.createDeliveryOrder(settle, deliveryOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
deliveryOrderDeliveryOrder

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

cancelDeliveryOrders

List<DeliveryOrder> cancelDeliveryOrders(settle, contract, side)

Cancel all orders with 'open' status

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringside = "ask"; // String | Specify all bids or all asks, both included if not specifiedtry {
List<DeliveryOrder> result = apiInstance.cancelDeliveryOrders(settle, contract, side);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
sideStringSpecify all bids or all asks, both included if not specified[optional] [enum: ask, bid]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

getDeliveryOrder

DeliveryOrder getDeliveryOrder(settle, orderId)

Query single order details

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.getDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

cancelDeliveryOrder

DeliveryOrder cancelDeliveryOrder(settle, orderId)

Cancel single order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.cancelDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

getMyDeliveryTrades

List<DeliveryMyTrade> getMyDeliveryTrades(settle).contract(contract).order(order).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query personal trading records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongorder = 12345L; // Long | Futures order ID, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryMyTrade> result = apiInstance.getMyDeliveryTrades(settle)
.contract(contract)
.order(order)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getMyDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
orderLongFutures order ID, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryMyTrade>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

listDeliveryPositionClose

List<DeliveryPositionClose> listDeliveryPositionClose(settle).contract(contract).limit(limit).execute();

Query position close history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<DeliveryPositionClose> result = apiInstance.listDeliveryPositionClose(settle)
.contract(contract)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositionClose");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<DeliveryPositionClose>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryLiquidates

List<DeliveryLiquidate> listDeliveryLiquidates(settle).contract(contract).limit(limit).at(at).execute();

Query liquidation history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify liquidation timestamptry {
List<DeliveryLiquidate> result = apiInstance.listDeliveryLiquidates(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryLiquidates");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify liquidation timestamp[optional] [default to 0]

Return type

List<DeliveryLiquidate>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliverySettlements

List<DeliverySettlement> listDeliverySettlements(settle).contract(contract).limit(limit).at(at).execute();

Query settlement records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify settlement timestamptry {
List<DeliverySettlement> result = apiInstance.listDeliverySettlements(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliverySettlements");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify settlement timestamp[optional] [default to 0]

Return type

List<DeliverySettlement>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryRiskLimitTiers

List<DeliveryLimitRiskTiers> listDeliveryRiskLimitTiers(settle).contract(contract).limit(limit).offset(offset).execute();

Query 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.

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<DeliveryLimitRiskTiers> result = apiInstance.listDeliveryRiskLimitTiers(settle)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryRiskLimitTiers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<DeliveryLimitRiskTiers>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listPriceTriggeredDeliveryOrders

List<FuturesPriceTriggeredOrder> listPriceTriggeredDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).execute();

Query auto order list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "status_example"; // String | Query order list based on statusStringcontract = "BTC_USDT"; // String | Futures contract, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<FuturesPriceTriggeredOrder> result = apiInstance.listPriceTriggeredDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listPriceTriggeredDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

createPriceTriggeredDeliveryOrder

TriggerOrderResponse createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder)

Create price-triggered order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyFuturesPriceTriggeredOrderfuturesPriceTriggeredOrder = newFuturesPriceTriggeredOrder(); // FuturesPriceTriggeredOrder | try {
TriggerOrderResponseresult = apiInstance.createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
futuresPriceTriggeredOrderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

cancelPriceTriggeredDeliveryOrderList

List<FuturesPriceTriggeredOrder> cancelPriceTriggeredDeliveryOrderList(settle, contract)

Cancel all auto orders

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT"; // String | Futures contracttry {
List<FuturesPriceTriggeredOrder> result = apiInstance.cancelPriceTriggeredDeliveryOrderList(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrderList");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancel request is received and processed. Success is determined based on the order list-

getPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder getPriceTriggeredDeliveryOrder(settle, orderId)

Query single auto order details

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.getPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-

cancelPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder cancelPriceTriggeredDeliveryOrder(settle, orderId)

Cancel single auto order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.cancelPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Latest commit

History

History
2174 lines (1707 loc) · 82.5 KB

File metadata and controls

2174 lines (1707 loc) · 82.5 KB

DeliveryApi

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

MethodHTTP requestDescription
listDeliveryContractsGET /delivery/{settle}/contractsQuery all futures contracts
getDeliveryContractGET /delivery/{settle}/contracts/{contract}Query single contract information
listDeliveryOrderBookGET /delivery/{settle}/order_bookQuery futures market depth information
listDeliveryTradesGET /delivery/{settle}/tradesFutures market transaction records
listDeliveryCandlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
listDeliveryTickersGET /delivery/{settle}/tickersGet all futures trading statistics
listDeliveryInsuranceLedgerGET /delivery/{settle}/insuranceFutures market insurance fund history
listDeliveryAccountsGET /delivery/{settle}/accountsGet futures account
listDeliveryAccountBookGET /delivery/{settle}/account_bookQuery futures account change history
listDeliveryPositionsGET /delivery/{settle}/positionsGet user position list
getDeliveryPositionGET /delivery/{settle}/positions/{contract}Get single position information
updateDeliveryPositionMarginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
updateDeliveryPositionLeveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
updateDeliveryPositionRiskLimitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
listDeliveryOrdersGET /delivery/{settle}/ordersQuery futures order list
createDeliveryOrderPOST /delivery/{settle}/ordersPlace futures order
cancelDeliveryOrdersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
getDeliveryOrderGET /delivery/{settle}/orders/{order_id}Query single order details
cancelDeliveryOrderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
getMyDeliveryTradesGET /delivery/{settle}/my_tradesQuery personal trading records
listDeliveryPositionCloseGET /delivery/{settle}/position_closeQuery position close history
listDeliveryLiquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
listDeliverySettlementsGET /delivery/{settle}/settlementsQuery settlement records
listDeliveryRiskLimitTiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
listPriceTriggeredDeliveryOrdersGET /delivery/{settle}/price_ordersQuery auto order list
createPriceTriggeredDeliveryOrderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancelPriceTriggeredDeliveryOrderListDELETE /delivery/{settle}/price_ordersCancel all auto orders
getPriceTriggeredDeliveryOrderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancelPriceTriggeredDeliveryOrderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

listDeliveryContracts

List<DeliveryContract> listDeliveryContracts(settle)

Query all futures contracts

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryContract> result = apiInstance.listDeliveryContracts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryContracts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryContract>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryContract

DeliveryContract getDeliveryContract(settle, contract)

Query single contract information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryContractresult = apiInstance.getDeliveryContract(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryContract");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Contract information-

listDeliveryOrderBook

DeliveryOrderBook listDeliveryOrderBook(settle, contract).interval(interval).limit(limit).withId(withId).execute();

Query futures market depth information

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringinterval = "0"; // String | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0Integerlimit = 10; // Integer | Number of depth levelsBooleanwithId = false; // Boolean | Whether to return depth update ID. This ID increments by 1 each time the depth changestry {
DeliveryOrderBookresult = apiInstance.listDeliveryOrderBook(settle, contract)
.interval(interval)
.limit(limit)
.withId(withId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrderBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
intervalStringPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to 0] [enum: 0, 0.1, 0.01]
limitIntegerNumber of depth levels[optional] [default to 10]
withIdBooleanWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to false]

Return type

DeliveryOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

listDeliveryTrades

List<DeliveryTrade> listDeliveryTrades(settle, contract).limit(limit).lastId(lastId).from(from).to(to).execute();

Futures market transaction records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listStringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rangLongfrom = 1546905600L; // 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. Longto = 1546935600L; // Long | Specify end time in Unix seconds, default to current time.try {
List<DeliveryTrade> result = apiInstance.listDeliveryTrades(settle, contract)
.limit(limit)
.lastId(lastId)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rang[optional]
fromLongSpecify 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]
toLongSpecify end time in Unix seconds, default to current time.[optional]

Return type

List<DeliveryTrade>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryCandlesticks

List<DeliveryCandlestick> listDeliveryCandlesticks(settle, contract).from(from).to(to).limit(limit).interval(interval).execute();

Futures market K-line chart

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongfrom = 1546905600L; // Long | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specifiedLongto = 1546935600L; // Long | Specify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precisionIntegerlimit = 100; // Integer | Maximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.Stringinterval = "5m"; // String | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial timetry {
List<DeliveryCandlestick> result = apiInstance.listDeliveryCandlesticks(settle, contract)
.from(from)
.to(to)
.limit(limit)
.interval(interval)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryCandlesticks");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
fromLongStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
toLongSpecify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precision[optional]
limitIntegerMaximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.[optional] [default to 100]
intervalStringTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to 5m] [enum: 10s, 30s, 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 7d, 1w, 30d]

Return type

List<DeliveryCandlestick>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryTickers

List<DeliveryTicker> listDeliveryTickers(settle).contract(contract).execute();

Get all futures trading statistics

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
List<DeliveryTicker> result = apiInstance.listDeliveryTickers(settle)
.contract(contract)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTickers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]

Return type

List<DeliveryTicker>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryInsuranceLedger

List<InsuranceRecord> listDeliveryInsuranceLedger(settle).limit(limit).execute();

Futures market insurance fund history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<InsuranceRecord> result = apiInstance.listDeliveryInsuranceLedger(settle)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryInsuranceLedger");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<InsuranceRecord>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryAccounts

DeliveryAccount listDeliveryAccounts(settle)

Get futures account

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
DeliveryAccountresult = apiInstance.listDeliveryAccounts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccounts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

DeliveryAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryAccountBook

List<DeliveryAccountBook> listDeliveryAccountBook(settle).limit(limit).from(from).to(to).type(type).execute();

Query futures account change history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listLongfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestampStringtype = "dnw"; // String | Change types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebatestry {
List<DeliveryAccountBook> result = apiInstance.listDeliveryAccountBook(settle)
.limit(limit)
.from(from)
.to(to)
.type(type)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
fromLongStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
toLongTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typeStringChange types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebates[optional] [enum: dnw, pnl, fee, refr, fund, point_dnw, point_fee, point_refr]

Return type

List<DeliveryAccountBook>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryPositions

List<DeliveryPosition> listDeliveryPositions(settle)

Get user position list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryPosition> result = apiInstance.listDeliveryPositions(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositions");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryPosition>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryPosition

DeliveryPosition getDeliveryPosition(settle, contract)

Get single position information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryPositionresult = apiInstance.getDeliveryPosition(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryPosition");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionMargin

DeliveryPosition updateDeliveryPositionMargin(settle, contract, change)

Update position margin

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringchange = "0.01"; // String | Margin change amount, positive number increases, negative number decreasestry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionMargin(settle, contract, change);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionMargin");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
changeStringMargin change amount, positive number increases, negative number decreases

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionLeverage

DeliveryPosition updateDeliveryPositionLeverage(settle, contract, leverage)

Update position leverage

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringleverage = "10"; // String | New position leveragetry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionLeverage(settle, contract, leverage);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionLeverage");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
leverageStringNew position leverage

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionRiskLimit

DeliveryPosition updateDeliveryPositionRiskLimit(settle, contract, riskLimit)

Update position risk limit

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringriskLimit = "10"; // String | New position risk limittry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionRiskLimit(settle, contract, riskLimit);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionRiskLimit");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
riskLimitStringNew position risk limit

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

listDeliveryOrders

List<DeliveryOrder> listDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query futures order list

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "open"; // String | Query order list based on statusStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryOrder> result = apiInstance.listDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

createDeliveryOrder

DeliveryOrder createDeliveryOrder(settle, deliveryOrder)

Place futures order

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyDeliveryOrderdeliveryOrder = newDeliveryOrder(); // DeliveryOrder | try {
DeliveryOrderresult = apiInstance.createDeliveryOrder(settle, deliveryOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
deliveryOrderDeliveryOrder

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

cancelDeliveryOrders

List<DeliveryOrder> cancelDeliveryOrders(settle, contract, side)

Cancel all orders with 'open' status

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringside = "ask"; // String | Specify all bids or all asks, both included if not specifiedtry {
List<DeliveryOrder> result = apiInstance.cancelDeliveryOrders(settle, contract, side);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
sideStringSpecify all bids or all asks, both included if not specified[optional] [enum: ask, bid]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

getDeliveryOrder

DeliveryOrder getDeliveryOrder(settle, orderId)

Query single order details

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.getDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

cancelDeliveryOrder

DeliveryOrder cancelDeliveryOrder(settle, orderId)

Cancel single order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.cancelDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

getMyDeliveryTrades

List<DeliveryMyTrade> getMyDeliveryTrades(settle).contract(contract).order(order).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query personal trading records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongorder = 12345L; // Long | Futures order ID, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryMyTrade> result = apiInstance.getMyDeliveryTrades(settle)
.contract(contract)
.order(order)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getMyDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
orderLongFutures order ID, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryMyTrade>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

listDeliveryPositionClose

List<DeliveryPositionClose> listDeliveryPositionClose(settle).contract(contract).limit(limit).execute();

Query position close history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<DeliveryPositionClose> result = apiInstance.listDeliveryPositionClose(settle)
.contract(contract)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositionClose");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<DeliveryPositionClose>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryLiquidates

List<DeliveryLiquidate> listDeliveryLiquidates(settle).contract(contract).limit(limit).at(at).execute();

Query liquidation history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify liquidation timestamptry {
List<DeliveryLiquidate> result = apiInstance.listDeliveryLiquidates(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryLiquidates");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify liquidation timestamp[optional] [default to 0]

Return type

List<DeliveryLiquidate>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliverySettlements

List<DeliverySettlement> listDeliverySettlements(settle).contract(contract).limit(limit).at(at).execute();

Query settlement records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify settlement timestamptry {
List<DeliverySettlement> result = apiInstance.listDeliverySettlements(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliverySettlements");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify settlement timestamp[optional] [default to 0]

Return type

List<DeliverySettlement>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryRiskLimitTiers

List<DeliveryLimitRiskTiers> listDeliveryRiskLimitTiers(settle).contract(contract).limit(limit).offset(offset).execute();

Query 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.

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<DeliveryLimitRiskTiers> result = apiInstance.listDeliveryRiskLimitTiers(settle)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryRiskLimitTiers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<DeliveryLimitRiskTiers>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listPriceTriggeredDeliveryOrders

List<FuturesPriceTriggeredOrder> listPriceTriggeredDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).execute();

Query auto order list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "status_example"; // String | Query order list based on statusStringcontract = "BTC_USDT"; // String | Futures contract, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<FuturesPriceTriggeredOrder> result = apiInstance.listPriceTriggeredDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listPriceTriggeredDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

createPriceTriggeredDeliveryOrder

TriggerOrderResponse createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder)

Create price-triggered order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyFuturesPriceTriggeredOrderfuturesPriceTriggeredOrder = newFuturesPriceTriggeredOrder(); // FuturesPriceTriggeredOrder | try {
TriggerOrderResponseresult = apiInstance.createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
futuresPriceTriggeredOrderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

cancelPriceTriggeredDeliveryOrderList

List<FuturesPriceTriggeredOrder> cancelPriceTriggeredDeliveryOrderList(settle, contract)

Cancel all auto orders

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT"; // String | Futures contracttry {
List<FuturesPriceTriggeredOrder> result = apiInstance.cancelPriceTriggeredDeliveryOrderList(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrderList");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancel request is received and processed. Success is determined based on the order list-

getPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder getPriceTriggeredDeliveryOrder(settle, orderId)

Query single auto order details

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.getPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-

cancelPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder cancelPriceTriggeredDeliveryOrder(settle, orderId)

Cancel single auto order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.cancelPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Latest commit

History

History
2174 lines (1707 loc) · 82.5 KB

File metadata and controls

2174 lines (1707 loc) · 82.5 KB

DeliveryApi

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

MethodHTTP requestDescription
listDeliveryContractsGET /delivery/{settle}/contractsQuery all futures contracts
getDeliveryContractGET /delivery/{settle}/contracts/{contract}Query single contract information
listDeliveryOrderBookGET /delivery/{settle}/order_bookQuery futures market depth information
listDeliveryTradesGET /delivery/{settle}/tradesFutures market transaction records
listDeliveryCandlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
listDeliveryTickersGET /delivery/{settle}/tickersGet all futures trading statistics
listDeliveryInsuranceLedgerGET /delivery/{settle}/insuranceFutures market insurance fund history
listDeliveryAccountsGET /delivery/{settle}/accountsGet futures account
listDeliveryAccountBookGET /delivery/{settle}/account_bookQuery futures account change history
listDeliveryPositionsGET /delivery/{settle}/positionsGet user position list
getDeliveryPositionGET /delivery/{settle}/positions/{contract}Get single position information
updateDeliveryPositionMarginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
updateDeliveryPositionLeveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
updateDeliveryPositionRiskLimitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
listDeliveryOrdersGET /delivery/{settle}/ordersQuery futures order list
createDeliveryOrderPOST /delivery/{settle}/ordersPlace futures order
cancelDeliveryOrdersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
getDeliveryOrderGET /delivery/{settle}/orders/{order_id}Query single order details
cancelDeliveryOrderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
getMyDeliveryTradesGET /delivery/{settle}/my_tradesQuery personal trading records
listDeliveryPositionCloseGET /delivery/{settle}/position_closeQuery position close history
listDeliveryLiquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
listDeliverySettlementsGET /delivery/{settle}/settlementsQuery settlement records
listDeliveryRiskLimitTiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
listPriceTriggeredDeliveryOrdersGET /delivery/{settle}/price_ordersQuery auto order list
createPriceTriggeredDeliveryOrderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancelPriceTriggeredDeliveryOrderListDELETE /delivery/{settle}/price_ordersCancel all auto orders
getPriceTriggeredDeliveryOrderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancelPriceTriggeredDeliveryOrderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

listDeliveryContracts

List<DeliveryContract> listDeliveryContracts(settle)

Query all futures contracts

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryContract> result = apiInstance.listDeliveryContracts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryContracts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryContract>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryContract

DeliveryContract getDeliveryContract(settle, contract)

Query single contract information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryContractresult = apiInstance.getDeliveryContract(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryContract");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryContract

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Contract information-

listDeliveryOrderBook

DeliveryOrderBook listDeliveryOrderBook(settle, contract).interval(interval).limit(limit).withId(withId).execute();

Query futures market depth information

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringinterval = "0"; // String | Price precision for merged depth. 0 means no merging. If not specified, defaults to 0Integerlimit = 10; // Integer | Number of depth levelsBooleanwithId = false; // Boolean | Whether to return depth update ID. This ID increments by 1 each time the depth changestry {
DeliveryOrderBookresult = apiInstance.listDeliveryOrderBook(settle, contract)
.interval(interval)
.limit(limit)
.withId(withId)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrderBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
intervalStringPrice precision for merged depth. 0 means no merging. If not specified, defaults to 0[optional] [default to 0] [enum: 0, 0.1, 0.01]
limitIntegerNumber of depth levels[optional] [default to 10]
withIdBooleanWhether to return depth update ID. This ID increments by 1 each time the depth changes[optional] [default to false]

Return type

DeliveryOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

listDeliveryTrades

List<DeliveryTrade> listDeliveryTrades(settle, contract).limit(limit).lastId(lastId).from(from).to(to).execute();

Futures market transaction records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listStringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rangLongfrom = 1546905600L; // 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. Longto = 1546935600L; // Long | Specify end time in Unix seconds, default to current time.try {
List<DeliveryTrade> result = apiInstance.listDeliveryTrades(settle, contract)
.limit(limit)
.lastId(lastId)
.from(from)
.to(to)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list.This field is no longer supported. For new requests, please use the fromand tofields to specify the time rang[optional]
fromLongSpecify 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]
toLongSpecify end time in Unix seconds, default to current time.[optional]

Return type

List<DeliveryTrade>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryCandlesticks

List<DeliveryCandlestick> listDeliveryCandlesticks(settle, contract).from(from).to(to).limit(limit).interval(interval).execute();

Futures market K-line chart

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

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongfrom = 1546905600L; // Long | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specifiedLongto = 1546935600L; // Long | Specify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precisionIntegerlimit = 100; // Integer | Maximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.Stringinterval = "5m"; // String | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial timetry {
List<DeliveryCandlestick> result = apiInstance.listDeliveryCandlesticks(settle, contract)
.from(from)
.to(to)
.limit(limit)
.interval(interval)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryCandlesticks");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
fromLongStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
toLongSpecify the end time of the K-line chart, defaults to current time if not specified, note that the time format is Unix timestamp with second precision[optional]
limitIntegerMaximum number of recent data points to return. `limit` conflicts with `from` and `to`. If either `from` or `to` is specified, request will be rejected.[optional] [default to 100]
intervalStringTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to 5m] [enum: 10s, 30s, 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 7d, 1w, 30d]

Return type

List<DeliveryCandlestick>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryTickers

List<DeliveryTicker> listDeliveryTickers(settle).contract(contract).execute();

Get all futures trading statistics

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
List<DeliveryTicker> result = apiInstance.listDeliveryTickers(settle)
.contract(contract)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryTickers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]

Return type

List<DeliveryTicker>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryInsuranceLedger

List<InsuranceRecord> listDeliveryInsuranceLedger(settle).limit(limit).execute();

Futures market insurance fund history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<InsuranceRecord> result = apiInstance.listDeliveryInsuranceLedger(settle)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryInsuranceLedger");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<InsuranceRecord>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listDeliveryAccounts

DeliveryAccount listDeliveryAccounts(settle)

Get futures account

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
DeliveryAccountresult = apiInstance.listDeliveryAccounts(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccounts");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

DeliveryAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryAccountBook

List<DeliveryAccountBook> listDeliveryAccountBook(settle).limit(limit).from(from).to(to).type(type).execute();

Query futures account change history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyIntegerlimit = 100; // Integer | Maximum number of records returned in a single listLongfrom = 1547706332L; // Long | Start timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)Longto = 1547706332L; // Long | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestampStringtype = "dnw"; // String | Change types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebatestry {
List<DeliveryAccountBook> result = apiInstance.listDeliveryAccountBook(settle)
.limit(limit)
.from(from)
.to(to)
.type(type)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryAccountBook");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
fromLongStart timestamp Specify start time, time format is Unix timestamp. If not specified, it defaults to (the data start time of the time range actually returned by to and limit)[optional]
toLongTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typeStringChange types: - dnw: Deposit and withdrawal - pnl: Profit and loss from position reduction - fee: Trading fees - refr: Referrer rebates - fund: Funding fees - point_dnw: Point card deposit and withdrawal - point_fee: Point card trading fees - point_refr: Point card referrer rebates[optional] [enum: dnw, pnl, fee, refr, fund, point_dnw, point_fee, point_refr]

Return type

List<DeliveryAccountBook>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryPositions

List<DeliveryPosition> listDeliveryPositions(settle)

Get user position list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencytry {
List<DeliveryPosition> result = apiInstance.listDeliveryPositions(settle);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositions");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]

Return type

List<DeliveryPosition>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

getDeliveryPosition

DeliveryPosition getDeliveryPosition(settle, contract)

Get single position information

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contracttry {
DeliveryPositionresult = apiInstance.getDeliveryPosition(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryPosition");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionMargin

DeliveryPosition updateDeliveryPositionMargin(settle, contract, change)

Update position margin

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringchange = "0.01"; // String | Margin change amount, positive number increases, negative number decreasestry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionMargin(settle, contract, change);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionMargin");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
changeStringMargin change amount, positive number increases, negative number decreases

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionLeverage

DeliveryPosition updateDeliveryPositionLeverage(settle, contract, leverage)

Update position leverage

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringleverage = "10"; // String | New position leveragetry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionLeverage(settle, contract, leverage);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionLeverage");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
leverageStringNew position leverage

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

updateDeliveryPositionRiskLimit

DeliveryPosition updateDeliveryPositionRiskLimit(settle, contract, riskLimit)

Update position risk limit

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringriskLimit = "10"; // String | New position risk limittry {
DeliveryPositionresult = apiInstance.updateDeliveryPositionRiskLimit(settle, contract, riskLimit);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#updateDeliveryPositionRiskLimit");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
riskLimitStringNew position risk limit

Return type

DeliveryPosition

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

listDeliveryOrders

List<DeliveryOrder> listDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query futures order list

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "open"; // String | Query order list based on statusStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryOrder> result = apiInstance.listDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

createDeliveryOrder

DeliveryOrder createDeliveryOrder(settle, deliveryOrder)

Place futures order

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyDeliveryOrderdeliveryOrder = newDeliveryOrder(); // DeliveryOrder | try {
DeliveryOrderresult = apiInstance.createDeliveryOrder(settle, deliveryOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
deliveryOrderDeliveryOrder

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

cancelDeliveryOrders

List<DeliveryOrder> cancelDeliveryOrders(settle, contract, side)

Cancel all orders with 'open' status

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractStringside = "ask"; // String | Specify all bids or all asks, both included if not specifiedtry {
List<DeliveryOrder> result = apiInstance.cancelDeliveryOrders(settle, contract, side);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract
sideStringSpecify all bids or all asks, both included if not specified[optional] [enum: ask, bid]

Return type

List<DeliveryOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

getDeliveryOrder

DeliveryOrder getDeliveryOrder(settle, orderId)

Query single order details

Zero-fill orders cannot be retrieved 10 minutes after order cancellation

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.getDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

cancelDeliveryOrder

DeliveryOrder cancelDeliveryOrder(settle, orderId)

Cancel single order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "12345"; // String | ID returned when order is successfully createdtry {
DeliveryOrderresult = apiInstance.cancelDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

DeliveryOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

getMyDeliveryTrades

List<DeliveryMyTrade> getMyDeliveryTrades(settle).contract(contract).order(order).limit(limit).offset(offset).lastId(lastId).countTotal(countTotal).execute();

Query personal trading records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractLongorder = 12345L; // Long | Futures order ID, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0StringlastId = "12345"; // String | Use the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be usedIntegercountTotal = 0; // Integer | Whether to return total number matched, defaults to 0 (no return)try {
List<DeliveryMyTrade> result = apiInstance.getMyDeliveryTrades(settle)
.contract(contract)
.order(order)
.limit(limit)
.offset(offset)
.lastId(lastId)
.countTotal(countTotal)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getMyDeliveryTrades");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
orderLongFutures order ID, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]
lastIdStringUse the ID of the last record in the previous list as the starting point for the next list Operations based on custom IDs can only be checked when orders are pending. After orders are completed (filled/cancelled), they can be checked within 1 hour after completion. After expiration, only order IDs can be used[optional]
countTotalIntegerWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0] [enum: 0, 1]

Return type

List<DeliveryMyTrade>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully* X-Pagination-Limit - Limit specified for pagination
* X-Pagination-Offset - Offset specified for pagination
* X-Pagination-Total - Total number matched, only returned if `count_total` is set to 1

listDeliveryPositionClose

List<DeliveryPositionClose> listDeliveryPositionClose(settle).contract(contract).limit(limit).execute();

Query position close history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listtry {
List<DeliveryPositionClose> result = apiInstance.listDeliveryPositionClose(settle)
.contract(contract)
.limit(limit)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryPositionClose");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]

Return type

List<DeliveryPositionClose>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryLiquidates

List<DeliveryLiquidate> listDeliveryLiquidates(settle).contract(contract).limit(limit).at(at).execute();

Query liquidation history

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify liquidation timestamptry {
List<DeliveryLiquidate> result = apiInstance.listDeliveryLiquidates(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryLiquidates");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify liquidation timestamp[optional] [default to 0]

Return type

List<DeliveryLiquidate>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliverySettlements

List<DeliverySettlement> listDeliverySettlements(settle).contract(contract).limit(limit).at(at).execute();

Query settlement records

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegerat = 0; // Integer | Specify settlement timestamptry {
List<DeliverySettlement> result = apiInstance.listDeliverySettlements(settle)
.contract(contract)
.limit(limit)
.at(at)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliverySettlements");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
atIntegerSpecify settlement timestamp[optional] [default to 0]

Return type

List<DeliverySettlement>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

listDeliveryRiskLimitTiers

List<DeliveryLimitRiskTiers> listDeliveryRiskLimitTiers(settle).contract(contract).limit(limit).offset(offset).execute();

Query 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.

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT_20200814"; // String | Futures contractIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<DeliveryLimitRiskTiers> result = apiInstance.listDeliveryRiskLimitTiers(settle)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listDeliveryRiskLimitTiers");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<DeliveryLimitRiskTiers>

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

listPriceTriggeredDeliveryOrders

List<FuturesPriceTriggeredOrder> listPriceTriggeredDeliveryOrders(settle, status).contract(contract).limit(limit).offset(offset).execute();

Query auto order list

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringstatus = "status_example"; // String | Query order list based on statusStringcontract = "BTC_USDT"; // String | Futures contract, return related data only if specifiedIntegerlimit = 100; // Integer | Maximum number of records returned in a single listIntegeroffset = 0; // Integer | List offset, starting from 0try {
List<FuturesPriceTriggeredOrder> result = apiInstance.listPriceTriggeredDeliveryOrders(settle, status)
.contract(contract)
.limit(limit)
.offset(offset)
.execute();
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#listPriceTriggeredDeliveryOrders");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
statusStringQuery order list based on status[enum: open, finished]
contractStringFutures contract, return related data only if specified[optional]
limitIntegerMaximum number of records returned in a single list[optional] [default to 100]
offsetIntegerList offset, starting from 0[optional] [default to 0]

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

createPriceTriggeredDeliveryOrder

TriggerOrderResponse createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder)

Create price-triggered order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyFuturesPriceTriggeredOrderfuturesPriceTriggeredOrder = newFuturesPriceTriggeredOrder(); // FuturesPriceTriggeredOrder | try {
TriggerOrderResponseresult = apiInstance.createPriceTriggeredDeliveryOrder(settle, futuresPriceTriggeredOrder);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#createPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
futuresPriceTriggeredOrderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

cancelPriceTriggeredDeliveryOrderList

List<FuturesPriceTriggeredOrder> cancelPriceTriggeredDeliveryOrderList(settle, contract)

Cancel all auto orders

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringcontract = "BTC_USDT"; // String | Futures contracttry {
List<FuturesPriceTriggeredOrder> result = apiInstance.cancelPriceTriggeredDeliveryOrderList(settle, contract);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrderList");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
contractStringFutures contract

Return type

List<FuturesPriceTriggeredOrder>

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancel request is received and processed. Success is determined based on the order list-

getPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder getPriceTriggeredDeliveryOrder(settle, orderId)

Query single auto order details

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.getPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#getPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-

cancelPriceTriggeredDeliveryOrder

FuturesPriceTriggeredOrder cancelPriceTriggeredDeliveryOrder(settle, orderId)

Cancel single auto order

Example

// Import classes:importio.gate.gateapi.ApiClient;
importio.gate.gateapi.ApiException;
importio.gate.gateapi.Configuration;
importio.gate.gateapi.GateApiException;
importio.gate.gateapi.auth.*;
importio.gate.gateapi.models.*;
importio.gate.gateapi.api.DeliveryApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.gateio.ws/api/v4");
// Configure APIv4 authorization: apiv4defaultClient.setApiKeySecret("YOUR_API_KEY", "YOUR_API_SECRET");
DeliveryApiapiInstance = newDeliveryApi(defaultClient);
Stringsettle = "usdt"; // String | Settle currencyStringorderId = "orderId_example"; // String | ID returned when order is successfully createdtry {
FuturesPriceTriggeredOrderresult = apiInstance.cancelPriceTriggeredDeliveryOrder(settle, orderId);
System.out.println(result);
} catch (GateApiExceptione) {
System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage()));
e.printStackTrace();
} catch (ApiExceptione) {
System.err.println("Exception when calling DeliveryApi#cancelPriceTriggeredDeliveryOrder");
System.err.println("Status code: " + e.getCode());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Parameters

NameTypeDescriptionNotes
settleStringSettle currency[enum: usdt]
orderIdStringID returned when order is successfully created

Return type

FuturesPriceTriggeredOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Auto order details-