Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

Latest commit

History

History
2050 lines (1554 loc) · 77.8 KB

File metadata and controls

2050 lines (1554 loc) · 77.8 KB

gate_api.DeliveryApi

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

MethodHTTP requestDescription
list_delivery_contractsGET /delivery/{settle}/contractsQuery all futures contracts
get_delivery_contractGET /delivery/{settle}/contracts/{contract}Query single contract information
list_delivery_order_bookGET /delivery/{settle}/order_bookQuery futures market depth information
list_delivery_tradesGET /delivery/{settle}/tradesFutures market transaction records
list_delivery_candlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
list_delivery_tickersGET /delivery/{settle}/tickersGet all futures trading statistics
list_delivery_insurance_ledgerGET /delivery/{settle}/insuranceFutures market insurance fund history
list_delivery_accountsGET /delivery/{settle}/accountsGet futures account
list_delivery_account_bookGET /delivery/{settle}/account_bookQuery futures account change history
list_delivery_positionsGET /delivery/{settle}/positionsGet user position list
get_delivery_positionGET /delivery/{settle}/positions/{contract}Get single position information
update_delivery_position_marginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
update_delivery_position_leveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
update_delivery_position_risk_limitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
list_delivery_ordersGET /delivery/{settle}/ordersQuery futures order list
create_delivery_orderPOST /delivery/{settle}/ordersPlace futures order
cancel_delivery_ordersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
get_delivery_orderGET /delivery/{settle}/orders/{order_id}Query single order details
cancel_delivery_orderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
get_my_delivery_tradesGET /delivery/{settle}/my_tradesQuery personal trading records
list_delivery_position_closeGET /delivery/{settle}/position_closeQuery position close history
list_delivery_liquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
list_delivery_settlementsGET /delivery/{settle}/settlementsQuery settlement records
list_delivery_risk_limit_tiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
list_price_triggered_delivery_ordersGET /delivery/{settle}/price_ordersQuery auto order list
create_price_triggered_delivery_orderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancel_price_triggered_delivery_order_listDELETE /delivery/{settle}/price_ordersCancel all auto orders
get_price_triggered_delivery_orderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancel_price_triggered_delivery_orderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

list_delivery_contracts

list[DeliveryContract] list_delivery_contracts(settle)

Query all futures contracts

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Query all futures contractsapi_response=api_instance.list_delivery_contracts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

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-

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

get_delivery_contract

DeliveryContract get_delivery_contract(settle, contract)

Query single contract information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Query single contract informationapi_response=api_instance.get_delivery_contract(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_order_book

FuturesOrderBook list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)

Query futures market depth information

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractinterval='0'# str | Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time depth changes (optional) (default to False)try:
# Query futures market depth informationapi_response=api_instance.list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
intervalstrPrice precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time depth changes[optional] [default to False]

Return type

FuturesOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_delivery_trades

list[FuturesTrade] list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)

Futures market transaction records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractlimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)last_id='12345'# str | 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 rang (optional)_from=1546905600# int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional)to=1546935600# int | Specify end time in Unix seconds, default to current time. (optional)try:
# Futures market transaction recordsapi_response=api_instance.list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
limitintMaximum number of records returned in a single list[optional] [default to 100]
last_idstrUse 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]
_fromintSpecify 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]
tointSpecify end time in Unix seconds, default to current time.[optional]

Return type

list[FuturesTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_candlesticks

list[DeliveryCandlestick] list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract_from=1546905600# int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)to=1546935600# int | 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 precision (optional)limit=100# int | 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. (optional) (default to 100)interval='5m'# str | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time (optional) (default to '5m')try:
# Futures market K-line chartapi_response=api_instance.list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
_fromintStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
tointSpecify 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]
limitintMaximum 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]
intervalstrTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to '5m']

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-

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

list_delivery_tickers

list[DeliveryTicker] list_delivery_tickers(settle, contract=contract)

Get all futures trading statistics

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)try:
# Get all futures trading statisticsapi_response=api_instance.list_delivery_tickers(settle, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_insurance_ledger

list[InsuranceRecord] list_delivery_insurance_ledger(settle, limit=limit)

Futures market insurance fund history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Futures market insurance fund historyapi_response=api_instance.list_delivery_insurance_ledger(settle, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_insurance_ledger: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum 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-

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

list_delivery_accounts

FuturesAccount list_delivery_accounts(settle)

Get futures account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get futures accountapi_response=api_instance.list_delivery_accounts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_accounts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

FuturesAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_account_book

list[FuturesAccountBook] list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)

Query futures account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | 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) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | 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 rebates (optional)try:
# Query futures account change historyapi_response=api_instance.list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart 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]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange 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]

Return type

list[FuturesAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_positions

list[Position] list_delivery_positions(settle)

Get user position list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get user position listapi_response=api_instance.list_delivery_positions(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

list[Position]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_delivery_position

Position get_delivery_position(settle, contract)

Get single position information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Get single position informationapi_response=api_instance.get_delivery_position(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_margin

Position update_delivery_position_margin(settle, contract, change)

Update position margin

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractchange='0.01'# str | Margin change amount, positive number increases, negative number decreasestry:
# Update position marginapi_response=api_instance.update_delivery_position_margin(settle, contract, change)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_margin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
changestrMargin change amount, positive number increases, negative number decreases

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_leverage

Position update_delivery_position_leverage(settle, contract, leverage)

Update position leverage

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractleverage='10'# str | New position leveragetry:
# Update position leverageapi_response=api_instance.update_delivery_position_leverage(settle, contract, leverage)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_leverage: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
leveragestrNew position leverage

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_risk_limit

Position update_delivery_position_risk_limit(settle, contract, risk_limit)

Update position risk limit

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractrisk_limit='10'# str | New position risk limittry:
# Update position risk limitapi_response=api_instance.update_delivery_position_risk_limit(settle, contract, risk_limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_risk_limit: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
risk_limitstrNew position risk limit

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

list_delivery_orders

list[FuturesOrder] list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query futures order list

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='open'# str | Query order list based on statuscontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query futures order listapi_response=api_instance.list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[FuturesOrder]

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

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

create_delivery_order

FuturesOrder create_delivery_order(settle, futures_order)

Place futures order

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_order=gate_api.FuturesOrder() # FuturesOrder | try:
# Place futures orderapi_response=api_instance.create_delivery_order(settle, futures_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_orderFuturesOrder

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

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

cancel_delivery_orders

list[FuturesOrder] cancel_delivery_orders(settle, contract, side=side)

Cancel all orders with 'open' status

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractside='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_delivery_orders(settle, contract, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[FuturesOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_delivery_order

FuturesOrder get_delivery_order(settle, order_id)

Query single order details

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

cancel_delivery_order

FuturesOrder cancel_delivery_order(settle, order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

get_my_delivery_trades

list[MyFuturesTrade] get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)order=12345# int | Futures order ID, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query personal trading recordsapi_response=api_instance.get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_my_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
orderintFutures order ID, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[MyFuturesTrade]

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

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

list_delivery_position_close

list[PositionClose] list_delivery_position_close(settle, contract=contract, limit=limit)

Query position close history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Query position close historyapi_response=api_instance.list_delivery_position_close(settle, contract=contract, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[PositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_liquidates

list[FuturesLiquidate] list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)

Query liquidation history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify liquidation timestamp (optional) (default to 0)try:
# Query liquidation historyapi_response=api_instance.list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_liquidates: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify liquidation timestamp[optional] [default to 0]

Return type

list[FuturesLiquidate]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_settlements

list[DeliverySettlement] list_delivery_settlements(settle, contract=contract, limit=limit, at=at)

Query settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify settlement timestamp (optional) (default to 0)try:
# Query settlement recordsapi_response=api_instance.list_delivery_settlements(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify 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-

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

list_delivery_risk_limit_tiers

list[FuturesLimitRiskTiers] list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query risk limit tiersapi_response=api_instance.list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_risk_limit_tiers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]

Return type

list[FuturesLimitRiskTiers]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_price_triggered_delivery_orders

list[FuturesPriceTriggeredOrder] list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)

Query auto order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='status_example'# str | Query order list based on statuscontract='BTC_USDT'# str | Futures contract, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query auto order listapi_response=api_instance.list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_price_triggered_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList 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-

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

create_price_triggered_delivery_order

TriggerOrderResponse create_price_triggered_delivery_order(settle, futures_price_triggered_order)

Create price-triggered order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_price_triggered_order=gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | try:
# Create price-triggered orderapi_response=api_instance.create_price_triggered_delivery_order(settle, futures_price_triggered_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_price_triggered_orderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

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

cancel_price_triggered_delivery_order_list

list[FuturesPriceTriggeredOrder] cancel_price_triggered_delivery_order_list(settle, contract)

Cancel all auto orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT'# str | Futures contracttry:
# Cancel all auto ordersapi_response=api_instance.cancel_price_triggered_delivery_order_list(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

list[FuturesPriceTriggeredOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation request accepted and processed, success determined by order list-

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

get_price_triggered_delivery_order

FuturesPriceTriggeredOrder get_price_triggered_delivery_order(settle, order_id)

Query single auto order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Query single auto order detailsapi_response=api_instance.get_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

cancel_price_triggered_delivery_order

FuturesPriceTriggeredOrder cancel_price_triggered_delivery_order(settle, order_id)

Cancel single auto order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Cancel single auto orderapi_response=api_instance.cancel_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
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;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
gateapi-python/docs/DeliveryApi.md at master · gateio/gateapi-python · GitHub
Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

Latest commit

History

History
2050 lines (1554 loc) · 77.8 KB

File metadata and controls

2050 lines (1554 loc) · 77.8 KB

gate_api.DeliveryApi

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

MethodHTTP requestDescription
list_delivery_contractsGET /delivery/{settle}/contractsQuery all futures contracts
get_delivery_contractGET /delivery/{settle}/contracts/{contract}Query single contract information
list_delivery_order_bookGET /delivery/{settle}/order_bookQuery futures market depth information
list_delivery_tradesGET /delivery/{settle}/tradesFutures market transaction records
list_delivery_candlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
list_delivery_tickersGET /delivery/{settle}/tickersGet all futures trading statistics
list_delivery_insurance_ledgerGET /delivery/{settle}/insuranceFutures market insurance fund history
list_delivery_accountsGET /delivery/{settle}/accountsGet futures account
list_delivery_account_bookGET /delivery/{settle}/account_bookQuery futures account change history
list_delivery_positionsGET /delivery/{settle}/positionsGet user position list
get_delivery_positionGET /delivery/{settle}/positions/{contract}Get single position information
update_delivery_position_marginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
update_delivery_position_leveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
update_delivery_position_risk_limitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
list_delivery_ordersGET /delivery/{settle}/ordersQuery futures order list
create_delivery_orderPOST /delivery/{settle}/ordersPlace futures order
cancel_delivery_ordersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
get_delivery_orderGET /delivery/{settle}/orders/{order_id}Query single order details
cancel_delivery_orderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
get_my_delivery_tradesGET /delivery/{settle}/my_tradesQuery personal trading records
list_delivery_position_closeGET /delivery/{settle}/position_closeQuery position close history
list_delivery_liquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
list_delivery_settlementsGET /delivery/{settle}/settlementsQuery settlement records
list_delivery_risk_limit_tiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
list_price_triggered_delivery_ordersGET /delivery/{settle}/price_ordersQuery auto order list
create_price_triggered_delivery_orderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancel_price_triggered_delivery_order_listDELETE /delivery/{settle}/price_ordersCancel all auto orders
get_price_triggered_delivery_orderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancel_price_triggered_delivery_orderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

list_delivery_contracts

list[DeliveryContract] list_delivery_contracts(settle)

Query all futures contracts

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Query all futures contractsapi_response=api_instance.list_delivery_contracts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

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-

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

get_delivery_contract

DeliveryContract get_delivery_contract(settle, contract)

Query single contract information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Query single contract informationapi_response=api_instance.get_delivery_contract(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_order_book

FuturesOrderBook list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)

Query futures market depth information

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractinterval='0'# str | Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time depth changes (optional) (default to False)try:
# Query futures market depth informationapi_response=api_instance.list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
intervalstrPrice precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time depth changes[optional] [default to False]

Return type

FuturesOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_delivery_trades

list[FuturesTrade] list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)

Futures market transaction records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractlimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)last_id='12345'# str | 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 rang (optional)_from=1546905600# int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional)to=1546935600# int | Specify end time in Unix seconds, default to current time. (optional)try:
# Futures market transaction recordsapi_response=api_instance.list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
limitintMaximum number of records returned in a single list[optional] [default to 100]
last_idstrUse 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]
_fromintSpecify 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]
tointSpecify end time in Unix seconds, default to current time.[optional]

