# gate_api.DeliveryApi All URIs are relative to *https://api.gateio.ws/api/v4* Method | HTTP request | Description ------------- | ------------- | ------------- [**list_delivery_contracts**](DeliveryApi.md#list_delivery_contracts) | **GET** /delivery/{settle}/contracts | List all futures contracts [**get_delivery_contract**](DeliveryApi.md#get_delivery_contract) | **GET** /delivery/{settle}/contracts/{contract} | Get a single contract [**list_delivery_order_book**](DeliveryApi.md#list_delivery_order_book) | **GET** /delivery/{settle}/order_book | Futures order book [**list_delivery_trades**](DeliveryApi.md#list_delivery_trades) | **GET** /delivery/{settle}/trades | Futures trading history [**list_delivery_candlesticks**](DeliveryApi.md#list_delivery_candlesticks) | **GET** /delivery/{settle}/candlesticks | Get futures candlesticks [**list_delivery_tickers**](DeliveryApi.md#list_delivery_tickers) | **GET** /delivery/{settle}/tickers | List futures tickers [**list_delivery_insurance_ledger**](DeliveryApi.md#list_delivery_insurance_ledger) | **GET** /delivery/{settle}/insurance | Futures insurance balance history [**list_delivery_accounts**](DeliveryApi.md#list_delivery_accounts) | **GET** /delivery/{settle}/accounts | Query futures account [**list_delivery_account_book**](DeliveryApi.md#list_delivery_account_book) | **GET** /delivery/{settle}/account_book | Query account book [**list_delivery_positions**](DeliveryApi.md#list_delivery_positions) | **GET** /delivery/{settle}/positions | List all positions of a user [**get_delivery_position**](DeliveryApi.md#get_delivery_position) | **GET** /delivery/{settle}/positions/{contract} | Get single position [**update_delivery_position_margin**](DeliveryApi.md#update_delivery_position_margin) | **POST** /delivery/{settle}/positions/{contract}/margin | Update position margin [**update_delivery_position_leverage**](DeliveryApi.md#update_delivery_position_leverage) | **POST** /delivery/{settle}/positions/{contract}/leverage | Update position leverage [**update_delivery_position_risk_limit**](DeliveryApi.md#update_delivery_position_risk_limit) | **POST** /delivery/{settle}/positions/{contract}/risk_limit | Update position risk limit [**list_delivery_orders**](DeliveryApi.md#list_delivery_orders) | **GET** /delivery/{settle}/orders | List futures orders [**create_delivery_order**](DeliveryApi.md#create_delivery_order) | **POST** /delivery/{settle}/orders | Create a futures order [**cancel_delivery_orders**](DeliveryApi.md#cancel_delivery_orders) | **DELETE** /delivery/{settle}/orders | Cancel all `open` orders matched [**get_delivery_order**](DeliveryApi.md#get_delivery_order) | **GET** /delivery/{settle}/orders/{order_id} | Get a single order [**cancel_delivery_order**](DeliveryApi.md#cancel_delivery_order) | **DELETE** /delivery/{settle}/orders/{order_id} | Cancel a single order [**get_my_delivery_trades**](DeliveryApi.md#get_my_delivery_trades) | **GET** /delivery/{settle}/my_trades | List personal trading history [**list_delivery_position_close**](DeliveryApi.md#list_delivery_position_close) | **GET** /delivery/{settle}/position_close | List position close history [**list_delivery_liquidates**](DeliveryApi.md#list_delivery_liquidates) | **GET** /delivery/{settle}/liquidates | List liquidation history [**list_delivery_settlements**](DeliveryApi.md#list_delivery_settlements) | **GET** /delivery/{settle}/settlements | List settlement history [**list_price_triggered_delivery_orders**](DeliveryApi.md#list_price_triggered_delivery_orders) | **GET** /delivery/{settle}/price_orders | List all auto orders [**create_price_triggered_delivery_order**](DeliveryApi.md#create_price_triggered_delivery_order) | **POST** /delivery/{settle}/price_orders | Create a price-triggered order [**cancel_price_triggered_delivery_order_list**](DeliveryApi.md#cancel_price_triggered_delivery_order_list) | **DELETE** /delivery/{settle}/price_orders | Cancel all open orders [**get_price_triggered_delivery_order**](DeliveryApi.md#get_price_triggered_delivery_order) | **GET** /delivery/{settle}/price_orders/{order_id} | Get a single order [**cancel_price_triggered_delivery_order**](DeliveryApi.md#cancel_price_triggered_delivery_order) | **DELETE** /delivery/{settle}/price_orders/{order_id} | Cancel a single order # **list_delivery_contracts** > list[DeliveryContract] list_delivery_contracts(settle) List all futures contracts ### Example ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency try: # List all futures contracts api_response = api_instance.list_delivery_contracts(settle) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_contracts: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | ### Return type [**list[DeliveryContract]**](DeliveryContract.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | List retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_delivery_contract** > DeliveryContract get_delivery_contract(settle, contract) Get a single contract ### Example ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract try: # Get a single contract api_response = api_instance.get_delivery_contract(settle, contract) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->get_delivery_contract: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | ### Return type [**DeliveryContract**](DeliveryContract.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Contract information | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_order_book** > FuturesOrderBook list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id) Futures order book Bids will be sorted by price from high to low, while asks sorted reversely ### Example ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract interval = '0' # str | Order depth. 0 means no aggregation is applied. default to 0 (optional) (default to '0') limit = 10 # int | Maximum number of order depth data in asks or bids (optional) (default to 10) with_id = False # bool | Whether the order book update ID will be returned. This ID increases by 1 on every order book update (optional) (default to False) try: # Futures order book api_response = api_instance.list_delivery_order_book(settle, contract, interval=interval, limit=limit, with_id=with_id) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_order_book: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | **interval** | **str**| Order depth. 0 means no aggregation is applied. default to 0 | [optional] [default to '0'] **limit** | **int**| Maximum number of order depth data in asks or bids | [optional] [default to 10] **with_id** | **bool**| Whether the order book update ID will be returned. This ID increases by 1 on every order book update | [optional] [default to False] ### Return type [**FuturesOrderBook**](FuturesOrderBook.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Order book retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_trades** > list[FuturesTrade] list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to) Futures trading history ### Example ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100) last_id = '12345' # str | Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range (optional) _from = 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 trading history api_response = api_instance.list_delivery_trades(settle, contract, limit=limit, last_id=last_id, _from=_from, to=to) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_trades: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **last_id** | **str**| Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. Use `from` and `to` instead to limit time range | [optional] **_from** | **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** | **int**| Specify end time in Unix seconds, default to current time | [optional] ### Return type [**list[FuturesTrade]**](FuturesTrade.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | List retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_candlesticks** > list[FuturesCandlestick] list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval) Get futures candlesticks Return specified contract candlesticks. If prefix `contract` with `mark_`, the contract's mark price candlesticks are returned; if prefix with `index_`, index price candlesticks will be returned. Maximum of 2000 points are returned in one query. Be sure not to exceed the limit when specifying `from`, `to` and `interval` ### Example ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = '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 | End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time (optional) limit = 100 # int | Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. (optional) (default to 100) interval = '5m' # str | Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 (optional) (default to '5m') try: # Get futures candlesticks api_response = api_instance.list_delivery_candlesticks(settle, contract, _from=_from, to=to, limit=limit, interval=interval) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_candlesticks: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | **_from** | **int**| Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified | [optional] **to** | **int**| End time of candlesticks, formatted in Unix timestamp in seconds. Default to current time | [optional] **limit** | **int**| Maximum recent data points to return. `limit` is conflicted with `from` and `to`. If either `from` or `to` is specified, request will be rejected. | [optional] [default to 100] **interval** | **str**| Interval time between data points. Note that `1w` means natual week(Mon-Sun), while `7d` means every 7d since unix 0 | [optional] [default to '5m'] ### Return type [**list[FuturesCandlestick]**](FuturesCandlestick.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successfully retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_tickers** > list[FuturesTicker] list_delivery_tickers(settle, contract=contract) List futures tickers ### Example ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract (optional) try: # List futures tickers api_response = api_instance.list_delivery_tickers(settle, contract=contract) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_tickers: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | [optional] ### Return type [**list[FuturesTicker]**](FuturesTicker.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successfully retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_insurance_ledger** > list[InsuranceRecord] list_delivery_insurance_ledger(settle, limit=limit) Futures insurance balance history ### Example ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100) try: # Futures insurance balance history api_response = api_instance.list_delivery_insurance_ledger(settle, limit=limit) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_insurance_ledger: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] ### Return type [**list[InsuranceRecord]**](InsuranceRecord.md) ### Authorization No authorization required ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successfully retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_accounts** > FuturesAccount list_delivery_accounts(settle) Query futures account ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency try: # Query futures account api_response = api_instance.list_delivery_accounts(settle) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_accounts: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | ### Return type [**FuturesAccount**](FuturesAccount.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | List retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_account_book** > list[FuturesAccountBook] list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type) Query account book ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100) _from = 1547706332 # int | Start timestamp (optional) to = 1547706332 # int | End timestamp (optional) type = 'dnw' # str | Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate (optional) try: # Query account book api_response = api_instance.list_delivery_account_book(settle, limit=limit, _from=_from, to=to, type=type) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_account_book: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **_from** | **int**| Start timestamp | [optional] **to** | **int**| End timestamp | [optional] **type** | **str**| Changing Type: - dnw: Deposit & Withdraw - pnl: Profit & Loss by reducing position - fee: Trading fee - refr: Referrer rebate - fund: Funding - point_dnw: POINT Deposit & Withdraw - point_fee: POINT Trading fee - point_refr: POINT Referrer rebate | [optional] ### Return type [**list[FuturesAccountBook]**](FuturesAccountBook.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | List retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_positions** > list[Position] list_delivery_positions(settle) List all positions of a user ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency try: # List all positions of a user api_response = api_instance.list_delivery_positions(settle) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_positions: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | ### Return type [**list[Position]**](Position.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | List retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_delivery_position** > Position get_delivery_position(settle, contract) Get single position ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract try: # Get single position api_response = api_instance.get_delivery_position(settle, contract) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->get_delivery_position: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | ### Return type [**Position**](Position.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Position information | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_delivery_position_margin** > Position update_delivery_position_margin(settle, contract, change) Update position margin ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract change = '0.01' # str | Margin change. Use positive number to increase margin, negative number otherwise. try: # Update position margin api_response = api_instance.update_delivery_position_margin(settle, contract, change) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->update_delivery_position_margin: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | **change** | **str**| Margin change. Use positive number to increase margin, negative number otherwise. | ### Return type [**Position**](Position.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Position information | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_delivery_position_leverage** > Position update_delivery_position_leverage(settle, contract, leverage) Update position leverage ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract leverage = '10' # str | New position leverage try: # Update position leverage api_response = api_instance.update_delivery_position_leverage(settle, contract, leverage) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->update_delivery_position_leverage: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | **leverage** | **str**| New position leverage | ### Return type [**Position**](Position.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Position information | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_delivery_position_risk_limit** > Position update_delivery_position_risk_limit(settle, contract, risk_limit) Update position risk limit ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract risk_limit = '10' # str | New position risk limit try: # Update position risk limit api_response = api_instance.update_delivery_position_risk_limit(settle, contract, risk_limit) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->update_delivery_position_risk_limit: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | **risk_limit** | **str**| New position risk limit | ### Return type [**Position**](Position.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Position information | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_orders** > list[FuturesOrder] list_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset, last_id=last_id, count_total=count_total) List futures orders Zero-filled order cannot be retrieved 10 minutes after order cancellation ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency status = 'open' # str | Only list the orders with this status contract = 'BTC_USDT_20200814' # str | Futures contract (optional) limit = 100 # int | Maximum number of records to be 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 | Specify list staring point using the `id` of last record in previous list-query results (optional) count_total = 0 # int | Whether to return total number matched. Default to 0(no return) (optional) (default to 0) try: # List futures orders api_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) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_orders: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **status** | **str**| Only list the orders with this status | **contract** | **str**| Futures contract | [optional] **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] **last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional] **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] ### Return type [**list[FuturesOrder]**](FuturesOrder.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | List retrieved | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned if `count_total` set to 1
| [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **create_delivery_order** > FuturesOrder create_delivery_order(settle, futures_order) Create a futures order Zero-filled order cannot be retrieved 10 minutes after order cancellation ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency futures_order = gate_api.FuturesOrder() # FuturesOrder | try: # Create a futures order api_response = api_instance.create_delivery_order(settle, futures_order) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->create_delivery_order: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **futures_order** | [**FuturesOrder**](FuturesOrder.md)| | ### Return type [**FuturesOrder**](FuturesOrder.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | Order details | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **cancel_delivery_orders** > list[FuturesOrder] cancel_delivery_orders(settle, contract, side=side) Cancel all `open` orders matched Zero-filled order cannot be retrieved 10 minutes after order cancellation ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract side = 'ask' # str | All bids or asks. Both included if not specified (optional) try: # Cancel all `open` orders matched api_response = api_instance.cancel_delivery_orders(settle, contract, side=side) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->cancel_delivery_orders: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | **side** | **str**| All bids or asks. Both included if not specified | [optional] ### Return type [**list[FuturesOrder]**](FuturesOrder.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | All orders matched cancelled | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_delivery_order** > FuturesOrder get_delivery_order(settle, order_id) Get a single order Zero-filled order cannot be retrieved 10 minutes after order cancellation ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency order_id = '12345' # str | Retrieve the data of the order with the specified ID try: # Get a single order api_response = api_instance.get_delivery_order(settle, order_id) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->get_delivery_order: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **order_id** | **str**| Retrieve the data of the order with the specified ID | ### Return type [**FuturesOrder**](FuturesOrder.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Order details | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **cancel_delivery_order** > FuturesOrder cancel_delivery_order(settle, order_id) Cancel a single order ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency order_id = '12345' # str | Retrieve the data of the order with the specified ID try: # Cancel a single order api_response = api_instance.cancel_delivery_order(settle, order_id) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->cancel_delivery_order: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **order_id** | **str**| Retrieve the data of the order with the specified ID | ### Return type [**FuturesOrder**](FuturesOrder.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Order details | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **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) List personal trading history ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = '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 to be 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 | Specify list staring point using the `id` of last record in previous list-query results (optional) count_total = 0 # int | Whether to return total number matched. Default to 0(no return) (optional) (default to 0) try: # List personal trading history api_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) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->get_my_delivery_trades: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | [optional] **order** | **int**| Futures order ID, return related data only if specified | [optional] **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] **last_id** | **str**| Specify list staring point using the `id` of last record in previous list-query results | [optional] **count_total** | **int**| Whether to return total number matched. Default to 0(no return) | [optional] [default to 0] ### Return type [**list[MyFuturesTrade]**](MyFuturesTrade.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | List retrieved | * X-Pagination-Limit - Request limit specified
* X-Pagination-Offset - Request offset specified
* X-Pagination-Total - Total number matched. Only returned if `count_total` set to 1
| [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_position_close** > list[PositionClose] list_delivery_position_close(settle, contract=contract, limit=limit) List position close history ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract (optional) limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100) try: # List position close history api_response = api_instance.list_delivery_position_close(settle, contract=contract, limit=limit) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_position_close: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | [optional] **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] ### Return type [**list[PositionClose]**](PositionClose.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | List retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_liquidates** > list[FuturesLiquidate] list_delivery_liquidates(settle, contract=contract, limit=limit, at=at) List liquidation history ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract (optional) limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100) at = 0 # int | Specify a liquidation timestamp (optional) (default to 0) try: # List liquidation history api_response = api_instance.list_delivery_liquidates(settle, contract=contract, limit=limit, at=at) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_liquidates: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | [optional] **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **at** | **int**| Specify a liquidation timestamp | [optional] [default to 0] ### Return type [**list[FuturesLiquidate]**](FuturesLiquidate.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | List retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_delivery_settlements** > list[DeliverySettlement] list_delivery_settlements(settle, contract=contract, limit=limit, at=at) List settlement history ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT_20200814' # str | Futures contract (optional) limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100) at = 0 # int | Specify a settlement timestamp (optional) (default to 0) try: # List settlement history api_response = api_instance.list_delivery_settlements(settle, contract=contract, limit=limit, at=at) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_delivery_settlements: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | [optional] **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **at** | **int**| Specify a settlement timestamp | [optional] [default to 0] ### Return type [**list[DeliverySettlement]**](DeliverySettlement.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | List retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **list_price_triggered_delivery_orders** > list[FuturesPriceTriggeredOrder] list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset) List all auto orders ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency status = 'status_example' # str | Only list the orders with this status contract = 'BTC_USDT' # str | Futures contract, return related data only if specified (optional) limit = 100 # int | Maximum number of records to be returned in a single list (optional) (default to 100) offset = 0 # int | List offset, starting from 0 (optional) (default to 0) try: # List all auto orders api_response = api_instance.list_price_triggered_delivery_orders(settle, status, contract=contract, limit=limit, offset=offset) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->list_price_triggered_delivery_orders: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **status** | **str**| Only list the orders with this status | **contract** | **str**| Futures contract, return related data only if specified | [optional] **limit** | **int**| Maximum number of records to be returned in a single list | [optional] [default to 100] **offset** | **int**| List offset, starting from 0 | [optional] [default to 0] ### Return type [**list[FuturesPriceTriggeredOrder]**](FuturesPriceTriggeredOrder.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | List retrieved | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **create_price_triggered_delivery_order** > TriggerOrderResponse create_price_triggered_delivery_order(settle, futures_price_triggered_order) Create a price-triggered order ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency futures_price_triggered_order = gate_api.FuturesPriceTriggeredOrder() # FuturesPriceTriggeredOrder | try: # Create a price-triggered order api_response = api_instance.create_price_triggered_delivery_order(settle, futures_price_triggered_order) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->create_price_triggered_delivery_order: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **futures_price_triggered_order** | [**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md)| | ### Return type [**TriggerOrderResponse**](TriggerOrderResponse.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **201** | Order created | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **cancel_price_triggered_delivery_order_list** > list[FuturesPriceTriggeredOrder] cancel_price_triggered_delivery_order_list(settle, contract) Cancel all open orders ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency contract = 'BTC_USDT' # str | Futures contract try: # Cancel all open orders api_response = api_instance.cancel_price_triggered_delivery_order_list(settle, contract) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order_list: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **contract** | **str**| Futures contract | ### Return type [**list[FuturesPriceTriggeredOrder]**](FuturesPriceTriggeredOrder.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Batch cancellation request accepted. Query order status by listing orders | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_price_triggered_delivery_order** > FuturesPriceTriggeredOrder get_price_triggered_delivery_order(settle, order_id) Get a single order ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency order_id = 'order_id_example' # str | Retrieve the data of the order with the specified ID try: # Get a single order api_response = api_instance.get_price_triggered_delivery_order(settle, order_id) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->get_price_triggered_delivery_order: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **order_id** | **str**| Retrieve the data of the order with the specified ID | ### Return type [**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Auto order detail | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **cancel_price_triggered_delivery_order** > FuturesPriceTriggeredOrder cancel_price_triggered_delivery_order(settle, order_id) Cancel a single order ### Example * Api Key Authentication (apiv4): ```python from __future__ import print_function import gate_api from gate_api.exceptions import ApiException, 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 authorization configuration = 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 class api_instance = gate_api.DeliveryApi(api_client) settle = 'usdt' # str | Settle currency order_id = 'order_id_example' # str | Retrieve the data of the order with the specified ID try: # Cancel a single order api_response = api_instance.cancel_price_triggered_delivery_order(settle, order_id) print(api_response) except GateApiException as ex: print("Gate api exception, label: %s, message: %s\n" % (ex.label, ex.message)) except ApiException as e: print("Exception when calling DeliveryApi->cancel_price_triggered_delivery_order: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **settle** | **str**| Settle currency | **order_id** | **str**| Retrieve the data of the order with the specified ID | ### Return type [**FuturesPriceTriggeredOrder**](FuturesPriceTriggeredOrder.md) ### Authorization [apiv4](../README.md#apiv4) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Auto order detail | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)