Return type

list[FuturesTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_candlesticks

list[DeliveryCandlestick] list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract_from=1546905600# int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)to=1546935600# int | 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 precision (optional)limit=100# int | 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. (optional) (default to 100)interval='5m'# str | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time (optional) (default to '5m')try:
# Futures market K-line chartapi_response=api_instance.list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
_fromintStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
tointSpecify 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]
limitintMaximum 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]
intervalstrTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to '5m']

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-

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

list_delivery_tickers

list[DeliveryTicker] list_delivery_tickers(settle, contract=contract)

Get all futures trading statistics

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)try:
# Get all futures trading statisticsapi_response=api_instance.list_delivery_tickers(settle, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_insurance_ledger

list[InsuranceRecord] list_delivery_insurance_ledger(settle, limit=limit)

Futures market insurance fund history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Futures market insurance fund historyapi_response=api_instance.list_delivery_insurance_ledger(settle, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_insurance_ledger: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum 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-

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

list_delivery_accounts

FuturesAccount list_delivery_accounts(settle)

Get futures account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get futures accountapi_response=api_instance.list_delivery_accounts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_accounts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

FuturesAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_account_book

list[FuturesAccountBook] list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)

Query futures account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | 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) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | 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 rebates (optional)try:
# Query futures account change historyapi_response=api_instance.list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart 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]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange 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]

Return type

list[FuturesAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_positions

list[Position] list_delivery_positions(settle)

Get user position list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get user position listapi_response=api_instance.list_delivery_positions(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

list[Position]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_delivery_position

Position get_delivery_position(settle, contract)

Get single position information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Get single position informationapi_response=api_instance.get_delivery_position(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_margin

Position update_delivery_position_margin(settle, contract, change)

Update position margin

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractchange='0.01'# str | Margin change amount, positive number increases, negative number decreasestry:
# Update position marginapi_response=api_instance.update_delivery_position_margin(settle, contract, change)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_margin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
changestrMargin change amount, positive number increases, negative number decreases

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_leverage

Position update_delivery_position_leverage(settle, contract, leverage)

Update position leverage

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractleverage='10'# str | New position leveragetry:
# Update position leverageapi_response=api_instance.update_delivery_position_leverage(settle, contract, leverage)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_leverage: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
leveragestrNew position leverage

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_risk_limit

Position update_delivery_position_risk_limit(settle, contract, risk_limit)

Update position risk limit

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractrisk_limit='10'# str | New position risk limittry:
# Update position risk limitapi_response=api_instance.update_delivery_position_risk_limit(settle, contract, risk_limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_risk_limit: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
risk_limitstrNew position risk limit

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

list_delivery_orders

list[FuturesOrder] list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query futures order list

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='open'# str | Query order list based on statuscontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query futures order listapi_response=api_instance.list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[FuturesOrder]

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

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

create_delivery_order

FuturesOrder create_delivery_order(settle, futures_order)

Place futures order

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_order=gate_api.FuturesOrder() # FuturesOrder | try:
# Place futures orderapi_response=api_instance.create_delivery_order(settle, futures_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_orderFuturesOrder

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

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

cancel_delivery_orders

list[FuturesOrder] cancel_delivery_orders(settle, contract, side=side)

Cancel all orders with 'open' status

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractside='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_delivery_orders(settle, contract, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[FuturesOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_delivery_order

FuturesOrder get_delivery_order(settle, order_id)

Query single order details

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

cancel_delivery_order

FuturesOrder cancel_delivery_order(settle, order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

get_my_delivery_trades

list[MyFuturesTrade] get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)order=12345# int | Futures order ID, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query personal trading recordsapi_response=api_instance.get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_my_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
orderintFutures order ID, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[MyFuturesTrade]

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

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

list_delivery_position_close

list[PositionClose] list_delivery_position_close(settle, contract=contract, limit=limit)

Query position close history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Query position close historyapi_response=api_instance.list_delivery_position_close(settle, contract=contract, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[PositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_liquidates

list[FuturesLiquidate] list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)

Query liquidation history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify liquidation timestamp (optional) (default to 0)try:
# Query liquidation historyapi_response=api_instance.list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_liquidates: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify liquidation timestamp[optional] [default to 0]

Return type

list[FuturesLiquidate]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_settlements

list[DeliverySettlement] list_delivery_settlements(settle, contract=contract, limit=limit, at=at)

Query settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify settlement timestamp (optional) (default to 0)try:
# Query settlement recordsapi_response=api_instance.list_delivery_settlements(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify 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-

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

list_delivery_risk_limit_tiers

list[FuturesLimitRiskTiers] list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query risk limit tiersapi_response=api_instance.list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_risk_limit_tiers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]

Return type

list[FuturesLimitRiskTiers]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_price_triggered_delivery_orders

list[FuturesPriceTriggeredOrder] list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)

Query auto order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='status_example'# str | Query order list based on statuscontract='BTC_USDT'# str | Futures contract, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query auto order listapi_response=api_instance.list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_price_triggered_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList 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-

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

create_price_triggered_delivery_order

TriggerOrderResponse create_price_triggered_delivery_order(settle, futures_price_triggered_order)

Create price-triggered order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_price_triggered_order=gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | try:
# Create price-triggered orderapi_response=api_instance.create_price_triggered_delivery_order(settle, futures_price_triggered_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_price_triggered_orderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

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

cancel_price_triggered_delivery_order_list

list[FuturesPriceTriggeredOrder] cancel_price_triggered_delivery_order_list(settle, contract)

Cancel all auto orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT'# str | Futures contracttry:
# Cancel all auto ordersapi_response=api_instance.cancel_price_triggered_delivery_order_list(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

list[FuturesPriceTriggeredOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation request accepted and processed, success determined by order list-

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

get_price_triggered_delivery_order

FuturesPriceTriggeredOrder get_price_triggered_delivery_order(settle, order_id)

Query single auto order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Query single auto order detailsapi_response=api_instance.get_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

cancel_price_triggered_delivery_order

FuturesPriceTriggeredOrder cancel_price_triggered_delivery_order(settle, order_id)

Cancel single auto order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Cancel single auto orderapi_response=api_instance.cancel_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' gateapi-python/docs/DeliveryApi.md at master · gateio/gateapi-python · GitHub
Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

Latest commit

History

History
2050 lines (1554 loc) · 77.8 KB

File metadata and controls

2050 lines (1554 loc) · 77.8 KB

gate_api.DeliveryApi

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

MethodHTTP requestDescription
list_delivery_contractsGET /delivery/{settle}/contractsQuery all futures contracts
get_delivery_contractGET /delivery/{settle}/contracts/{contract}Query single contract information
list_delivery_order_bookGET /delivery/{settle}/order_bookQuery futures market depth information
list_delivery_tradesGET /delivery/{settle}/tradesFutures market transaction records
list_delivery_candlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
list_delivery_tickersGET /delivery/{settle}/tickersGet all futures trading statistics
list_delivery_insurance_ledgerGET /delivery/{settle}/insuranceFutures market insurance fund history
list_delivery_accountsGET /delivery/{settle}/accountsGet futures account
list_delivery_account_bookGET /delivery/{settle}/account_bookQuery futures account change history
list_delivery_positionsGET /delivery/{settle}/positionsGet user position list
get_delivery_positionGET /delivery/{settle}/positions/{contract}Get single position information
update_delivery_position_marginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
update_delivery_position_leveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
update_delivery_position_risk_limitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
list_delivery_ordersGET /delivery/{settle}/ordersQuery futures order list
create_delivery_orderPOST /delivery/{settle}/ordersPlace futures order
cancel_delivery_ordersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
get_delivery_orderGET /delivery/{settle}/orders/{order_id}Query single order details
cancel_delivery_orderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
get_my_delivery_tradesGET /delivery/{settle}/my_tradesQuery personal trading records
list_delivery_position_closeGET /delivery/{settle}/position_closeQuery position close history
list_delivery_liquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
list_delivery_settlementsGET /delivery/{settle}/settlementsQuery settlement records
list_delivery_risk_limit_tiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
list_price_triggered_delivery_ordersGET /delivery/{settle}/price_ordersQuery auto order list
create_price_triggered_delivery_orderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancel_price_triggered_delivery_order_listDELETE /delivery/{settle}/price_ordersCancel all auto orders
get_price_triggered_delivery_orderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancel_price_triggered_delivery_orderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

list_delivery_contracts

list[DeliveryContract] list_delivery_contracts(settle)

Query all futures contracts

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Query all futures contractsapi_response=api_instance.list_delivery_contracts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

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-

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

get_delivery_contract

DeliveryContract get_delivery_contract(settle, contract)

Query single contract information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Query single contract informationapi_response=api_instance.get_delivery_contract(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_order_book

FuturesOrderBook list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)

Query futures market depth information

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractinterval='0'# str | Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time depth changes (optional) (default to False)try:
# Query futures market depth informationapi_response=api_instance.list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
intervalstrPrice precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time depth changes[optional] [default to False]

Return type

FuturesOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_delivery_trades

list[FuturesTrade] list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)

Futures market transaction records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractlimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)last_id='12345'# str | 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 rang (optional)_from=1546905600# int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional)to=1546935600# int | Specify end time in Unix seconds, default to current time. (optional)try:
# Futures market transaction recordsapi_response=api_instance.list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
limitintMaximum number of records returned in a single list[optional] [default to 100]
last_idstrUse 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]
_fromintSpecify 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]
tointSpecify end time in Unix seconds, default to current time.[optional]

Return type

list[FuturesTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_candlesticks

list[DeliveryCandlestick] list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract_from=1546905600# int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)to=1546935600# int | 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 precision (optional)limit=100# int | 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. (optional) (default to 100)interval='5m'# str | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time (optional) (default to '5m')try:
# Futures market K-line chartapi_response=api_instance.list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
_fromintStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
tointSpecify 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]
limitintMaximum 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]
intervalstrTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to '5m']

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-

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

list_delivery_tickers

list[DeliveryTicker] list_delivery_tickers(settle, contract=contract)

Get all futures trading statistics

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)try:
# Get all futures trading statisticsapi_response=api_instance.list_delivery_tickers(settle, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_insurance_ledger

list[InsuranceRecord] list_delivery_insurance_ledger(settle, limit=limit)

Futures market insurance fund history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Futures market insurance fund historyapi_response=api_instance.list_delivery_insurance_ledger(settle, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_insurance_ledger: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum 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-

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

list_delivery_accounts

FuturesAccount list_delivery_accounts(settle)

Get futures account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get futures accountapi_response=api_instance.list_delivery_accounts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_accounts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

FuturesAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_account_book

list[FuturesAccountBook] list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)

Query futures account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | 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) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | 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 rebates (optional)try:
# Query futures account change historyapi_response=api_instance.list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart 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]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange 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]

Return type

list[FuturesAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_positions

list[Position] list_delivery_positions(settle)

Get user position list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get user position listapi_response=api_instance.list_delivery_positions(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

list[Position]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_delivery_position

Position get_delivery_position(settle, contract)

Get single position information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Get single position informationapi_response=api_instance.get_delivery_position(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_margin

Position update_delivery_position_margin(settle, contract, change)

Update position margin

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractchange='0.01'# str | Margin change amount, positive number increases, negative number decreasestry:
# Update position marginapi_response=api_instance.update_delivery_position_margin(settle, contract, change)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_margin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
changestrMargin change amount, positive number increases, negative number decreases

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_leverage

Position update_delivery_position_leverage(settle, contract, leverage)

Update position leverage

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractleverage='10'# str | New position leveragetry:
# Update position leverageapi_response=api_instance.update_delivery_position_leverage(settle, contract, leverage)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_leverage: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
leveragestrNew position leverage

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_risk_limit

Position update_delivery_position_risk_limit(settle, contract, risk_limit)

Update position risk limit

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractrisk_limit='10'# str | New position risk limittry:
# Update position risk limitapi_response=api_instance.update_delivery_position_risk_limit(settle, contract, risk_limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_risk_limit: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
risk_limitstrNew position risk limit

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

list_delivery_orders

list[FuturesOrder] list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query futures order list

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='open'# str | Query order list based on statuscontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query futures order listapi_response=api_instance.list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[FuturesOrder]

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

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

create_delivery_order

FuturesOrder create_delivery_order(settle, futures_order)

Place futures order

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_order=gate_api.FuturesOrder() # FuturesOrder | try:
# Place futures orderapi_response=api_instance.create_delivery_order(settle, futures_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_orderFuturesOrder

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

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

cancel_delivery_orders

list[FuturesOrder] cancel_delivery_orders(settle, contract, side=side)

Cancel all orders with 'open' status

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractside='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_delivery_orders(settle, contract, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[FuturesOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_delivery_order

FuturesOrder get_delivery_order(settle, order_id)

Query single order details

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

cancel_delivery_order

FuturesOrder cancel_delivery_order(settle, order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

get_my_delivery_trades

list[MyFuturesTrade] get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)order=12345# int | Futures order ID, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query personal trading recordsapi_response=api_instance.get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_my_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
orderintFutures order ID, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[MyFuturesTrade]

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

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

list_delivery_position_close

list[PositionClose] list_delivery_position_close(settle, contract=contract, limit=limit)

Query position close history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Query position close historyapi_response=api_instance.list_delivery_position_close(settle, contract=contract, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[PositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_liquidates

list[FuturesLiquidate] list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)

Query liquidation history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify liquidation timestamp (optional) (default to 0)try:
# Query liquidation historyapi_response=api_instance.list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_liquidates: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify liquidation timestamp[optional] [default to 0]

Return type

list[FuturesLiquidate]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_settlements

list[DeliverySettlement] list_delivery_settlements(settle, contract=contract, limit=limit, at=at)

Query settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify settlement timestamp (optional) (default to 0)try:
# Query settlement recordsapi_response=api_instance.list_delivery_settlements(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify 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-

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

list_delivery_risk_limit_tiers

list[FuturesLimitRiskTiers] list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query risk limit tiersapi_response=api_instance.list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_risk_limit_tiers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]

Return type

list[FuturesLimitRiskTiers]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_price_triggered_delivery_orders

list[FuturesPriceTriggeredOrder] list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)

Query auto order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='status_example'# str | Query order list based on statuscontract='BTC_USDT'# str | Futures contract, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query auto order listapi_response=api_instance.list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_price_triggered_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList 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-

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

create_price_triggered_delivery_order

TriggerOrderResponse create_price_triggered_delivery_order(settle, futures_price_triggered_order)

Create price-triggered order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_price_triggered_order=gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | try:
# Create price-triggered orderapi_response=api_instance.create_price_triggered_delivery_order(settle, futures_price_triggered_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_price_triggered_orderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

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

cancel_price_triggered_delivery_order_list

list[FuturesPriceTriggeredOrder] cancel_price_triggered_delivery_order_list(settle, contract)

Cancel all auto orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT'# str | Futures contracttry:
# Cancel all auto ordersapi_response=api_instance.cancel_price_triggered_delivery_order_list(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

list[FuturesPriceTriggeredOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation request accepted and processed, success determined by order list-

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

get_price_triggered_delivery_order

FuturesPriceTriggeredOrder get_price_triggered_delivery_order(settle, order_id)

Query single auto order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Query single auto order detailsapi_response=api_instance.get_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

cancel_price_triggered_delivery_order

FuturesPriceTriggeredOrder cancel_price_triggered_delivery_order(settle, order_id)

Cancel single auto order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Cancel single auto orderapi_response=api_instance.cancel_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

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

Latest commit

History

History
2050 lines (1554 loc) · 77.8 KB

File metadata and controls

2050 lines (1554 loc) · 77.8 KB

gate_api.DeliveryApi

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

MethodHTTP requestDescription
list_delivery_contractsGET /delivery/{settle}/contractsQuery all futures contracts
get_delivery_contractGET /delivery/{settle}/contracts/{contract}Query single contract information
list_delivery_order_bookGET /delivery/{settle}/order_bookQuery futures market depth information
list_delivery_tradesGET /delivery/{settle}/tradesFutures market transaction records
list_delivery_candlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
list_delivery_tickersGET /delivery/{settle}/tickersGet all futures trading statistics
list_delivery_insurance_ledgerGET /delivery/{settle}/insuranceFutures market insurance fund history
list_delivery_accountsGET /delivery/{settle}/accountsGet futures account
list_delivery_account_bookGET /delivery/{settle}/account_bookQuery futures account change history
list_delivery_positionsGET /delivery/{settle}/positionsGet user position list
get_delivery_positionGET /delivery/{settle}/positions/{contract}Get single position information
update_delivery_position_marginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
update_delivery_position_leveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
update_delivery_position_risk_limitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
list_delivery_ordersGET /delivery/{settle}/ordersQuery futures order list
create_delivery_orderPOST /delivery/{settle}/ordersPlace futures order
cancel_delivery_ordersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
get_delivery_orderGET /delivery/{settle}/orders/{order_id}Query single order details
cancel_delivery_orderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
get_my_delivery_tradesGET /delivery/{settle}/my_tradesQuery personal trading records
list_delivery_position_closeGET /delivery/{settle}/position_closeQuery position close history
list_delivery_liquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
list_delivery_settlementsGET /delivery/{settle}/settlementsQuery settlement records
list_delivery_risk_limit_tiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
list_price_triggered_delivery_ordersGET /delivery/{settle}/price_ordersQuery auto order list
create_price_triggered_delivery_orderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancel_price_triggered_delivery_order_listDELETE /delivery/{settle}/price_ordersCancel all auto orders
get_price_triggered_delivery_orderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancel_price_triggered_delivery_orderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

list_delivery_contracts

list[DeliveryContract] list_delivery_contracts(settle)

Query all futures contracts

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Query all futures contractsapi_response=api_instance.list_delivery_contracts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

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-

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

get_delivery_contract

DeliveryContract get_delivery_contract(settle, contract)

Query single contract information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Query single contract informationapi_response=api_instance.get_delivery_contract(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_order_book

FuturesOrderBook list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)

Query futures market depth information

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractinterval='0'# str | Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time depth changes (optional) (default to False)try:
# Query futures market depth informationapi_response=api_instance.list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
intervalstrPrice precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time depth changes[optional] [default to False]

Return type

FuturesOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_delivery_trades

list[FuturesTrade] list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)

Futures market transaction records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractlimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)last_id='12345'# str | 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 rang (optional)_from=1546905600# int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional)to=1546935600# int | Specify end time in Unix seconds, default to current time. (optional)try:
# Futures market transaction recordsapi_response=api_instance.list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
limitintMaximum number of records returned in a single list[optional] [default to 100]
last_idstrUse 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]
_fromintSpecify 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]
tointSpecify end time in Unix seconds, default to current time.[optional]

Return type

list[FuturesTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_candlesticks

list[DeliveryCandlestick] list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract_from=1546905600# int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)to=1546935600# int | 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 precision (optional)limit=100# int | 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. (optional) (default to 100)interval='5m'# str | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time (optional) (default to '5m')try:
# Futures market K-line chartapi_response=api_instance.list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
_fromintStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
tointSpecify 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]
limitintMaximum 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]
intervalstrTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to '5m']

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-

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

list_delivery_tickers

list[DeliveryTicker] list_delivery_tickers(settle, contract=contract)

Get all futures trading statistics

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)try:
# Get all futures trading statisticsapi_response=api_instance.list_delivery_tickers(settle, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_insurance_ledger

list[InsuranceRecord] list_delivery_insurance_ledger(settle, limit=limit)

Futures market insurance fund history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Futures market insurance fund historyapi_response=api_instance.list_delivery_insurance_ledger(settle, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_insurance_ledger: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum 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-

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

list_delivery_accounts

FuturesAccount list_delivery_accounts(settle)

Get futures account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get futures accountapi_response=api_instance.list_delivery_accounts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_accounts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

FuturesAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_account_book

list[FuturesAccountBook] list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)

Query futures account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | 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) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | 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 rebates (optional)try:
# Query futures account change historyapi_response=api_instance.list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart 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]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange 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]

Return type

list[FuturesAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_positions

list[Position] list_delivery_positions(settle)

Get user position list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get user position listapi_response=api_instance.list_delivery_positions(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

list[Position]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_delivery_position

Position get_delivery_position(settle, contract)

Get single position information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Get single position informationapi_response=api_instance.get_delivery_position(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_margin

Position update_delivery_position_margin(settle, contract, change)

Update position margin

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractchange='0.01'# str | Margin change amount, positive number increases, negative number decreasestry:
# Update position marginapi_response=api_instance.update_delivery_position_margin(settle, contract, change)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_margin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
changestrMargin change amount, positive number increases, negative number decreases

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_leverage

Position update_delivery_position_leverage(settle, contract, leverage)

Update position leverage

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractleverage='10'# str | New position leveragetry:
# Update position leverageapi_response=api_instance.update_delivery_position_leverage(settle, contract, leverage)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_leverage: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
leveragestrNew position leverage

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_risk_limit

Position update_delivery_position_risk_limit(settle, contract, risk_limit)

Update position risk limit

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractrisk_limit='10'# str | New position risk limittry:
# Update position risk limitapi_response=api_instance.update_delivery_position_risk_limit(settle, contract, risk_limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_risk_limit: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
risk_limitstrNew position risk limit

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

list_delivery_orders

list[FuturesOrder] list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query futures order list

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='open'# str | Query order list based on statuscontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query futures order listapi_response=api_instance.list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[FuturesOrder]

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

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

create_delivery_order

FuturesOrder create_delivery_order(settle, futures_order)

Place futures order

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_order=gate_api.FuturesOrder() # FuturesOrder | try:
# Place futures orderapi_response=api_instance.create_delivery_order(settle, futures_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_orderFuturesOrder

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

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

cancel_delivery_orders

list[FuturesOrder] cancel_delivery_orders(settle, contract, side=side)

Cancel all orders with 'open' status

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractside='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_delivery_orders(settle, contract, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[FuturesOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_delivery_order

FuturesOrder get_delivery_order(settle, order_id)

Query single order details

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

cancel_delivery_order

FuturesOrder cancel_delivery_order(settle, order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

get_my_delivery_trades

list[MyFuturesTrade] get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)order=12345# int | Futures order ID, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query personal trading recordsapi_response=api_instance.get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_my_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
orderintFutures order ID, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[MyFuturesTrade]

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

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

list_delivery_position_close

list[PositionClose] list_delivery_position_close(settle, contract=contract, limit=limit)

Query position close history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Query position close historyapi_response=api_instance.list_delivery_position_close(settle, contract=contract, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[PositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_liquidates

list[FuturesLiquidate] list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)

Query liquidation history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify liquidation timestamp (optional) (default to 0)try:
# Query liquidation historyapi_response=api_instance.list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_liquidates: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify liquidation timestamp[optional] [default to 0]

Return type

list[FuturesLiquidate]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_settlements

list[DeliverySettlement] list_delivery_settlements(settle, contract=contract, limit=limit, at=at)

Query settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify settlement timestamp (optional) (default to 0)try:
# Query settlement recordsapi_response=api_instance.list_delivery_settlements(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify 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-

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

list_delivery_risk_limit_tiers

list[FuturesLimitRiskTiers] list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query risk limit tiersapi_response=api_instance.list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_risk_limit_tiers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]

Return type

list[FuturesLimitRiskTiers]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_price_triggered_delivery_orders

list[FuturesPriceTriggeredOrder] list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)

Query auto order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='status_example'# str | Query order list based on statuscontract='BTC_USDT'# str | Futures contract, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query auto order listapi_response=api_instance.list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_price_triggered_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList 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-

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

create_price_triggered_delivery_order

TriggerOrderResponse create_price_triggered_delivery_order(settle, futures_price_triggered_order)

Create price-triggered order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_price_triggered_order=gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | try:
# Create price-triggered orderapi_response=api_instance.create_price_triggered_delivery_order(settle, futures_price_triggered_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_price_triggered_orderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

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

cancel_price_triggered_delivery_order_list

list[FuturesPriceTriggeredOrder] cancel_price_triggered_delivery_order_list(settle, contract)

Cancel all auto orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT'# str | Futures contracttry:
# Cancel all auto ordersapi_response=api_instance.cancel_price_triggered_delivery_order_list(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

list[FuturesPriceTriggeredOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation request accepted and processed, success determined by order list-

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

get_price_triggered_delivery_order

FuturesPriceTriggeredOrder get_price_triggered_delivery_order(settle, order_id)

Query single auto order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Query single auto order detailsapi_response=api_instance.get_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

cancel_price_triggered_delivery_order

FuturesPriceTriggeredOrder cancel_price_triggered_delivery_order(settle, order_id)

Cancel single auto order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Cancel single auto orderapi_response=api_instance.cancel_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' gateapi-python/docs/DeliveryApi.md at master · gateio/gateapi-python · GitHub
Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

Latest commit

History

History
2050 lines (1554 loc) · 77.8 KB

File metadata and controls

2050 lines (1554 loc) · 77.8 KB

gate_api.DeliveryApi

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

MethodHTTP requestDescription
list_delivery_contractsGET /delivery/{settle}/contractsQuery all futures contracts
get_delivery_contractGET /delivery/{settle}/contracts/{contract}Query single contract information
list_delivery_order_bookGET /delivery/{settle}/order_bookQuery futures market depth information
list_delivery_tradesGET /delivery/{settle}/tradesFutures market transaction records
list_delivery_candlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
list_delivery_tickersGET /delivery/{settle}/tickersGet all futures trading statistics
list_delivery_insurance_ledgerGET /delivery/{settle}/insuranceFutures market insurance fund history
list_delivery_accountsGET /delivery/{settle}/accountsGet futures account
list_delivery_account_bookGET /delivery/{settle}/account_bookQuery futures account change history
list_delivery_positionsGET /delivery/{settle}/positionsGet user position list
get_delivery_positionGET /delivery/{settle}/positions/{contract}Get single position information
update_delivery_position_marginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
update_delivery_position_leveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
update_delivery_position_risk_limitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
list_delivery_ordersGET /delivery/{settle}/ordersQuery futures order list
create_delivery_orderPOST /delivery/{settle}/ordersPlace futures order
cancel_delivery_ordersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
get_delivery_orderGET /delivery/{settle}/orders/{order_id}Query single order details
cancel_delivery_orderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
get_my_delivery_tradesGET /delivery/{settle}/my_tradesQuery personal trading records
list_delivery_position_closeGET /delivery/{settle}/position_closeQuery position close history
list_delivery_liquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
list_delivery_settlementsGET /delivery/{settle}/settlementsQuery settlement records
list_delivery_risk_limit_tiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
list_price_triggered_delivery_ordersGET /delivery/{settle}/price_ordersQuery auto order list
create_price_triggered_delivery_orderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancel_price_triggered_delivery_order_listDELETE /delivery/{settle}/price_ordersCancel all auto orders
get_price_triggered_delivery_orderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancel_price_triggered_delivery_orderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

list_delivery_contracts

list[DeliveryContract] list_delivery_contracts(settle)

Query all futures contracts

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Query all futures contractsapi_response=api_instance.list_delivery_contracts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

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-

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

get_delivery_contract

DeliveryContract get_delivery_contract(settle, contract)

Query single contract information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Query single contract informationapi_response=api_instance.get_delivery_contract(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_order_book

FuturesOrderBook list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)

Query futures market depth information

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractinterval='0'# str | Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time depth changes (optional) (default to False)try:
# Query futures market depth informationapi_response=api_instance.list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
intervalstrPrice precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time depth changes[optional] [default to False]

Return type

FuturesOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_delivery_trades

list[FuturesTrade] list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)

Futures market transaction records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractlimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)last_id='12345'# str | 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 rang (optional)_from=1546905600# int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional)to=1546935600# int | Specify end time in Unix seconds, default to current time. (optional)try:
# Futures market transaction recordsapi_response=api_instance.list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
limitintMaximum number of records returned in a single list[optional] [default to 100]
last_idstrUse 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]
_fromintSpecify 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]
tointSpecify end time in Unix seconds, default to current time.[optional]

Return type

list[FuturesTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_candlesticks

list[DeliveryCandlestick] list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract_from=1546905600# int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)to=1546935600# int | 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 precision (optional)limit=100# int | 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. (optional) (default to 100)interval='5m'# str | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time (optional) (default to '5m')try:
# Futures market K-line chartapi_response=api_instance.list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
_fromintStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
tointSpecify 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]
limitintMaximum 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]
intervalstrTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to '5m']

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-

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

list_delivery_tickers

list[DeliveryTicker] list_delivery_tickers(settle, contract=contract)

Get all futures trading statistics

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)try:
# Get all futures trading statisticsapi_response=api_instance.list_delivery_tickers(settle, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_insurance_ledger

list[InsuranceRecord] list_delivery_insurance_ledger(settle, limit=limit)

Futures market insurance fund history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Futures market insurance fund historyapi_response=api_instance.list_delivery_insurance_ledger(settle, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_insurance_ledger: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum 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-

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

list_delivery_accounts

FuturesAccount list_delivery_accounts(settle)

Get futures account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get futures accountapi_response=api_instance.list_delivery_accounts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_accounts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

FuturesAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_account_book

list[FuturesAccountBook] list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)

Query futures account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | 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) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | 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 rebates (optional)try:
# Query futures account change historyapi_response=api_instance.list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart 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]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange 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]

Return type

list[FuturesAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_positions

list[Position] list_delivery_positions(settle)

Get user position list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get user position listapi_response=api_instance.list_delivery_positions(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

list[Position]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_delivery_position

Position get_delivery_position(settle, contract)

Get single position information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Get single position informationapi_response=api_instance.get_delivery_position(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_margin

Position update_delivery_position_margin(settle, contract, change)

Update position margin

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractchange='0.01'# str | Margin change amount, positive number increases, negative number decreasestry:
# Update position marginapi_response=api_instance.update_delivery_position_margin(settle, contract, change)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_margin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
changestrMargin change amount, positive number increases, negative number decreases

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_leverage

Position update_delivery_position_leverage(settle, contract, leverage)

Update position leverage

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractleverage='10'# str | New position leveragetry:
# Update position leverageapi_response=api_instance.update_delivery_position_leverage(settle, contract, leverage)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_leverage: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
leveragestrNew position leverage

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_risk_limit

Position update_delivery_position_risk_limit(settle, contract, risk_limit)

Update position risk limit

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractrisk_limit='10'# str | New position risk limittry:
# Update position risk limitapi_response=api_instance.update_delivery_position_risk_limit(settle, contract, risk_limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_risk_limit: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
risk_limitstrNew position risk limit

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

list_delivery_orders

list[FuturesOrder] list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query futures order list

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='open'# str | Query order list based on statuscontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query futures order listapi_response=api_instance.list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[FuturesOrder]

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

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

create_delivery_order

FuturesOrder create_delivery_order(settle, futures_order)

Place futures order

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_order=gate_api.FuturesOrder() # FuturesOrder | try:
# Place futures orderapi_response=api_instance.create_delivery_order(settle, futures_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_orderFuturesOrder

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

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

cancel_delivery_orders

list[FuturesOrder] cancel_delivery_orders(settle, contract, side=side)

Cancel all orders with 'open' status

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractside='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_delivery_orders(settle, contract, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[FuturesOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_delivery_order

FuturesOrder get_delivery_order(settle, order_id)

Query single order details

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

cancel_delivery_order

FuturesOrder cancel_delivery_order(settle, order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

get_my_delivery_trades

list[MyFuturesTrade] get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)order=12345# int | Futures order ID, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query personal trading recordsapi_response=api_instance.get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_my_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
orderintFutures order ID, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[MyFuturesTrade]

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

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

list_delivery_position_close

list[PositionClose] list_delivery_position_close(settle, contract=contract, limit=limit)

Query position close history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Query position close historyapi_response=api_instance.list_delivery_position_close(settle, contract=contract, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[PositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_liquidates

list[FuturesLiquidate] list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)

Query liquidation history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify liquidation timestamp (optional) (default to 0)try:
# Query liquidation historyapi_response=api_instance.list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_liquidates: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify liquidation timestamp[optional] [default to 0]

Return type

list[FuturesLiquidate]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_settlements

list[DeliverySettlement] list_delivery_settlements(settle, contract=contract, limit=limit, at=at)

Query settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify settlement timestamp (optional) (default to 0)try:
# Query settlement recordsapi_response=api_instance.list_delivery_settlements(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify 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-

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

list_delivery_risk_limit_tiers

list[FuturesLimitRiskTiers] list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query risk limit tiersapi_response=api_instance.list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_risk_limit_tiers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]

Return type

list[FuturesLimitRiskTiers]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_price_triggered_delivery_orders

list[FuturesPriceTriggeredOrder] list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)

Query auto order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='status_example'# str | Query order list based on statuscontract='BTC_USDT'# str | Futures contract, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query auto order listapi_response=api_instance.list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_price_triggered_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList 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-

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

create_price_triggered_delivery_order

TriggerOrderResponse create_price_triggered_delivery_order(settle, futures_price_triggered_order)

Create price-triggered order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_price_triggered_order=gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | try:
# Create price-triggered orderapi_response=api_instance.create_price_triggered_delivery_order(settle, futures_price_triggered_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_price_triggered_orderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

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

cancel_price_triggered_delivery_order_list

list[FuturesPriceTriggeredOrder] cancel_price_triggered_delivery_order_list(settle, contract)

Cancel all auto orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT'# str | Futures contracttry:
# Cancel all auto ordersapi_response=api_instance.cancel_price_triggered_delivery_order_list(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

list[FuturesPriceTriggeredOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation request accepted and processed, success determined by order list-

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

get_price_triggered_delivery_order

FuturesPriceTriggeredOrder get_price_triggered_delivery_order(settle, order_id)

Query single auto order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Query single auto order detailsapi_response=api_instance.get_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

cancel_price_triggered_delivery_order

FuturesPriceTriggeredOrder cancel_price_triggered_delivery_order(settle, order_id)

Cancel single auto order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Cancel single auto orderapi_response=api_instance.cancel_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' gateapi-python/docs/DeliveryApi.md at master · gateio/gateapi-python · GitHub
Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

Latest commit

History

History
2050 lines (1554 loc) · 77.8 KB

File metadata and controls

2050 lines (1554 loc) · 77.8 KB

gate_api.DeliveryApi

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

MethodHTTP requestDescription
list_delivery_contractsGET /delivery/{settle}/contractsQuery all futures contracts
get_delivery_contractGET /delivery/{settle}/contracts/{contract}Query single contract information
list_delivery_order_bookGET /delivery/{settle}/order_bookQuery futures market depth information
list_delivery_tradesGET /delivery/{settle}/tradesFutures market transaction records
list_delivery_candlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
list_delivery_tickersGET /delivery/{settle}/tickersGet all futures trading statistics
list_delivery_insurance_ledgerGET /delivery/{settle}/insuranceFutures market insurance fund history
list_delivery_accountsGET /delivery/{settle}/accountsGet futures account
list_delivery_account_bookGET /delivery/{settle}/account_bookQuery futures account change history
list_delivery_positionsGET /delivery/{settle}/positionsGet user position list
get_delivery_positionGET /delivery/{settle}/positions/{contract}Get single position information
update_delivery_position_marginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
update_delivery_position_leveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
update_delivery_position_risk_limitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
list_delivery_ordersGET /delivery/{settle}/ordersQuery futures order list
create_delivery_orderPOST /delivery/{settle}/ordersPlace futures order
cancel_delivery_ordersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
get_delivery_orderGET /delivery/{settle}/orders/{order_id}Query single order details
cancel_delivery_orderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
get_my_delivery_tradesGET /delivery/{settle}/my_tradesQuery personal trading records
list_delivery_position_closeGET /delivery/{settle}/position_closeQuery position close history
list_delivery_liquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
list_delivery_settlementsGET /delivery/{settle}/settlementsQuery settlement records
list_delivery_risk_limit_tiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
list_price_triggered_delivery_ordersGET /delivery/{settle}/price_ordersQuery auto order list
create_price_triggered_delivery_orderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancel_price_triggered_delivery_order_listDELETE /delivery/{settle}/price_ordersCancel all auto orders
get_price_triggered_delivery_orderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancel_price_triggered_delivery_orderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

list_delivery_contracts

list[DeliveryContract] list_delivery_contracts(settle)

Query all futures contracts

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Query all futures contractsapi_response=api_instance.list_delivery_contracts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

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-

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

get_delivery_contract

DeliveryContract get_delivery_contract(settle, contract)

Query single contract information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Query single contract informationapi_response=api_instance.get_delivery_contract(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_order_book

FuturesOrderBook list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)

Query futures market depth information

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractinterval='0'# str | Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time depth changes (optional) (default to False)try:
# Query futures market depth informationapi_response=api_instance.list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
intervalstrPrice precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time depth changes[optional] [default to False]

Return type

FuturesOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_delivery_trades

list[FuturesTrade] list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)

Futures market transaction records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractlimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)last_id='12345'# str | 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 rang (optional)_from=1546905600# int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional)to=1546935600# int | Specify end time in Unix seconds, default to current time. (optional)try:
# Futures market transaction recordsapi_response=api_instance.list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
limitintMaximum number of records returned in a single list[optional] [default to 100]
last_idstrUse 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]
_fromintSpecify 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]
tointSpecify end time in Unix seconds, default to current time.[optional]

Return type

list[FuturesTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_candlesticks

list[DeliveryCandlestick] list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract_from=1546905600# int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)to=1546935600# int | 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 precision (optional)limit=100# int | 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. (optional) (default to 100)interval='5m'# str | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time (optional) (default to '5m')try:
# Futures market K-line chartapi_response=api_instance.list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
_fromintStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
tointSpecify 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]
limitintMaximum 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]
intervalstrTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to '5m']

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-

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

list_delivery_tickers

list[DeliveryTicker] list_delivery_tickers(settle, contract=contract)

Get all futures trading statistics

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)try:
# Get all futures trading statisticsapi_response=api_instance.list_delivery_tickers(settle, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_insurance_ledger

list[InsuranceRecord] list_delivery_insurance_ledger(settle, limit=limit)

Futures market insurance fund history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Futures market insurance fund historyapi_response=api_instance.list_delivery_insurance_ledger(settle, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_insurance_ledger: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum 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-

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

list_delivery_accounts

FuturesAccount list_delivery_accounts(settle)

Get futures account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get futures accountapi_response=api_instance.list_delivery_accounts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_accounts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

FuturesAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_account_book

list[FuturesAccountBook] list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)

Query futures account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | 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) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | 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 rebates (optional)try:
# Query futures account change historyapi_response=api_instance.list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart 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]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange 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]

Return type

list[FuturesAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_positions

list[Position] list_delivery_positions(settle)

Get user position list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get user position listapi_response=api_instance.list_delivery_positions(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

list[Position]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_delivery_position

Position get_delivery_position(settle, contract)

Get single position information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Get single position informationapi_response=api_instance.get_delivery_position(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_margin

Position update_delivery_position_margin(settle, contract, change)

Update position margin

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractchange='0.01'# str | Margin change amount, positive number increases, negative number decreasestry:
# Update position marginapi_response=api_instance.update_delivery_position_margin(settle, contract, change)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_margin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
changestrMargin change amount, positive number increases, negative number decreases

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_leverage

Position update_delivery_position_leverage(settle, contract, leverage)

Update position leverage

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractleverage='10'# str | New position leveragetry:
# Update position leverageapi_response=api_instance.update_delivery_position_leverage(settle, contract, leverage)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_leverage: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
leveragestrNew position leverage

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_risk_limit

Position update_delivery_position_risk_limit(settle, contract, risk_limit)

Update position risk limit

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractrisk_limit='10'# str | New position risk limittry:
# Update position risk limitapi_response=api_instance.update_delivery_position_risk_limit(settle, contract, risk_limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_risk_limit: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
risk_limitstrNew position risk limit

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

list_delivery_orders

list[FuturesOrder] list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query futures order list

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='open'# str | Query order list based on statuscontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query futures order listapi_response=api_instance.list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[FuturesOrder]

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

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

create_delivery_order

FuturesOrder create_delivery_order(settle, futures_order)

Place futures order

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_order=gate_api.FuturesOrder() # FuturesOrder | try:
# Place futures orderapi_response=api_instance.create_delivery_order(settle, futures_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_orderFuturesOrder

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

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

cancel_delivery_orders

list[FuturesOrder] cancel_delivery_orders(settle, contract, side=side)

Cancel all orders with 'open' status

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractside='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_delivery_orders(settle, contract, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[FuturesOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_delivery_order

FuturesOrder get_delivery_order(settle, order_id)

Query single order details

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

cancel_delivery_order

FuturesOrder cancel_delivery_order(settle, order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

get_my_delivery_trades

list[MyFuturesTrade] get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)order=12345# int | Futures order ID, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query personal trading recordsapi_response=api_instance.get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_my_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
orderintFutures order ID, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[MyFuturesTrade]

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

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

list_delivery_position_close

list[PositionClose] list_delivery_position_close(settle, contract=contract, limit=limit)

Query position close history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Query position close historyapi_response=api_instance.list_delivery_position_close(settle, contract=contract, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[PositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_liquidates

list[FuturesLiquidate] list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)

Query liquidation history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify liquidation timestamp (optional) (default to 0)try:
# Query liquidation historyapi_response=api_instance.list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_liquidates: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify liquidation timestamp[optional] [default to 0]

Return type

list[FuturesLiquidate]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_settlements

list[DeliverySettlement] list_delivery_settlements(settle, contract=contract, limit=limit, at=at)

Query settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify settlement timestamp (optional) (default to 0)try:
# Query settlement recordsapi_response=api_instance.list_delivery_settlements(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify 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-

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

list_delivery_risk_limit_tiers

list[FuturesLimitRiskTiers] list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query risk limit tiersapi_response=api_instance.list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_risk_limit_tiers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]

Return type

list[FuturesLimitRiskTiers]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_price_triggered_delivery_orders

list[FuturesPriceTriggeredOrder] list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)

Query auto order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='status_example'# str | Query order list based on statuscontract='BTC_USDT'# str | Futures contract, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query auto order listapi_response=api_instance.list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_price_triggered_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList 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-

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

create_price_triggered_delivery_order

TriggerOrderResponse create_price_triggered_delivery_order(settle, futures_price_triggered_order)

Create price-triggered order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_price_triggered_order=gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | try:
# Create price-triggered orderapi_response=api_instance.create_price_triggered_delivery_order(settle, futures_price_triggered_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_price_triggered_orderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

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

cancel_price_triggered_delivery_order_list

list[FuturesPriceTriggeredOrder] cancel_price_triggered_delivery_order_list(settle, contract)

Cancel all auto orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT'# str | Futures contracttry:
# Cancel all auto ordersapi_response=api_instance.cancel_price_triggered_delivery_order_list(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

list[FuturesPriceTriggeredOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation request accepted and processed, success determined by order list-

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

get_price_triggered_delivery_order

FuturesPriceTriggeredOrder get_price_triggered_delivery_order(settle, order_id)

Query single auto order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Query single auto order detailsapi_response=api_instance.get_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

cancel_price_triggered_delivery_order

FuturesPriceTriggeredOrder cancel_price_triggered_delivery_order(settle, order_id)

Cancel single auto order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Cancel single auto orderapi_response=api_instance.cancel_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' gateapi-python/docs/DeliveryApi.md at master · gateio/gateapi-python · GitHub
Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

Latest commit

History

History
2050 lines (1554 loc) · 77.8 KB

File metadata and controls

2050 lines (1554 loc) · 77.8 KB

gate_api.DeliveryApi

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

MethodHTTP requestDescription
list_delivery_contractsGET /delivery/{settle}/contractsQuery all futures contracts
get_delivery_contractGET /delivery/{settle}/contracts/{contract}Query single contract information
list_delivery_order_bookGET /delivery/{settle}/order_bookQuery futures market depth information
list_delivery_tradesGET /delivery/{settle}/tradesFutures market transaction records
list_delivery_candlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
list_delivery_tickersGET /delivery/{settle}/tickersGet all futures trading statistics
list_delivery_insurance_ledgerGET /delivery/{settle}/insuranceFutures market insurance fund history
list_delivery_accountsGET /delivery/{settle}/accountsGet futures account
list_delivery_account_bookGET /delivery/{settle}/account_bookQuery futures account change history
list_delivery_positionsGET /delivery/{settle}/positionsGet user position list
get_delivery_positionGET /delivery/{settle}/positions/{contract}Get single position information
update_delivery_position_marginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
update_delivery_position_leveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
update_delivery_position_risk_limitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
list_delivery_ordersGET /delivery/{settle}/ordersQuery futures order list
create_delivery_orderPOST /delivery/{settle}/ordersPlace futures order
cancel_delivery_ordersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
get_delivery_orderGET /delivery/{settle}/orders/{order_id}Query single order details
cancel_delivery_orderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
get_my_delivery_tradesGET /delivery/{settle}/my_tradesQuery personal trading records
list_delivery_position_closeGET /delivery/{settle}/position_closeQuery position close history
list_delivery_liquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
list_delivery_settlementsGET /delivery/{settle}/settlementsQuery settlement records
list_delivery_risk_limit_tiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
list_price_triggered_delivery_ordersGET /delivery/{settle}/price_ordersQuery auto order list
create_price_triggered_delivery_orderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancel_price_triggered_delivery_order_listDELETE /delivery/{settle}/price_ordersCancel all auto orders
get_price_triggered_delivery_orderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancel_price_triggered_delivery_orderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

list_delivery_contracts

list[DeliveryContract] list_delivery_contracts(settle)

Query all futures contracts

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Query all futures contractsapi_response=api_instance.list_delivery_contracts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

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-

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

get_delivery_contract

DeliveryContract get_delivery_contract(settle, contract)

Query single contract information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Query single contract informationapi_response=api_instance.get_delivery_contract(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_order_book

FuturesOrderBook list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)

Query futures market depth information

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractinterval='0'# str | Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time depth changes (optional) (default to False)try:
# Query futures market depth informationapi_response=api_instance.list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
intervalstrPrice precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time depth changes[optional] [default to False]

Return type

FuturesOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_delivery_trades

list[FuturesTrade] list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)

Futures market transaction records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractlimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)last_id='12345'# str | 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 rang (optional)_from=1546905600# int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional)to=1546935600# int | Specify end time in Unix seconds, default to current time. (optional)try:
# Futures market transaction recordsapi_response=api_instance.list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
limitintMaximum number of records returned in a single list[optional] [default to 100]
last_idstrUse 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]
_fromintSpecify 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]
tointSpecify end time in Unix seconds, default to current time.[optional]

Return type

list[FuturesTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_candlesticks

list[DeliveryCandlestick] list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract_from=1546905600# int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)to=1546935600# int | 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 precision (optional)limit=100# int | 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. (optional) (default to 100)interval='5m'# str | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time (optional) (default to '5m')try:
# Futures market K-line chartapi_response=api_instance.list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
_fromintStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
tointSpecify 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]
limitintMaximum 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]
intervalstrTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to '5m']

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-

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

list_delivery_tickers

list[DeliveryTicker] list_delivery_tickers(settle, contract=contract)

Get all futures trading statistics

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)try:
# Get all futures trading statisticsapi_response=api_instance.list_delivery_tickers(settle, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_insurance_ledger

list[InsuranceRecord] list_delivery_insurance_ledger(settle, limit=limit)

Futures market insurance fund history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Futures market insurance fund historyapi_response=api_instance.list_delivery_insurance_ledger(settle, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_insurance_ledger: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum 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-

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

list_delivery_accounts

FuturesAccount list_delivery_accounts(settle)

Get futures account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get futures accountapi_response=api_instance.list_delivery_accounts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_accounts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

FuturesAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_account_book

list[FuturesAccountBook] list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)

Query futures account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | 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) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | 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 rebates (optional)try:
# Query futures account change historyapi_response=api_instance.list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart 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]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange 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]

Return type

list[FuturesAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_positions

list[Position] list_delivery_positions(settle)

Get user position list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get user position listapi_response=api_instance.list_delivery_positions(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

list[Position]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_delivery_position

Position get_delivery_position(settle, contract)

Get single position information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Get single position informationapi_response=api_instance.get_delivery_position(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_margin

Position update_delivery_position_margin(settle, contract, change)

Update position margin

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractchange='0.01'# str | Margin change amount, positive number increases, negative number decreasestry:
# Update position marginapi_response=api_instance.update_delivery_position_margin(settle, contract, change)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_margin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
changestrMargin change amount, positive number increases, negative number decreases

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_leverage

Position update_delivery_position_leverage(settle, contract, leverage)

Update position leverage

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractleverage='10'# str | New position leveragetry:
# Update position leverageapi_response=api_instance.update_delivery_position_leverage(settle, contract, leverage)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_leverage: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
leveragestrNew position leverage

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_risk_limit

Position update_delivery_position_risk_limit(settle, contract, risk_limit)

Update position risk limit

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractrisk_limit='10'# str | New position risk limittry:
# Update position risk limitapi_response=api_instance.update_delivery_position_risk_limit(settle, contract, risk_limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_risk_limit: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
risk_limitstrNew position risk limit

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

list_delivery_orders

list[FuturesOrder] list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query futures order list

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='open'# str | Query order list based on statuscontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query futures order listapi_response=api_instance.list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[FuturesOrder]

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

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

create_delivery_order

FuturesOrder create_delivery_order(settle, futures_order)

Place futures order

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_order=gate_api.FuturesOrder() # FuturesOrder | try:
# Place futures orderapi_response=api_instance.create_delivery_order(settle, futures_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_orderFuturesOrder

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

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

cancel_delivery_orders

list[FuturesOrder] cancel_delivery_orders(settle, contract, side=side)

Cancel all orders with 'open' status

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractside='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_delivery_orders(settle, contract, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[FuturesOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_delivery_order

FuturesOrder get_delivery_order(settle, order_id)

Query single order details

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

cancel_delivery_order

FuturesOrder cancel_delivery_order(settle, order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

get_my_delivery_trades

list[MyFuturesTrade] get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)order=12345# int | Futures order ID, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query personal trading recordsapi_response=api_instance.get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_my_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
orderintFutures order ID, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[MyFuturesTrade]

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

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

list_delivery_position_close

list[PositionClose] list_delivery_position_close(settle, contract=contract, limit=limit)

Query position close history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Query position close historyapi_response=api_instance.list_delivery_position_close(settle, contract=contract, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[PositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_liquidates

list[FuturesLiquidate] list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)

Query liquidation history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify liquidation timestamp (optional) (default to 0)try:
# Query liquidation historyapi_response=api_instance.list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_liquidates: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify liquidation timestamp[optional] [default to 0]

Return type

list[FuturesLiquidate]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_settlements

list[DeliverySettlement] list_delivery_settlements(settle, contract=contract, limit=limit, at=at)

Query settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify settlement timestamp (optional) (default to 0)try:
# Query settlement recordsapi_response=api_instance.list_delivery_settlements(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify 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-

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

list_delivery_risk_limit_tiers

list[FuturesLimitRiskTiers] list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query risk limit tiersapi_response=api_instance.list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_risk_limit_tiers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]

Return type

list[FuturesLimitRiskTiers]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_price_triggered_delivery_orders

list[FuturesPriceTriggeredOrder] list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)

Query auto order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='status_example'# str | Query order list based on statuscontract='BTC_USDT'# str | Futures contract, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query auto order listapi_response=api_instance.list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_price_triggered_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList 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-

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

create_price_triggered_delivery_order

TriggerOrderResponse create_price_triggered_delivery_order(settle, futures_price_triggered_order)

Create price-triggered order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_price_triggered_order=gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | try:
# Create price-triggered orderapi_response=api_instance.create_price_triggered_delivery_order(settle, futures_price_triggered_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_price_triggered_orderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

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

cancel_price_triggered_delivery_order_list

list[FuturesPriceTriggeredOrder] cancel_price_triggered_delivery_order_list(settle, contract)

Cancel all auto orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT'# str | Futures contracttry:
# Cancel all auto ordersapi_response=api_instance.cancel_price_triggered_delivery_order_list(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

list[FuturesPriceTriggeredOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation request accepted and processed, success determined by order list-

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

get_price_triggered_delivery_order

FuturesPriceTriggeredOrder get_price_triggered_delivery_order(settle, order_id)

Query single auto order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Query single auto order detailsapi_response=api_instance.get_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

cancel_price_triggered_delivery_order

FuturesPriceTriggeredOrder cancel_price_triggered_delivery_order(settle, order_id)

Cancel single auto order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Cancel single auto orderapi_response=api_instance.cancel_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

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

Latest commit

History

History
2050 lines (1554 loc) · 77.8 KB

File metadata and controls

2050 lines (1554 loc) · 77.8 KB

gate_api.DeliveryApi

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

MethodHTTP requestDescription
list_delivery_contractsGET /delivery/{settle}/contractsQuery all futures contracts
get_delivery_contractGET /delivery/{settle}/contracts/{contract}Query single contract information
list_delivery_order_bookGET /delivery/{settle}/order_bookQuery futures market depth information
list_delivery_tradesGET /delivery/{settle}/tradesFutures market transaction records
list_delivery_candlesticksGET /delivery/{settle}/candlesticksFutures market K-line chart
list_delivery_tickersGET /delivery/{settle}/tickersGet all futures trading statistics
list_delivery_insurance_ledgerGET /delivery/{settle}/insuranceFutures market insurance fund history
list_delivery_accountsGET /delivery/{settle}/accountsGet futures account
list_delivery_account_bookGET /delivery/{settle}/account_bookQuery futures account change history
list_delivery_positionsGET /delivery/{settle}/positionsGet user position list
get_delivery_positionGET /delivery/{settle}/positions/{contract}Get single position information
update_delivery_position_marginPOST /delivery/{settle}/positions/{contract}/marginUpdate position margin
update_delivery_position_leveragePOST /delivery/{settle}/positions/{contract}/leverageUpdate position leverage
update_delivery_position_risk_limitPOST /delivery/{settle}/positions/{contract}/risk_limitUpdate position risk limit
list_delivery_ordersGET /delivery/{settle}/ordersQuery futures order list
create_delivery_orderPOST /delivery/{settle}/ordersPlace futures order
cancel_delivery_ordersDELETE /delivery/{settle}/ordersCancel all orders with 'open' status
get_delivery_orderGET /delivery/{settle}/orders/{order_id}Query single order details
cancel_delivery_orderDELETE /delivery/{settle}/orders/{order_id}Cancel single order
get_my_delivery_tradesGET /delivery/{settle}/my_tradesQuery personal trading records
list_delivery_position_closeGET /delivery/{settle}/position_closeQuery position close history
list_delivery_liquidatesGET /delivery/{settle}/liquidatesQuery liquidation history
list_delivery_settlementsGET /delivery/{settle}/settlementsQuery settlement records
list_delivery_risk_limit_tiersGET /delivery/{settle}/risk_limit_tiersQuery risk limit tiers
list_price_triggered_delivery_ordersGET /delivery/{settle}/price_ordersQuery auto order list
create_price_triggered_delivery_orderPOST /delivery/{settle}/price_ordersCreate price-triggered order
cancel_price_triggered_delivery_order_listDELETE /delivery/{settle}/price_ordersCancel all auto orders
get_price_triggered_delivery_orderGET /delivery/{settle}/price_orders/{order_id}Query single auto order details
cancel_price_triggered_delivery_orderDELETE /delivery/{settle}/price_orders/{order_id}Cancel single auto order

list_delivery_contracts

list[DeliveryContract] list_delivery_contracts(settle)

Query all futures contracts

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Query all futures contractsapi_response=api_instance.list_delivery_contracts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

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-

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

get_delivery_contract

DeliveryContract get_delivery_contract(settle, contract)

Query single contract information

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Query single contract informationapi_response=api_instance.get_delivery_contract(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_contract: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_order_book

FuturesOrderBook list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)

Query futures market depth information

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

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractinterval='0'# str | Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified (optional) (default to '0')limit=10# int | Number of depth levels (optional) (default to 10)with_id=False# bool | Whether to return depth update ID. This ID increments by 1 each time depth changes (optional) (default to False)try:
# Query futures market depth informationapi_response=api_instance.list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_order_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
intervalstrPrice precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified[optional] [default to '0']
limitintNumber of depth levels[optional] [default to 10]
with_idboolWhether to return depth update ID. This ID increments by 1 each time depth changes[optional] [default to False]

Return type

FuturesOrderBook

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Depth query successful-

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

list_delivery_trades

list[FuturesTrade] list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)

Futures market transaction records

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractlimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)last_id='12345'# str | 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 rang (optional)_from=1546905600# int | Specify starting time in Unix seconds. If not specified, `to` and `limit` will be used to limit response items. If items between `from` and `to` are more than `limit`, only `limit` number will be returned. (optional)to=1546935600# int | Specify end time in Unix seconds, default to current time. (optional)try:
# Futures market transaction recordsapi_response=api_instance.list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
limitintMaximum number of records returned in a single list[optional] [default to 100]
last_idstrUse 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]
_fromintSpecify 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]
tointSpecify end time in Unix seconds, default to current time.[optional]

Return type

list[FuturesTrade]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_candlesticks

list[DeliveryCandlestick] list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract_from=1546905600# int | Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified (optional)to=1546935600# int | 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 precision (optional)limit=100# int | 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. (optional) (default to 100)interval='5m'# str | Time interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time (optional) (default to '5m')try:
# Futures market K-line chartapi_response=api_instance.list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_candlesticks: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
_fromintStart time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified[optional]
tointSpecify 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]
limitintMaximum 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]
intervalstrTime interval between data points, note that 1w represents a natural week, 7d time is aligned with Unix initial time[optional] [default to '5m']

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-

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

list_delivery_tickers

list[DeliveryTicker] list_delivery_tickers(settle, contract=contract)

Get all futures trading statistics

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)try:
# Get all futures trading statisticsapi_response=api_instance.list_delivery_tickers(settle, contract=contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_tickers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures 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-

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

list_delivery_insurance_ledger

list[InsuranceRecord] list_delivery_insurance_ledger(settle, limit=limit)

Futures market insurance fund history

Example

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Futures market insurance fund historyapi_response=api_instance.list_delivery_insurance_ledger(settle, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_insurance_ledger: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum 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-

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

list_delivery_accounts

FuturesAccount list_delivery_accounts(settle)

Get futures account

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get futures accountapi_response=api_instance.list_delivery_accounts(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_accounts: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

FuturesAccount

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_account_book

list[FuturesAccountBook] list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)

Query futures account change history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencylimit=100# int | Maximum number of records returned in a single list (optional) (default to 100)_from=1547706332# int | 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) (optional)to=1547706332# int | Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp (optional)type='dnw'# str | 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 rebates (optional)try:
# Query futures account change historyapi_response=api_instance.list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_account_book: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
limitintMaximum number of records returned in a single list[optional] [default to 100]
_fromintStart 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]
tointTermination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp[optional]
typestrChange 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]

Return type

list[FuturesAccountBook]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_positions

list[Position] list_delivery_positions(settle)

Get user position list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencytry:
# Get user position listapi_response=api_instance.list_delivery_positions(settle)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_positions: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency

Return type

list[Position]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

get_delivery_position

Position get_delivery_position(settle, contract)

Get single position information

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contracttry:
# Get single position informationapi_response=api_instance.get_delivery_position(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_position: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_margin

Position update_delivery_position_margin(settle, contract, change)

Update position margin

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractchange='0.01'# str | Margin change amount, positive number increases, negative number decreasestry:
# Update position marginapi_response=api_instance.update_delivery_position_margin(settle, contract, change)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_margin: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
changestrMargin change amount, positive number increases, negative number decreases

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_leverage

Position update_delivery_position_leverage(settle, contract, leverage)

Update position leverage

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractleverage='10'# str | New position leveragetry:
# Update position leverageapi_response=api_instance.update_delivery_position_leverage(settle, contract, leverage)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_leverage: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
leveragestrNew position leverage

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

update_delivery_position_risk_limit

Position update_delivery_position_risk_limit(settle, contract, risk_limit)

Update position risk limit

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractrisk_limit='10'# str | New position risk limittry:
# Update position risk limitapi_response=api_instance.update_delivery_position_risk_limit(settle, contract, risk_limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->update_delivery_position_risk_limit: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
risk_limitstrNew position risk limit

Return type

Position

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Position information-

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

list_delivery_orders

list[FuturesOrder] list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query futures order list

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='open'# str | Query order list based on statuscontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query futures order listapi_response=api_instance.list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[FuturesOrder]

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

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

create_delivery_order

FuturesOrder create_delivery_order(settle, futures_order)

Place futures order

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_order=gate_api.FuturesOrder() # FuturesOrder | try:
# Place futures orderapi_response=api_instance.create_delivery_order(settle, futures_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_orderFuturesOrder

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order details-

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

cancel_delivery_orders

list[FuturesOrder] cancel_delivery_orders(settle, contract, side=side)

Cancel all orders with 'open' status

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contractside='ask'# str | Specify all bids or all asks, both included if not specified (optional)try:
# Cancel all orders with 'open' statusapi_response=api_instance.cancel_delivery_orders(settle, contract, side=side)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract
sidestrSpecify all bids or all asks, both included if not specified[optional]

Return type

list[FuturesOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation successful-

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

get_delivery_order

FuturesOrder get_delivery_order(settle, order_id)

Query single order details

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

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Query single order detailsapi_response=api_instance.get_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

cancel_delivery_order

FuturesOrder cancel_delivery_order(settle, order_id)

Cancel single order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='12345'# str | ID returned when order is successfully createdtry:
# Cancel single orderapi_response=api_instance.cancel_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID returned when order is successfully created

Return type

FuturesOrder

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Order details-

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

get_my_delivery_trades

list[MyFuturesTrade] get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)

Query personal trading records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)order=12345# int | Futures order ID, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)last_id='12345'# str | 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 used (optional)count_total=0# int | Whether to return total number matched, defaults to 0 (no return) (optional) (default to 0)try:
# Query personal trading recordsapi_response=api_instance.get_my_delivery_trades(settle, contract=contract, order=order, limit=limit, offset=offset, last_id=last_id, count_total=count_total)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_my_delivery_trades: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
orderintFutures order ID, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]
last_idstrUse 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]
count_totalintWhether to return total number matched, defaults to 0 (no return)[optional] [default to 0]

Return type

list[MyFuturesTrade]

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

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

list_delivery_position_close

list[PositionClose] list_delivery_position_close(settle, contract=contract, limit=limit)

Query position close history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)try:
# Query position close historyapi_response=api_instance.list_delivery_position_close(settle, contract=contract, limit=limit)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_position_close: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]

Return type

list[PositionClose]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_liquidates

list[FuturesLiquidate] list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)

Query liquidation history

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify liquidation timestamp (optional) (default to 0)try:
# Query liquidation historyapi_response=api_instance.list_delivery_liquidates(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_liquidates: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify liquidation timestamp[optional] [default to 0]

Return type

list[FuturesLiquidate]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200List retrieved successfully-

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

list_delivery_settlements

list[DeliverySettlement] list_delivery_settlements(settle, contract=contract, limit=limit, at=at)

Query settlement records

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)at=0# int | Specify settlement timestamp (optional) (default to 0)try:
# Query settlement recordsapi_response=api_instance.list_delivery_settlements(settle, contract=contract, limit=limit, at=at)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_settlements: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
atintSpecify 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-

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

list_delivery_risk_limit_tiers

list[FuturesLimitRiskTiers] list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)

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

from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.configuration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT_20200814'# str | Futures contract (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query risk limit tiersapi_response=api_instance.list_delivery_risk_limit_tiers(settle, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_delivery_risk_limit_tiers: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList offset, starting from 0[optional] [default to 0]

Return type

list[FuturesLimitRiskTiers]

Authorization

No authorization required

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Query successful-

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

list_price_triggered_delivery_orders

list[FuturesPriceTriggeredOrder] list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)

Query auto order list

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencystatus='status_example'# str | Query order list based on statuscontract='BTC_USDT'# str | Futures contract, return related data only if specified (optional)limit=100# int | Maximum number of records returned in a single list (optional) (default to 100)offset=0# int | List offset, starting from 0 (optional) (default to 0)try:
# Query auto order listapi_response=api_instance.list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->list_price_triggered_delivery_orders: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
statusstrQuery order list based on status
contractstrFutures contract, return related data only if specified[optional]
limitintMaximum number of records returned in a single list[optional] [default to 100]
offsetintList 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-

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

create_price_triggered_delivery_order

TriggerOrderResponse create_price_triggered_delivery_order(settle, futures_price_triggered_order)

Create price-triggered order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyfutures_price_triggered_order=gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | try:
# Create price-triggered orderapi_response=api_instance.create_price_triggered_delivery_order(settle, futures_price_triggered_order)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->create_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
futures_price_triggered_orderFuturesPriceTriggeredOrder

Return type

TriggerOrderResponse

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
201Order created successfully-

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

cancel_price_triggered_delivery_order_list

list[FuturesPriceTriggeredOrder] cancel_price_triggered_delivery_order_list(settle, contract)

Cancel all auto orders

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencycontract='BTC_USDT'# str | Futures contracttry:
# Cancel all auto ordersapi_response=api_instance.cancel_price_triggered_delivery_order_list(settle, contract)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order_list: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
contractstrFutures contract

Return type

list[FuturesPriceTriggeredOrder]

Authorization

apiv4

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Batch cancellation request accepted and processed, success determined by order list-

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

get_price_triggered_delivery_order

FuturesPriceTriggeredOrder get_price_triggered_delivery_order(settle, order_id)

Query single auto order details

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Query single auto order detailsapi_response=api_instance.get_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->get_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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

cancel_price_triggered_delivery_order

FuturesPriceTriggeredOrder cancel_price_triggered_delivery_order(settle, order_id)

Cancel single auto order

Example

  • Api Key Authentication (apiv4):
from __future__ importprint_functionimportgate_apifromgate_api.exceptionsimportApiException, GateApiException# Defining the host is optional and defaults to https://api.gateio.ws/api/v4# See configuration.py for a list of all supported configuration parameters.# The client must configure the authentication and authorization parameters# in accordance with the API server security policy.# Examples for each auth method are provided below, use the example that# satisfies your auth use case.# Configure APIv4 key authorizationconfiguration=gate_api.Configuration(
host="https://api.gateio.ws/api/v4",
key="YOU_API_KEY",
secret="YOUR_API_SECRET"
)
api_client=gate_api.ApiClient(configuration)
# Create an instance of the API classapi_instance=gate_api.DeliveryApi(api_client)
settle='usdt'# str | Settle currencyorder_id='order_id_example'# str | ID returned when order is successfully createdtry:
# Cancel single auto orderapi_response=api_instance.cancel_price_triggered_delivery_order(settle, order_id)
print(api_response)
exceptGateApiExceptionasex:
print("Gate api exception, label: %s, message: %s\n"% (ex.label, ex.message))
exceptApiExceptionase:
print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order: %s\n"%e)

Parameters

NameTypeDescriptionNotes
settlestrSettle currency
order_idstrID 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-

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