# coding: utf-8 """ Gate API Welcome to Gate API APIv4 provides operations related to spot, margin, and contract trading, including public interfaces for querying market data and authenticated private interfaces for implementing API-based automated trading. # noqa: E501 Contact: support@mail.gate.com Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import re # noqa: F401 # python 2 and python 3 compatibility library import six from gate_api.api_client import ApiClient from gate_api.exceptions import ( # noqa: F401 ApiTypeError, ApiValueError ) class FuturesApi(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client def list_futures_contracts(self, settle, **kwargs): # noqa: E501 """Query all futures contracts # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_contracts(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.Contract] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_contracts_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_contracts_with_http_info(self, settle, **kwargs): # noqa: E501 """Query all futures contracts # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_contracts_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.Contract], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'limit', 'offset' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_contracts" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_contracts`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_contracts`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_contracts`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_futures_contracts`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/contracts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Contract]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_contracts_all(self, settle, **kwargs): # noqa: E501 """Query all contract information (including delisted) # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_contracts_all(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.Contract] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_contracts_all_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_contracts_all_with_http_info(self, settle, **kwargs): # noqa: E501 """Query all contract information (including delisted) # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_contracts_all_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.Contract], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'limit', 'offset' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_contracts_all" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_contracts_all`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_contracts_all`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_contracts_all`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_futures_contracts_all`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/contracts_all', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Contract]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_futures_contract(self, settle, contract, **kwargs): # noqa: E501 """Query single contract information # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_futures_contract(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.Contract :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_futures_contract_with_http_info(settle, contract, **kwargs) # noqa: E501 def get_futures_contract_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Query single contract information # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_futures_contract_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.Contract, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_futures_contract" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_contract`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `get_futures_contract`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'contract' in local_var_params: path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/contracts/{contract}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Contract', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_order_book(self, settle, contract, **kwargs): # noqa: E501 """Query futures market depth information # noqa: E501 Bids will be sorted by price from high to low, while asks sorted reversely # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_order_book(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str interval: Price precision for merged depth. 0 means no merging. If not specified, defaults to 0 :param int limit: Number of depth levels :param bool with_id: Whether to return depth update ID. This ID increments by 1 each time the depth changes :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesOrderBook :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_order_book_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_futures_order_book_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Query futures market depth information # noqa: E501 Bids will be sorted by price from high to low, while asks sorted reversely # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_order_book_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str interval: Price precision for merged depth. 0 means no merging. If not specified, defaults to 0 :param int limit: Number of depth levels :param bool with_id: Whether to return depth update ID. This ID increments by 1 each time the depth changes :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesOrderBook, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'interval', 'limit', 'with_id' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_order_book" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_order_book`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_order_book`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 50: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_order_book`, must be a value less than or equal to `50`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_order_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 query_params.append(('interval', local_var_params['interval'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'with_id' in local_var_params and local_var_params['with_id'] is not None: # noqa: E501 query_params.append(('with_id', local_var_params['with_id'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/order_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesOrderBook', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_trades(self, settle, contract, **kwargs): # noqa: E501 """Futures market transaction records # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_trades(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param str last_id: 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 :param int _from: 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. :param int to: Specify end time in Unix seconds, default to current time. :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesTrade] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_trades_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_futures_trades_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Futures market transaction records # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_trades_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param str last_id: 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 :param int _from: 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. :param int to: Specify end time in Unix seconds, default to current time. :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesTrade], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'limit', 'offset', 'last_id', '_from', 'to' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_trades" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_trades`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_trades`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_trades`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_trades`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_futures_trades`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 if 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/trades', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesTrade]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_candlesticks(self, settle, contract, **kwargs): # noqa: E501 """Futures market K-line chart # noqa: E501 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` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_candlesticks(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified :param int to: 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 :param int limit: 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. :param str interval: Time interval for data points. Note: 1w represents a natural week, 7d is aligned with Unix epoch time, 30d represents a natural month :param str timezone: Time zone: all/utc0/utc8, default utc0 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesCandlestick] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_candlesticks_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_futures_candlesticks_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Futures market K-line chart # noqa: E501 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` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_candlesticks_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified :param int to: 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 :param int limit: 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. :param str interval: Time interval for data points. Note: 1w represents a natural week, 7d is aligned with Unix epoch time, 30d represents a natural month :param str timezone: Time zone: all/utc0/utc8, default utc0 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesCandlestick], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', '_from', 'to', 'limit', 'interval', 'timezone' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_candlesticks" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_candlesticks`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_candlesticks`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_candlesticks`, must be a value less than or equal to `2000`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 query_params.append(('interval', local_var_params['interval'])) # noqa: E501 if 'timezone' in local_var_params and local_var_params['timezone'] is not None: # noqa: E501 query_params.append(('timezone', local_var_params['timezone'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/candlesticks', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesCandlestick]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_premium_index(self, settle, contract, **kwargs): # noqa: E501 """Premium Index K-line chart # noqa: E501 K-line chart data returns a maximum of 1000 points per request. When specifying from, to, and interval, ensure the number of points is not excessive # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_premium_index(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified :param int to: 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 :param int limit: 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. :param str interval: Time interval between data points :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesPremiumIndex] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_premium_index_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_futures_premium_index_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Premium Index K-line chart # noqa: E501 K-line chart data returns a maximum of 1000 points per request. When specifying from, to, and interval, ensure the number of points is not excessive # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_premium_index_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int _from: Start time of candlesticks, formatted in Unix timestamp in seconds. Default to`to - 100 * interval` if not specified :param int to: 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 :param int limit: 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. :param str interval: Time interval between data points :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesPremiumIndex], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', '_from', 'to', 'limit', 'interval' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_premium_index" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_premium_index`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_premium_index`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 2000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_premium_index`, must be a value less than or equal to `2000`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 query_params.append(('interval', local_var_params['interval'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/premium_index', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesPremiumIndex]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_tickers(self, settle, **kwargs): # noqa: E501 """Get all futures trading statistics # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_tickers(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesTicker] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_tickers_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_tickers_with_http_info(self, settle, **kwargs): # noqa: E501 """Get all futures trading statistics # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_tickers_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesTicker], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_tickers" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_tickers`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/tickers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesTicker]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_funding_rate_history(self, settle, contract, **kwargs): # noqa: E501 """Futures market historical funding rate # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_funding_rate_history(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int limit: Maximum number of records returned in a single list :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FundingRateRecord] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_funding_rate_history_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_futures_funding_rate_history_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Futures market historical funding rate # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_funding_rate_history_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int limit: Maximum number of records returned in a single list :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FundingRateRecord], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'limit', '_from', 'to' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_funding_rate_history" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_funding_rate_history`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `list_futures_funding_rate_history`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_funding_rate_history`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_funding_rate_history`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/funding_rate', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FundingRateRecord]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_batch_futures_funding_rates(self, settle, batch_funding_rates_request, **kwargs): # noqa: E501 """Batch Query Historical Funding Rate Data for Perpetual Contracts # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_batch_futures_funding_rates(settle, batch_funding_rates_request, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param BatchFundingRatesRequest batch_funding_rates_request: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.BatchFundingRatesResponse] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_batch_futures_funding_rates_with_http_info(settle, batch_funding_rates_request, **kwargs) # noqa: E501 def list_batch_futures_funding_rates_with_http_info(self, settle, batch_funding_rates_request, **kwargs): # noqa: E501 """Batch Query Historical Funding Rate Data for Perpetual Contracts # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_batch_futures_funding_rates_with_http_info(settle, batch_funding_rates_request, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param BatchFundingRatesRequest batch_funding_rates_request: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.BatchFundingRatesResponse], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'batch_funding_rates_request' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_batch_futures_funding_rates" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_batch_futures_funding_rates`") # noqa: E501 # verify the required parameter 'batch_funding_rates_request' is set if self.api_client.client_side_validation and ('batch_funding_rates_request' not in local_var_params or # noqa: E501 local_var_params['batch_funding_rates_request'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `batch_funding_rates_request` when calling `list_batch_futures_funding_rates`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'batch_funding_rates_request' in local_var_params: body_params = local_var_params['batch_funding_rates_request'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/funding_rates', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[BatchFundingRatesResponse]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_insurance_ledger(self, settle, **kwargs): # noqa: E501 """Futures market insurance fund history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_insurance_ledger(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in a single list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.InsuranceRecord] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_insurance_ledger_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_insurance_ledger_with_http_info(self, settle, **kwargs): # noqa: E501 """Futures market insurance fund history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_insurance_ledger_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int limit: Maximum number of records returned in a single list :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.InsuranceRecord], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'limit' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_insurance_ledger" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_insurance_ledger`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_insurance_ledger`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_insurance_ledger`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/insurance', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[InsuranceRecord]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_contract_stats(self, settle, contract, **kwargs): # noqa: E501 """Futures statistics # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_contract_stats(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int _from: Start timestamp :param str interval: :param int limit: :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.ContractStat] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_contract_stats_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_contract_stats_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Futures statistics # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_contract_stats_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int _from: Start timestamp :param str interval: :param int limit: :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.ContractStat], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', '_from', 'interval', 'limit' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_contract_stats" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_contract_stats`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `list_contract_stats`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 100: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_contract_stats`, must be a value less than or equal to `100`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_contract_stats`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501 query_params.append(('interval', local_var_params['interval'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/contract_stats', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[ContractStat]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_index_constituents(self, settle, index, **kwargs): # noqa: E501 """Query index constituents # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_index_constituents(settle, index, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str index: Index name (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesIndexConstituents :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_index_constituents_with_http_info(settle, index, **kwargs) # noqa: E501 def get_index_constituents_with_http_info(self, settle, index, **kwargs): # noqa: E501 """Query index constituents # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_index_constituents_with_http_info(settle, index, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str index: Index name (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesIndexConstituents, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'index' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_index_constituents" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_index_constituents`") # noqa: E501 # verify the required parameter 'index' is set if self.api_client.client_side_validation and ('index' not in local_var_params or # noqa: E501 local_var_params['index'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `index` when calling `get_index_constituents`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'index' in local_var_params: path_params['index'] = local_var_params['index'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/index_constituents/{index}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesIndexConstituents', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_liquidated_orders(self, settle, **kwargs): # noqa: E501 """Query liquidation order history # noqa: E501 The time interval between from and to is maximum 3600. Some private fields are not returned by public interfaces, refer to field descriptions for details # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_liquidated_orders(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int limit: Maximum number of records returned in a single list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesLiqOrder] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_liquidated_orders_with_http_info(settle, **kwargs) # noqa: E501 def list_liquidated_orders_with_http_info(self, settle, **kwargs): # noqa: E501 """Query liquidation order history # noqa: E501 The time interval between from and to is maximum 3600. Some private fields are not returned by public interfaces, refer to field descriptions for details # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_liquidated_orders_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int limit: Maximum number of records returned in a single list :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesLiqOrder], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', '_from', 'to', 'limit' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_liquidated_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_liquidated_orders`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_liquidated_orders`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_liquidated_orders`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/liq_orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesLiqOrder]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_risk_limit_tiers(self, settle, **kwargs): # noqa: E501 """Query risk limit tiers # noqa: E501 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. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_risk_limit_tiers(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesLimitRiskTiers] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_risk_limit_tiers_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_risk_limit_tiers_with_http_info(self, settle, **kwargs): # noqa: E501 """Query risk limit tiers # noqa: E501 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. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_risk_limit_tiers_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesLimitRiskTiers], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'limit', 'offset' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_risk_limit_tiers" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_risk_limit_tiers`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_risk_limit_tiers`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_risk_limit_tiers`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_futures_risk_limit_tiers`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/risk_limit_tiers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesLimitRiskTiers]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_accounts(self, settle, **kwargs): # noqa: E501 """Get futures account # noqa: E501 Query account information for classic future account and unified account # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_accounts(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesAccount :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_accounts_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_accounts_with_http_info(self, settle, **kwargs): # noqa: E501 """Get futures account # noqa: E501 Query account information for classic future account and unified account # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_accounts_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesAccount, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_accounts" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_accounts`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/accounts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesAccount', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_account_book(self, settle, **kwargs): # noqa: E501 """Query futures account change history # noqa: E501 If the contract field is passed, only records containing this field after 2023-10-30 can be filtered。 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_account_book(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param str type: 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 - bonus_offset: Trial fund deduction :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesAccountBook] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_account_book_with_http_info(settle, **kwargs) # noqa: E501 def list_futures_account_book_with_http_info(self, settle, **kwargs): # noqa: E501 """Query futures account change history # noqa: E501 If the contract field is passed, only records containing this field after 2023-10-30 can be filtered。 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_account_book_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param str type: 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 - bonus_offset: Trial fund deduction :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesAccountBook], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'limit', 'offset', '_from', 'to', 'type' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_account_book" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_account_book`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_account_book`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_account_book`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_futures_account_book`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501 query_params.append(('type', local_var_params['type'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/account_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesAccountBook]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_positions(self, settle, **kwargs): # noqa: E501 """Get user position list # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_positions(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param bool holding: Return only real positions - true, return all - false :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.Position] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_positions_with_http_info(settle, **kwargs) # noqa: E501 def list_positions_with_http_info(self, settle, **kwargs): # noqa: E501 """Get user position list # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_positions_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param bool holding: Return only real positions - true, return all - false :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.Position], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'holding', 'limit', 'offset' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_positions" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_positions`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_positions`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_positions`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_positions`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'holding' in local_var_params and local_var_params['holding'] is not None: # noqa: E501 query_params.append(('holding', local_var_params['holding'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/positions', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Position]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_positions_timerange(self, settle, contract, **kwargs): # noqa: E501 """Get user's historical position information list by time # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_positions_timerange(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.PositionTimerange] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_positions_timerange_with_http_info(settle, contract, **kwargs) # noqa: E501 def list_positions_timerange_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Get user's historical position information list by time # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_positions_timerange_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.PositionTimerange], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', '_from', 'to', 'limit', 'offset' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_positions_timerange" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_positions_timerange`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `list_positions_timerange`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_positions_timerange`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_positions_timerange`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_positions_timerange`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/positions_timerange', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[PositionTimerange]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_position(self, settle, contract, **kwargs): # noqa: E501 """Get single position information # noqa: E501 Get single position information from a contract. If you hold two postions in one contract market, please use this API: /futures/{settle}/dual_comp/positions/{contract} # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_position(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.Position :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_position_with_http_info(settle, contract, **kwargs) # noqa: E501 def get_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Get single position information # noqa: E501 Get single position information from a contract. If you hold two postions in one contract market, please use this API: /futures/{settle}/dual_comp/positions/{contract} # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_position_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_position" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_position`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `get_position`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'contract' in local_var_params: path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/positions/{contract}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Position', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_leverage(self, settle, contract, pos_margin_mode, dual_side, **kwargs): # noqa: E501 """Get Leverage Information for Specified Mode # noqa: E501 Get Leverage Information for Specified Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_leverage(settle, contract, pos_margin_mode, dual_side, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str pos_margin_mode: Position Margin Mode, required for split position mode, values: isolated/cross. (required) :param str dual_side: dual_long - Long, dual_short - Short (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesLeverage :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_leverage_with_http_info(settle, contract, pos_margin_mode, dual_side, **kwargs) # noqa: E501 def get_leverage_with_http_info(self, settle, contract, pos_margin_mode, dual_side, **kwargs): # noqa: E501 """Get Leverage Information for Specified Mode # noqa: E501 Get Leverage Information for Specified Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_leverage_with_http_info(settle, contract, pos_margin_mode, dual_side, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str pos_margin_mode: Position Margin Mode, required for split position mode, values: isolated/cross. (required) :param str dual_side: dual_long - Long, dual_short - Short (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesLeverage, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'pos_margin_mode', 'dual_side' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_leverage" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_leverage`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `get_leverage`") # noqa: E501 # verify the required parameter 'pos_margin_mode' is set if self.api_client.client_side_validation and ('pos_margin_mode' not in local_var_params or # noqa: E501 local_var_params['pos_margin_mode'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `pos_margin_mode` when calling `get_leverage`") # noqa: E501 # verify the required parameter 'dual_side' is set if self.api_client.client_side_validation and ('dual_side' not in local_var_params or # noqa: E501 local_var_params['dual_side'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `dual_side` when calling `get_leverage`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'contract' in local_var_params: path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] if 'pos_margin_mode' in local_var_params and local_var_params['pos_margin_mode'] is not None: # noqa: E501 query_params.append(('pos_margin_mode', local_var_params['pos_margin_mode'])) # noqa: E501 if 'dual_side' in local_var_params and local_var_params['dual_side'] is not None: # noqa: E501 query_params.append(('dual_side', local_var_params['dual_side'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/get_leverage/{contract}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesLeverage', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def update_position_margin(self, settle, contract, change, **kwargs): # noqa: E501 """Update position margin # noqa: E501 Under the new risk limit rules(https://www.gate.com/en/help/futures/futures-logic/22162), the position limit is related to the leverage you set; a lower leverage will result in a higher position limit. Please use the leverage adjustment api to adjust the position limit. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_position_margin(settle, contract, change, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str change: Margin change amount, positive number increases, negative number decreases (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.Position :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.update_position_margin_with_http_info(settle, contract, change, **kwargs) # noqa: E501 def update_position_margin_with_http_info(self, settle, contract, change, **kwargs): # noqa: E501 """Update position margin # noqa: E501 Under the new risk limit rules(https://www.gate.com/en/help/futures/futures-logic/22162), the position limit is related to the leverage you set; a lower leverage will result in a higher position limit. Please use the leverage adjustment api to adjust the position limit. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_position_margin_with_http_info(settle, contract, change, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str change: Margin change amount, positive number increases, negative number decreases (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'change' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_position_margin" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `update_position_margin`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `update_position_margin`") # noqa: E501 # verify the required parameter 'change' is set if self.api_client.client_side_validation and ('change' not in local_var_params or # noqa: E501 local_var_params['change'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `change` when calling `update_position_margin`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'contract' in local_var_params: path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] if 'change' in local_var_params and local_var_params['change'] is not None: # noqa: E501 query_params.append(('change', local_var_params['change'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/positions/{contract}/margin', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Position', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def update_position_leverage(self, settle, contract, leverage, **kwargs): # noqa: E501 """Update position leverage # noqa: E501 ⚠️ Position Mode Switching Rules: - leverage ≠ 0: Isolated Margin Mode (Regardless of whether cross_leverage_limit is filled, this parameter will be ignored) - leverage = 0: Cross Margin Mode (Use cross_leverage_limit to set the leverage multiple) Examples: - Set isolated margin with 10x leverage: leverage=10 - Set cross margin with 10x leverage: leverage=0&cross_leverage_limit=10 - leverage=5&cross_leverage_limit=10 → Result: Isolated margin with 5x leverage (cross_leverage_limit is ignored) ⚠️ Warning: Incorrect settings may cause unexpected position mode switching, affecting risk management. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_position_leverage(settle, contract, leverage, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: Set the leverage for isolated margin. When setting isolated margin leverage, the `cross_leverage_limit` must be empty. (required) :param str cross_leverage_limit: Set the leverage for cross margin. When setting cross margin leverage, the `leverage` must be set to 0. :param int pid: Product ID :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.Position :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.update_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 def update_position_leverage_with_http_info(self, settle, contract, leverage, **kwargs): # noqa: E501 """Update position leverage # noqa: E501 ⚠️ Position Mode Switching Rules: - leverage ≠ 0: Isolated Margin Mode (Regardless of whether cross_leverage_limit is filled, this parameter will be ignored) - leverage = 0: Cross Margin Mode (Use cross_leverage_limit to set the leverage multiple) Examples: - Set isolated margin with 10x leverage: leverage=10 - Set cross margin with 10x leverage: leverage=0&cross_leverage_limit=10 - leverage=5&cross_leverage_limit=10 → Result: Isolated margin with 5x leverage (cross_leverage_limit is ignored) ⚠️ Warning: Incorrect settings may cause unexpected position mode switching, affecting risk management. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_position_leverage_with_http_info(settle, contract, leverage, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: Set the leverage for isolated margin. When setting isolated margin leverage, the `cross_leverage_limit` must be empty. (required) :param str cross_leverage_limit: Set the leverage for cross margin. When setting cross margin leverage, the `leverage` must be set to 0. :param int pid: Product ID :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'leverage', 'cross_leverage_limit', 'pid' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_position_leverage" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `update_position_leverage`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `update_position_leverage`") # noqa: E501 # verify the required parameter 'leverage' is set if self.api_client.client_side_validation and ('leverage' not in local_var_params or # noqa: E501 local_var_params['leverage'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `leverage` when calling `update_position_leverage`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'contract' in local_var_params: path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] if 'leverage' in local_var_params and local_var_params['leverage'] is not None: # noqa: E501 query_params.append(('leverage', local_var_params['leverage'])) # noqa: E501 if 'cross_leverage_limit' in local_var_params and local_var_params['cross_leverage_limit'] is not None: # noqa: E501 query_params.append(('cross_leverage_limit', local_var_params['cross_leverage_limit'])) # noqa: E501 if 'pid' in local_var_params and local_var_params['pid'] is not None: # noqa: E501 query_params.append(('pid', local_var_params['pid'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/positions/{contract}/leverage', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Position', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def update_contract_position_leverage(self, settle, contract, leverage, margin_mode, **kwargs): # noqa: E501 """Update Leverage for Specified Mode # noqa: E501 To simplify the complex logic of the leverage interface, added a new interface for modifying leverage # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_contract_position_leverage(settle, contract, leverage, margin_mode, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: Position Leverage Multiple (required) :param str margin_mode: Margin Mode isolated/cross (required) :param str dual_side: dual_long - Long, dual_short - Short :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.Position :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.update_contract_position_leverage_with_http_info(settle, contract, leverage, margin_mode, **kwargs) # noqa: E501 def update_contract_position_leverage_with_http_info(self, settle, contract, leverage, margin_mode, **kwargs): # noqa: E501 """Update Leverage for Specified Mode # noqa: E501 To simplify the complex logic of the leverage interface, added a new interface for modifying leverage # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_contract_position_leverage_with_http_info(settle, contract, leverage, margin_mode, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: Position Leverage Multiple (required) :param str margin_mode: Margin Mode isolated/cross (required) :param str dual_side: dual_long - Long, dual_short - Short :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'leverage', 'margin_mode', 'dual_side' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_contract_position_leverage" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `update_contract_position_leverage`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `update_contract_position_leverage`") # noqa: E501 # verify the required parameter 'leverage' is set if self.api_client.client_side_validation and ('leverage' not in local_var_params or # noqa: E501 local_var_params['leverage'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `leverage` when calling `update_contract_position_leverage`") # noqa: E501 # verify the required parameter 'margin_mode' is set if self.api_client.client_side_validation and ('margin_mode' not in local_var_params or # noqa: E501 local_var_params['margin_mode'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `margin_mode` when calling `update_contract_position_leverage`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'contract' in local_var_params: path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] if 'leverage' in local_var_params and local_var_params['leverage'] is not None: # noqa: E501 query_params.append(('leverage', local_var_params['leverage'])) # noqa: E501 if 'margin_mode' in local_var_params and local_var_params['margin_mode'] is not None: # noqa: E501 query_params.append(('margin_mode', local_var_params['margin_mode'])) # noqa: E501 if 'dual_side' in local_var_params and local_var_params['dual_side'] is not None: # noqa: E501 query_params.append(('dual_side', local_var_params['dual_side'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/positions/{contract}/set_leverage', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Position', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def update_position_cross_mode(self, settle, futures_position_cross_mode, **kwargs): # noqa: E501 """Switch Position Margin Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_position_cross_mode(settle, futures_position_cross_mode, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesPositionCrossMode futures_position_cross_mode: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.Position :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.update_position_cross_mode_with_http_info(settle, futures_position_cross_mode, **kwargs) # noqa: E501 def update_position_cross_mode_with_http_info(self, settle, futures_position_cross_mode, **kwargs): # noqa: E501 """Switch Position Margin Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_position_cross_mode_with_http_info(settle, futures_position_cross_mode, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesPositionCrossMode futures_position_cross_mode: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'futures_position_cross_mode' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_position_cross_mode" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `update_position_cross_mode`") # noqa: E501 # verify the required parameter 'futures_position_cross_mode' is set if self.api_client.client_side_validation and ('futures_position_cross_mode' not in local_var_params or # noqa: E501 local_var_params['futures_position_cross_mode'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `futures_position_cross_mode` when calling `update_position_cross_mode`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'futures_position_cross_mode' in local_var_params: body_params = local_var_params['futures_position_cross_mode'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/positions/cross_mode', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Position', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def update_dual_comp_position_cross_mode(self, settle, update_dual_comp_position_cross_mode_request, **kwargs): # noqa: E501 """Switch Between Cross and Isolated Margin Modes Under Hedge Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_dual_comp_position_cross_mode(settle, update_dual_comp_position_cross_mode_request, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param UpdateDualCompPositionCrossModeRequest update_dual_comp_position_cross_mode_request: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.Position] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.update_dual_comp_position_cross_mode_with_http_info(settle, update_dual_comp_position_cross_mode_request, **kwargs) # noqa: E501 def update_dual_comp_position_cross_mode_with_http_info(self, settle, update_dual_comp_position_cross_mode_request, **kwargs): # noqa: E501 """Switch Between Cross and Isolated Margin Modes Under Hedge Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_dual_comp_position_cross_mode_with_http_info(settle, update_dual_comp_position_cross_mode_request, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param UpdateDualCompPositionCrossModeRequest update_dual_comp_position_cross_mode_request: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.Position], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'update_dual_comp_position_cross_mode_request' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_dual_comp_position_cross_mode" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `update_dual_comp_position_cross_mode`") # noqa: E501 # verify the required parameter 'update_dual_comp_position_cross_mode_request' is set if self.api_client.client_side_validation and ('update_dual_comp_position_cross_mode_request' not in local_var_params or # noqa: E501 local_var_params['update_dual_comp_position_cross_mode_request'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `update_dual_comp_position_cross_mode_request` when calling `update_dual_comp_position_cross_mode`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'update_dual_comp_position_cross_mode_request' in local_var_params: body_params = local_var_params['update_dual_comp_position_cross_mode_request'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/dual_comp/positions/cross_mode', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Position]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def update_position_risk_limit(self, settle, contract, risk_limit, **kwargs): # noqa: E501 """Update position risk limit # noqa: E501 Under the new risk limit rules(https://www.gate.com/en/help/futures/futures-logic/22162), the position limit is related to the leverage you set; a lower leverage will result in a higher position limit. Please use the leverage adjustment api to adjust the position limit. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_position_risk_limit(settle, contract, risk_limit, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str risk_limit: New risk limit value (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.Position :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.update_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 def update_position_risk_limit_with_http_info(self, settle, contract, risk_limit, **kwargs): # noqa: E501 """Update position risk limit # noqa: E501 Under the new risk limit rules(https://www.gate.com/en/help/futures/futures-logic/22162), the position limit is related to the leverage you set; a lower leverage will result in a higher position limit. Please use the leverage adjustment api to adjust the position limit. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_position_risk_limit_with_http_info(settle, contract, risk_limit, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str risk_limit: New risk limit value (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.Position, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'risk_limit' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_position_risk_limit" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `update_position_risk_limit`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `update_position_risk_limit`") # noqa: E501 # verify the required parameter 'risk_limit' is set if self.api_client.client_side_validation and ('risk_limit' not in local_var_params or # noqa: E501 local_var_params['risk_limit'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `risk_limit` when calling `update_position_risk_limit`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'contract' in local_var_params: path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] if 'risk_limit' in local_var_params and local_var_params['risk_limit'] is not None: # noqa: E501 query_params.append(('risk_limit', local_var_params['risk_limit'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/positions/{contract}/risk_limit', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Position', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def set_dual_mode(self, settle, dual_mode, **kwargs): # noqa: E501 """Set position mode # noqa: E501 The prerequisite for changing mode is that all positions have no holdings and no pending orders # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.set_dual_mode(settle, dual_mode, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param bool dual_mode: Whether to enable Hedge Mode (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesAccount :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.set_dual_mode_with_http_info(settle, dual_mode, **kwargs) # noqa: E501 def set_dual_mode_with_http_info(self, settle, dual_mode, **kwargs): # noqa: E501 """Set position mode # noqa: E501 The prerequisite for changing mode is that all positions have no holdings and no pending orders # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.set_dual_mode_with_http_info(settle, dual_mode, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param bool dual_mode: Whether to enable Hedge Mode (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesAccount, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'dual_mode' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method set_dual_mode" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `set_dual_mode`") # noqa: E501 # verify the required parameter 'dual_mode' is set if self.api_client.client_side_validation and ('dual_mode' not in local_var_params or # noqa: E501 local_var_params['dual_mode'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `dual_mode` when calling `set_dual_mode`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'dual_mode' in local_var_params and local_var_params['dual_mode'] is not None: # noqa: E501 query_params.append(('dual_mode', local_var_params['dual_mode'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/dual_mode', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesAccount', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def set_position_mode(self, settle, position_mode, **kwargs): # noqa: E501 """Set Position Holding Mode, replacing the dual_mode interface # noqa: E501 The prerequisite for changing mode is that all positions have no holdings and no pending orders # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.set_position_mode(settle, position_mode, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str position_mode: Optional Values: single, dual, dual_plus, representing Single Direction, Dual Direction, Split Position respectively (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesAccount :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.set_position_mode_with_http_info(settle, position_mode, **kwargs) # noqa: E501 def set_position_mode_with_http_info(self, settle, position_mode, **kwargs): # noqa: E501 """Set Position Holding Mode, replacing the dual_mode interface # noqa: E501 The prerequisite for changing mode is that all positions have no holdings and no pending orders # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.set_position_mode_with_http_info(settle, position_mode, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str position_mode: Optional Values: single, dual, dual_plus, representing Single Direction, Dual Direction, Split Position respectively (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesAccount, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'position_mode' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method set_position_mode" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `set_position_mode`") # noqa: E501 # verify the required parameter 'position_mode' is set if self.api_client.client_side_validation and ('position_mode' not in local_var_params or # noqa: E501 local_var_params['position_mode'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `position_mode` when calling `set_position_mode`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'position_mode' in local_var_params and local_var_params['position_mode'] is not None: # noqa: E501 query_params.append(('position_mode', local_var_params['position_mode'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/set_position_mode', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesAccount', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_dual_mode_position(self, settle, contract, **kwargs): # noqa: E501 """Get position information in Hedge Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_dual_mode_position(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.Position] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_dual_mode_position_with_http_info(settle, contract, **kwargs) # noqa: E501 def get_dual_mode_position_with_http_info(self, settle, contract, **kwargs): # noqa: E501 """Get position information in Hedge Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_dual_mode_position_with_http_info(settle, contract, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.Position], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_dual_mode_position" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_dual_mode_position`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `get_dual_mode_position`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'contract' in local_var_params: path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/dual_comp/positions/{contract}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Position]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def update_dual_mode_position_margin(self, settle, contract, change, dual_side, **kwargs): # noqa: E501 """Update position margin in Hedge Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_dual_mode_position_margin(settle, contract, change, dual_side, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str change: Margin change amount, positive number increases, negative number decreases (required) :param str dual_side: Long or short position (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.Position] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.update_dual_mode_position_margin_with_http_info(settle, contract, change, dual_side, **kwargs) # noqa: E501 def update_dual_mode_position_margin_with_http_info(self, settle, contract, change, dual_side, **kwargs): # noqa: E501 """Update position margin in Hedge Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_dual_mode_position_margin_with_http_info(settle, contract, change, dual_side, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str change: Margin change amount, positive number increases, negative number decreases (required) :param str dual_side: Long or short position (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.Position], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'change', 'dual_side' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_dual_mode_position_margin" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `update_dual_mode_position_margin`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `update_dual_mode_position_margin`") # noqa: E501 # verify the required parameter 'change' is set if self.api_client.client_side_validation and ('change' not in local_var_params or # noqa: E501 local_var_params['change'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `change` when calling `update_dual_mode_position_margin`") # noqa: E501 # verify the required parameter 'dual_side' is set if self.api_client.client_side_validation and ('dual_side' not in local_var_params or # noqa: E501 local_var_params['dual_side'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `dual_side` when calling `update_dual_mode_position_margin`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'contract' in local_var_params: path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] if 'change' in local_var_params and local_var_params['change'] is not None: # noqa: E501 query_params.append(('change', local_var_params['change'])) # noqa: E501 if 'dual_side' in local_var_params and local_var_params['dual_side'] is not None: # noqa: E501 query_params.append(('dual_side', local_var_params['dual_side'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/dual_comp/positions/{contract}/margin', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Position]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def update_dual_mode_position_leverage(self, settle, contract, leverage, **kwargs): # noqa: E501 """Update position leverage in Hedge Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_dual_mode_position_leverage(settle, contract, leverage, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: New position leverage (required) :param str cross_leverage_limit: Cross margin leverage (valid only when `leverage` is 0) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.Position] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.update_dual_mode_position_leverage_with_http_info(settle, contract, leverage, **kwargs) # noqa: E501 def update_dual_mode_position_leverage_with_http_info(self, settle, contract, leverage, **kwargs): # noqa: E501 """Update position leverage in Hedge Mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_dual_mode_position_leverage_with_http_info(settle, contract, leverage, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str leverage: New position leverage (required) :param str cross_leverage_limit: Cross margin leverage (valid only when `leverage` is 0) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.Position], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'leverage', 'cross_leverage_limit' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_dual_mode_position_leverage" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `update_dual_mode_position_leverage`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `update_dual_mode_position_leverage`") # noqa: E501 # verify the required parameter 'leverage' is set if self.api_client.client_side_validation and ('leverage' not in local_var_params or # noqa: E501 local_var_params['leverage'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `leverage` when calling `update_dual_mode_position_leverage`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'contract' in local_var_params: path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] if 'leverage' in local_var_params and local_var_params['leverage'] is not None: # noqa: E501 query_params.append(('leverage', local_var_params['leverage'])) # noqa: E501 if 'cross_leverage_limit' in local_var_params and local_var_params['cross_leverage_limit'] is not None: # noqa: E501 query_params.append(('cross_leverage_limit', local_var_params['cross_leverage_limit'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/dual_comp/positions/{contract}/leverage', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Position]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def update_dual_mode_position_risk_limit(self, settle, contract, risk_limit, **kwargs): # noqa: E501 """Update position risk limit in Hedge Mode # noqa: E501 Under the new risk limit rules(https://www.gate.com/en/help/futures/futures-logic/22162), the position limit is related to the leverage you set; a lower leverage will result in a higher position limit. Please use the leverage adjustment api to adjust the position limit. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_dual_mode_position_risk_limit(settle, contract, risk_limit, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str risk_limit: New risk limit value (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.Position] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.update_dual_mode_position_risk_limit_with_http_info(settle, contract, risk_limit, **kwargs) # noqa: E501 def update_dual_mode_position_risk_limit_with_http_info(self, settle, contract, risk_limit, **kwargs): # noqa: E501 """Update position risk limit in Hedge Mode # noqa: E501 Under the new risk limit rules(https://www.gate.com/en/help/futures/futures-logic/22162), the position limit is related to the leverage you set; a lower leverage will result in a higher position limit. Please use the leverage adjustment api to adjust the position limit. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_dual_mode_position_risk_limit_with_http_info(settle, contract, risk_limit, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract (required) :param str risk_limit: New risk limit value (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.Position], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'risk_limit' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_dual_mode_position_risk_limit" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `update_dual_mode_position_risk_limit`") # noqa: E501 # verify the required parameter 'contract' is set if self.api_client.client_side_validation and ('contract' not in local_var_params or # noqa: E501 local_var_params['contract'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `contract` when calling `update_dual_mode_position_risk_limit`") # noqa: E501 # verify the required parameter 'risk_limit' is set if self.api_client.client_side_validation and ('risk_limit' not in local_var_params or # noqa: E501 local_var_params['risk_limit'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `risk_limit` when calling `update_dual_mode_position_risk_limit`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'contract' in local_var_params: path_params['contract'] = local_var_params['contract'] # noqa: E501 query_params = [] if 'risk_limit' in local_var_params and local_var_params['risk_limit'] is not None: # noqa: E501 query_params.append(('risk_limit', local_var_params['risk_limit'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/dual_comp/positions/{contract}/risk_limit', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Position]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_futures_orders(self, settle, status, **kwargs): # noqa: E501 """Query futures order list # noqa: E501 - Zero-fill order cannot be retrieved for 10 minutes after cancellation - Historical orders, by default, only data within the past 6 months is supported. If you need to query data for a longer period, please use `GET /futures/{settle}/orders_timerange`. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_orders(settle, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str status: Query order list based on status (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param str last_id: 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 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesOrder] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_futures_orders_with_http_info(settle, status, **kwargs) # noqa: E501 def list_futures_orders_with_http_info(self, settle, status, **kwargs): # noqa: E501 """Query futures order list # noqa: E501 - Zero-fill order cannot be retrieved for 10 minutes after cancellation - Historical orders, by default, only data within the past 6 months is supported. If you need to query data for a longer period, please use `GET /futures/{settle}/orders_timerange`. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_futures_orders_with_http_info(settle, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str status: Query order list based on status (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param str last_id: 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 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesOrder], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'status', 'contract', 'limit', 'offset', 'last_id' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_futures_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_futures_orders`") # noqa: E501 # verify the required parameter 'status' is set if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 local_var_params['status'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `status` when calling `list_futures_orders`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_orders`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_futures_orders`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_futures_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'status' in local_var_params and local_var_params['status'] is not None: # noqa: E501 query_params.append(('status', local_var_params['status'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 if 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesOrder]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def create_futures_order(self, settle, futures_order, **kwargs): # noqa: E501 """Place futures order # noqa: E501 - When placing an order, the number of contracts is specified `size`, not the number of coins. The number of coins corresponding to each contract is returned in the contract details interface `quanto_multiplier` - 0 The order that was completed cannot be obtained after 10 minutes of withdrawal, and the order will be mentioned that the order does not exist - Setting `reduce_only` to `true` can prevent the position from being penetrated when reducing the position - In single-position mode, if you need to close the position, you need to set `size` to 0 and `close` to `true` - In dual warehouse mode, - Reduce position: reduce_only=true, size is a positive number that indicates short position, negative number that indicates long position - Add number that indicates adding long positions, and negative numbers indicate adding short positions - Close position: size=0, set the direction of closing position according to auto_size, and set `reduce_only` to true at the same time - reduce_only: Make sure to only perform position reduction operations to prevent increased positions - Set `stp_act` to determine the use of a strategy that restricts user transactions. For detailed usage, refer to the body parameter `stp_act` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_futures_order(settle, futures_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesOrder futures_order: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesOrder :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.create_futures_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 def create_futures_order_with_http_info(self, settle, futures_order, **kwargs): # noqa: E501 """Place futures order # noqa: E501 - When placing an order, the number of contracts is specified `size`, not the number of coins. The number of coins corresponding to each contract is returned in the contract details interface `quanto_multiplier` - 0 The order that was completed cannot be obtained after 10 minutes of withdrawal, and the order will be mentioned that the order does not exist - Setting `reduce_only` to `true` can prevent the position from being penetrated when reducing the position - In single-position mode, if you need to close the position, you need to set `size` to 0 and `close` to `true` - In dual warehouse mode, - Reduce position: reduce_only=true, size is a positive number that indicates short position, negative number that indicates long position - Add number that indicates adding long positions, and negative numbers indicate adding short positions - Close position: size=0, set the direction of closing position according to auto_size, and set `reduce_only` to true at the same time - reduce_only: Make sure to only perform position reduction operations to prevent increased positions - Set `stp_act` to determine the use of a strategy that restricts user transactions. For detailed usage, refer to the body parameter `stp_act` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_futures_order_with_http_info(settle, futures_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesOrder futures_order: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesOrder, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'futures_order', 'x_gate_exptime' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_futures_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `create_futures_order`") # noqa: E501 # verify the required parameter 'futures_order' is set if self.api_client.client_side_validation and ('futures_order' not in local_var_params or # noqa: E501 local_var_params['futures_order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `futures_order` when calling `create_futures_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} if 'x_gate_exptime' in local_var_params: header_params['x-gate-exptime'] = local_var_params['x_gate_exptime'] # noqa: E501 form_params = [] local_var_files = {} body_params = None if 'futures_order' in local_var_params: body_params = local_var_params['futures_order'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesOrder', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def cancel_futures_orders(self, settle, **kwargs): # noqa: E501 """Cancel all orders with 'open' status # noqa: E501 Zero-fill orders cannot be retrieved 10 minutes after order cancellation # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_futures_orders(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param str contract: Contract Identifier; if specified, only cancel pending orders related to this contract :param str action_mode: Processing Mode When placing an order, different fields are returned based on the action_mode - `ACK`: Asynchronous mode, returns only key order fields - `RESULT`: No clearing information - `FULL`: Full mode (default) :param str side: Specify all buy orders or all sell orders, both are included if not specified. Set to bid to cancel all buy orders, set to ask to cancel all sell orders :param bool exclude_reduce_only: Whether to exclude reduce-only orders :param str text: Remark for order cancellation :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesOrder] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.cancel_futures_orders_with_http_info(settle, **kwargs) # noqa: E501 def cancel_futures_orders_with_http_info(self, settle, **kwargs): # noqa: E501 """Cancel all orders with 'open' status # noqa: E501 Zero-fill orders cannot be retrieved 10 minutes after order cancellation # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_futures_orders_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param str contract: Contract Identifier; if specified, only cancel pending orders related to this contract :param str action_mode: Processing Mode When placing an order, different fields are returned based on the action_mode - `ACK`: Asynchronous mode, returns only key order fields - `RESULT`: No clearing information - `FULL`: Full mode (default) :param str side: Specify all buy orders or all sell orders, both are included if not specified. Set to bid to cancel all buy orders, set to ask to cancel all sell orders :param bool exclude_reduce_only: Whether to exclude reduce-only orders :param str text: Remark for order cancellation :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesOrder], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'x_gate_exptime', 'contract', 'action_mode', 'side', 'exclude_reduce_only', 'text' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_futures_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `cancel_futures_orders`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'action_mode' in local_var_params and local_var_params['action_mode'] is not None: # noqa: E501 query_params.append(('action_mode', local_var_params['action_mode'])) # noqa: E501 if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 query_params.append(('side', local_var_params['side'])) # noqa: E501 if 'exclude_reduce_only' in local_var_params and local_var_params['exclude_reduce_only'] is not None: # noqa: E501 query_params.append(('exclude_reduce_only', local_var_params['exclude_reduce_only'])) # noqa: E501 if 'text' in local_var_params and local_var_params['text'] is not None: # noqa: E501 query_params.append(('text', local_var_params['text'])) # noqa: E501 header_params = {} if 'x_gate_exptime' in local_var_params: header_params['x-gate-exptime'] = local_var_params['x_gate_exptime'] # noqa: E501 form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/orders', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesOrder]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_orders_with_time_range(self, settle, **kwargs): # noqa: E501 """Query futures order list by time range # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_orders_with_time_range(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesOrderTimerange] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_orders_with_time_range_with_http_info(settle, **kwargs) # noqa: E501 def get_orders_with_time_range_with_http_info(self, settle, **kwargs): # noqa: E501 """Query futures order list by time range # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_orders_with_time_range_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesOrderTimerange], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', '_from', 'to', 'limit', 'offset' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_orders_with_time_range" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_orders_with_time_range`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `get_orders_with_time_range`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `get_orders_with_time_range`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `get_orders_with_time_range`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/orders_timerange', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesOrderTimerange]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def create_batch_futures_order(self, settle, futures_order, **kwargs): # noqa: E501 """Place batch futures orders # noqa: E501 - Up to 10 orders per request - If any of the order's parameters are missing or in the wrong format, all of them will not be executed, and a http status 400 error will be returned directly - If the parameters are checked and passed, all are executed. Even if there is a business logic error in the middle (such as insufficient funds), it will not affect other execution orders - The returned result is in array format, and the order corresponds to the orders in the request body - In the returned result, the `succeeded` field of type bool indicates whether the execution was successful or not - If the execution is successful, the normal order content is included; if the execution fails, the `label` field is included to indicate the cause of the error - In the rate limiting, each order is counted individually # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_batch_futures_order(settle, futures_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param list[FuturesOrder] futures_order: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.BatchFuturesOrder] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.create_batch_futures_order_with_http_info(settle, futures_order, **kwargs) # noqa: E501 def create_batch_futures_order_with_http_info(self, settle, futures_order, **kwargs): # noqa: E501 """Place batch futures orders # noqa: E501 - Up to 10 orders per request - If any of the order's parameters are missing or in the wrong format, all of them will not be executed, and a http status 400 error will be returned directly - If the parameters are checked and passed, all are executed. Even if there is a business logic error in the middle (such as insufficient funds), it will not affect other execution orders - The returned result is in array format, and the order corresponds to the orders in the request body - In the returned result, the `succeeded` field of type bool indicates whether the execution was successful or not - If the execution is successful, the normal order content is included; if the execution fails, the `label` field is included to indicate the cause of the error - In the rate limiting, each order is counted individually # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_batch_futures_order_with_http_info(settle, futures_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param list[FuturesOrder] futures_order: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.BatchFuturesOrder], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'futures_order', 'x_gate_exptime' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_batch_futures_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `create_batch_futures_order`") # noqa: E501 # verify the required parameter 'futures_order' is set if self.api_client.client_side_validation and ('futures_order' not in local_var_params or # noqa: E501 local_var_params['futures_order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `futures_order` when calling `create_batch_futures_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} if 'x_gate_exptime' in local_var_params: header_params['x-gate-exptime'] = local_var_params['x_gate_exptime'] # noqa: E501 form_params = [] local_var_files = {} body_params = None if 'futures_order' in local_var_params: body_params = local_var_params['futures_order'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/batch_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[BatchFuturesOrder]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_futures_order(self, settle, order_id, **kwargs): # noqa: E501 """Query single order details # noqa: E501 - Zero-fill order cannot be retrieved for 10 minutes after cancellation - Historical orders, by default, only data within the past 6 months is supported. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_futures_order(settle, order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: The order ID returned when the order is created successfully, or the custom ID specified by the user when creating the order (i.e. the `text` field). When using the custom `text` field: 1. If the order was not filled and has been cancelled, after 60 seconds you cannot query the order by `text`; continuing to use `text` returns error ORDER_NOT_FOUND. 2. If the order was fully or partially filled, you can query the order by `text` indefinitely. (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesOrder :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def get_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Query single order details # noqa: E501 - Zero-fill order cannot be retrieved for 10 minutes after cancellation - Historical orders, by default, only data within the past 6 months is supported. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_futures_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: The order ID returned when the order is created successfully, or the custom ID specified by the user when creating the order (i.e. the `text` field). When using the custom `text` field: 1. If the order was not filled and has been cancelled, after 60 seconds you cannot query the order by `text`; continuing to use `text` returns error ORDER_NOT_FOUND. 2. If the order was fully or partially filled, you can query the order by `text` indefinitely. (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesOrder, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'order_id' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_futures_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_order`") # noqa: E501 # verify the required parameter 'order_id' is set if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 local_var_params['order_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `order_id` when calling `get_futures_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'order_id' in local_var_params: path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/orders/{order_id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesOrder', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def amend_futures_order(self, settle, order_id, futures_order_amendment, **kwargs): # noqa: E501 """Amend single order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.amend_futures_order(settle, order_id, futures_order_amendment, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: The order ID returned when the order is created successfully, or the custom ID specified by the user when creating the order (i.e. the `text` field). When using the custom `text` field: 1. If the order was not filled and has been cancelled, after 60 seconds you cannot query the order by `text`; continuing to use `text` returns error ORDER_NOT_FOUND. 2. If the order was fully or partially filled, you can query the order by `text` indefinitely. (required) :param FuturesOrderAmendment futures_order_amendment: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesOrder :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.amend_futures_order_with_http_info(settle, order_id, futures_order_amendment, **kwargs) # noqa: E501 def amend_futures_order_with_http_info(self, settle, order_id, futures_order_amendment, **kwargs): # noqa: E501 """Amend single order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.amend_futures_order_with_http_info(settle, order_id, futures_order_amendment, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: The order ID returned when the order is created successfully, or the custom ID specified by the user when creating the order (i.e. the `text` field). When using the custom `text` field: 1. If the order was not filled and has been cancelled, after 60 seconds you cannot query the order by `text`; continuing to use `text` returns error ORDER_NOT_FOUND. 2. If the order was fully or partially filled, you can query the order by `text` indefinitely. (required) :param FuturesOrderAmendment futures_order_amendment: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesOrder, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'order_id', 'futures_order_amendment', 'x_gate_exptime' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method amend_futures_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `amend_futures_order`") # noqa: E501 # verify the required parameter 'order_id' is set if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 local_var_params['order_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `order_id` when calling `amend_futures_order`") # noqa: E501 # verify the required parameter 'futures_order_amendment' is set if self.api_client.client_side_validation and ('futures_order_amendment' not in local_var_params or # noqa: E501 local_var_params['futures_order_amendment'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `futures_order_amendment` when calling `amend_futures_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'order_id' in local_var_params: path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] header_params = {} if 'x_gate_exptime' in local_var_params: header_params['x-gate-exptime'] = local_var_params['x_gate_exptime'] # noqa: E501 form_params = [] local_var_files = {} body_params = None if 'futures_order_amendment' in local_var_params: body_params = local_var_params['futures_order_amendment'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/orders/{order_id}', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesOrder', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def cancel_futures_order(self, settle, order_id, **kwargs): # noqa: E501 """Cancel single order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_futures_order(settle, order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: The order ID returned when the order is created successfully, or the custom ID specified by the user when creating the order (i.e. the `text` field). When using the custom `text` field: 1. If the order was not filled and has been cancelled, after 60 seconds you cannot query the order by `text`; continuing to use `text` returns error ORDER_NOT_FOUND. 2. If the order was fully or partially filled, you can query the order by `text` indefinitely. (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param str action_mode: Processing Mode When placing an order, different fields are returned based on the action_mode - `ACK`: Asynchronous mode, returns only key order fields - `RESULT`: No clearing information - `FULL`: Full mode (default) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesOrder :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.cancel_futures_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def cancel_futures_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Cancel single order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_futures_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str order_id: The order ID returned when the order is created successfully, or the custom ID specified by the user when creating the order (i.e. the `text` field). When using the custom `text` field: 1. If the order was not filled and has been cancelled, after 60 seconds you cannot query the order by `text`; continuing to use `text` returns error ORDER_NOT_FOUND. 2. If the order was fully or partially filled, you can query the order by `text` indefinitely. (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param str action_mode: Processing Mode When placing an order, different fields are returned based on the action_mode - `ACK`: Asynchronous mode, returns only key order fields - `RESULT`: No clearing information - `FULL`: Full mode (default) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesOrder, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'order_id', 'x_gate_exptime', 'action_mode' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_futures_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `cancel_futures_order`") # noqa: E501 # verify the required parameter 'order_id' is set if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 local_var_params['order_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_futures_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'order_id' in local_var_params: path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] if 'action_mode' in local_var_params and local_var_params['action_mode'] is not None: # noqa: E501 query_params.append(('action_mode', local_var_params['action_mode'])) # noqa: E501 header_params = {} if 'x_gate_exptime' in local_var_params: header_params['x-gate-exptime'] = local_var_params['x_gate_exptime'] # noqa: E501 form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/orders/{order_id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesOrder', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_my_trades(self, settle, **kwargs): # noqa: E501 """Query personal trading records # noqa: E501 By default, only supports querying data within 6 months. For older data, use `GET /futures/{settle}/my_trades_timerange` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_my_trades(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int order: Futures order ID, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param str last_id: Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. If you need to iterate through and retrieve more records, we recommend using 'GET /futures/{settle}/my_trades_timerange'. :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.MyFuturesTrade] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_my_trades_with_http_info(settle, **kwargs) # noqa: E501 def get_my_trades_with_http_info(self, settle, **kwargs): # noqa: E501 """Query personal trading records # noqa: E501 By default, only supports querying data within 6 months. For older data, use `GET /futures/{settle}/my_trades_timerange` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_my_trades_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int order: Futures order ID, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param str last_id: Specify the starting point for this list based on a previously retrieved id This parameter is deprecated. If you need to iterate through and retrieve more records, we recommend using 'GET /futures/{settle}/my_trades_timerange'. :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.MyFuturesTrade], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'order', 'limit', 'offset', 'last_id' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_my_trades" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_my_trades`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `get_my_trades`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `get_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `get_my_trades`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'order' in local_var_params and local_var_params['order'] is not None: # noqa: E501 query_params.append(('order', local_var_params['order'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 if 'last_id' in local_var_params and local_var_params['last_id'] is not None: # noqa: E501 query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/my_trades', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[MyFuturesTrade]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_my_trades_with_time_range(self, settle, **kwargs): # noqa: E501 """Query personal trading records by time range # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_my_trades_with_time_range(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param str role: Query role, maker or taker :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.MyFuturesTradeTimeRange] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_my_trades_with_time_range_with_http_info(settle, **kwargs) # noqa: E501 def get_my_trades_with_time_range_with_http_info(self, settle, **kwargs): # noqa: E501 """Query personal trading records by time range # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_my_trades_with_time_range_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param str role: Query role, maker or taker :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.MyFuturesTradeTimeRange], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', '_from', 'to', 'limit', 'offset', 'role' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_my_trades_with_time_range" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_my_trades_with_time_range`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `get_my_trades_with_time_range`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `get_my_trades_with_time_range`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `get_my_trades_with_time_range`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 if 'role' in local_var_params and local_var_params['role'] is not None: # noqa: E501 query_params.append(('role', local_var_params['role'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/my_trades_timerange', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[MyFuturesTradeTimeRange]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_position_close(self, settle, **kwargs): # noqa: E501 """Query position close history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_position_close(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param str side: Query side. long or shot :param str pnl: Query profit or loss :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.PositionClose] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_position_close_with_http_info(settle, **kwargs) # noqa: E501 def list_position_close_with_http_info(self, settle, **kwargs): # noqa: E501 """Query position close history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_position_close_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param str side: Query side. long or shot :param str pnl: Query profit or loss :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.PositionClose], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'limit', 'offset', '_from', 'to', 'side', 'pnl' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_position_close" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_position_close`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_position_close`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_position_close`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_position_close`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 query_params.append(('side', local_var_params['side'])) # noqa: E501 if 'pnl' in local_var_params and local_var_params['pnl'] is not None: # noqa: E501 query_params.append(('pnl', local_var_params['pnl'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/position_close', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[PositionClose]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_liquidates(self, settle, **kwargs): # noqa: E501 """Query liquidation history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_liquidates(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int at: Specify liquidation timestamp :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesLiquidate] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_liquidates_with_http_info(settle, **kwargs) # noqa: E501 def list_liquidates_with_http_info(self, settle, **kwargs): # noqa: E501 """Query liquidation history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_liquidates_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int at: Specify liquidation timestamp :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesLiquidate], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'limit', 'offset', '_from', 'to', 'at' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_liquidates" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_liquidates`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_liquidates`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_liquidates`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_liquidates`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 if 'at' in local_var_params and local_var_params['at'] is not None: # noqa: E501 query_params.append(('at', local_var_params['at'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/liquidates', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesLiquidate]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_auto_deleverages(self, settle, **kwargs): # noqa: E501 """Query ADL auto-deleveraging order information # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_auto_deleverages(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int at: Specify auto-deleveraging timestamp :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesAutoDeleverage] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_auto_deleverages_with_http_info(settle, **kwargs) # noqa: E501 def list_auto_deleverages_with_http_info(self, settle, **kwargs): # noqa: E501 """Query ADL auto-deleveraging order information # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_auto_deleverages_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param int _from: 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) :param int to: Termination Timestamp Specify the end time. If not specified, it defaults to the current time, and the time format is a Unix timestamp :param int at: Specify auto-deleveraging timestamp :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesAutoDeleverage], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'limit', 'offset', '_from', 'to', 'at' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_auto_deleverages" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_auto_deleverages`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_auto_deleverages`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_auto_deleverages`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_auto_deleverages`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 if 'at' in local_var_params and local_var_params['at'] is not None: # noqa: E501 query_params.append(('at', local_var_params['at'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/auto_deleverages', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesAutoDeleverage]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def countdown_cancel_all_futures(self, settle, countdown_cancel_all_futures_task, **kwargs): # noqa: E501 """Countdown cancel orders # noqa: E501 Heartbeat detection for contract orders: When the user-set `timeout` time is reached, if neither the existing countdown is canceled nor a new countdown is set, the relevant contract orders will be automatically canceled. This API can be called repeatedly to or cancel the countdown. Usage example: Repeatedly call this API at 30-second intervals, setting the `timeout` to 30 (seconds) each time. If this API is not called again within 30 seconds, all open orders on your specified `market` will be automatically canceled. If the `timeout` is set to 0 within 30 seconds, the countdown timer will terminate, and the automatic order cancellation function will be disabled. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.countdown_cancel_all_futures(settle, countdown_cancel_all_futures_task, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param CountdownCancelAllFuturesTask countdown_cancel_all_futures_task: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.TriggerTime :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.countdown_cancel_all_futures_with_http_info(settle, countdown_cancel_all_futures_task, **kwargs) # noqa: E501 def countdown_cancel_all_futures_with_http_info(self, settle, countdown_cancel_all_futures_task, **kwargs): # noqa: E501 """Countdown cancel orders # noqa: E501 Heartbeat detection for contract orders: When the user-set `timeout` time is reached, if neither the existing countdown is canceled nor a new countdown is set, the relevant contract orders will be automatically canceled. This API can be called repeatedly to or cancel the countdown. Usage example: Repeatedly call this API at 30-second intervals, setting the `timeout` to 30 (seconds) each time. If this API is not called again within 30 seconds, all open orders on your specified `market` will be automatically canceled. If the `timeout` is set to 0 within 30 seconds, the countdown timer will terminate, and the automatic order cancellation function will be disabled. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.countdown_cancel_all_futures_with_http_info(settle, countdown_cancel_all_futures_task, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param CountdownCancelAllFuturesTask countdown_cancel_all_futures_task: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.TriggerTime, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'countdown_cancel_all_futures_task' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method countdown_cancel_all_futures" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `countdown_cancel_all_futures`") # noqa: E501 # verify the required parameter 'countdown_cancel_all_futures_task' is set if self.api_client.client_side_validation and ('countdown_cancel_all_futures_task' not in local_var_params or # noqa: E501 local_var_params['countdown_cancel_all_futures_task'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `countdown_cancel_all_futures_task` when calling `countdown_cancel_all_futures`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'countdown_cancel_all_futures_task' in local_var_params: body_params = local_var_params['countdown_cancel_all_futures_task'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/countdown_cancel_all', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TriggerTime', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_futures_fee(self, settle, **kwargs): # noqa: E501 """Query futures market trading fee rates # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_futures_fee(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: dict(str, gate_api.FuturesFee) :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_futures_fee_with_http_info(settle, **kwargs) # noqa: E501 def get_futures_fee_with_http_info(self, settle, **kwargs): # noqa: E501 """Query futures market trading fee rates # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_futures_fee_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(dict(str, gate_api.FuturesFee), status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_futures_fee" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_fee`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/fee', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='dict(str, FuturesFee)', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def cancel_batch_future_orders(self, settle, request_body, **kwargs): # noqa: E501 """Cancel batch orders by specified ID list # noqa: E501 Multiple different order IDs can be specified. A maximum of 20 records can be cancelled in one request # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_batch_future_orders(settle, request_body, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param list[str] request_body: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FutureCancelOrderResult] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.cancel_batch_future_orders_with_http_info(settle, request_body, **kwargs) # noqa: E501 def cancel_batch_future_orders_with_http_info(self, settle, request_body, **kwargs): # noqa: E501 """Cancel batch orders by specified ID list # noqa: E501 Multiple different order IDs can be specified. A maximum of 20 records can be cancelled in one request # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_batch_future_orders_with_http_info(settle, request_body, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param list[str] request_body: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FutureCancelOrderResult], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'request_body', 'x_gate_exptime' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_batch_future_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `cancel_batch_future_orders`") # noqa: E501 # verify the required parameter 'request_body' is set if self.api_client.client_side_validation and ('request_body' not in local_var_params or # noqa: E501 local_var_params['request_body'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `request_body` when calling `cancel_batch_future_orders`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} if 'x_gate_exptime' in local_var_params: header_params['x-gate-exptime'] = local_var_params['x_gate_exptime'] # noqa: E501 form_params = [] local_var_files = {} body_params = None if 'request_body' in local_var_params: body_params = local_var_params['request_body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/batch_cancel_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FutureCancelOrderResult]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def amend_batch_future_orders(self, settle, batch_amend_order_req, **kwargs): # noqa: E501 """Batch modify orders by specified IDs # noqa: E501 Multiple different order IDs can be specified. A maximum of 10 orders can be modified in one request # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.amend_batch_future_orders(settle, batch_amend_order_req, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param list[BatchAmendOrderReq] batch_amend_order_req: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.BatchFuturesOrder] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.amend_batch_future_orders_with_http_info(settle, batch_amend_order_req, **kwargs) # noqa: E501 def amend_batch_future_orders_with_http_info(self, settle, batch_amend_order_req, **kwargs): # noqa: E501 """Batch modify orders by specified IDs # noqa: E501 Multiple different order IDs can be specified. A maximum of 10 orders can be modified in one request # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.amend_batch_future_orders_with_http_info(settle, batch_amend_order_req, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param list[BatchAmendOrderReq] batch_amend_order_req: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.BatchFuturesOrder], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'batch_amend_order_req', 'x_gate_exptime' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method amend_batch_future_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `amend_batch_future_orders`") # noqa: E501 # verify the required parameter 'batch_amend_order_req' is set if self.api_client.client_side_validation and ('batch_amend_order_req' not in local_var_params or # noqa: E501 local_var_params['batch_amend_order_req'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `batch_amend_order_req` when calling `amend_batch_future_orders`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} if 'x_gate_exptime' in local_var_params: header_params['x-gate-exptime'] = local_var_params['x_gate_exptime'] # noqa: E501 form_params = [] local_var_files = {} body_params = None if 'batch_amend_order_req' in local_var_params: body_params = local_var_params['batch_amend_order_req'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/batch_amend_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[BatchFuturesOrder]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_futures_risk_limit_table(self, settle, table_id, **kwargs): # noqa: E501 """Query risk limit table by table_id # noqa: E501 Just pass table_id # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_futures_risk_limit_table(settle, table_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str table_id: Risk limit table ID (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesRiskLimitTier] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_futures_risk_limit_table_with_http_info(settle, table_id, **kwargs) # noqa: E501 def get_futures_risk_limit_table_with_http_info(self, settle, table_id, **kwargs): # noqa: E501 """Query risk limit table by table_id # noqa: E501 Just pass table_id # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_futures_risk_limit_table_with_http_info(settle, table_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str table_id: Risk limit table ID (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesRiskLimitTier], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'table_id' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_futures_risk_limit_table" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_futures_risk_limit_table`") # noqa: E501 # verify the required parameter 'table_id' is set if self.api_client.client_side_validation and ('table_id' not in local_var_params or # noqa: E501 local_var_params['table_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `table_id` when calling `get_futures_risk_limit_table`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'table_id' in local_var_params and local_var_params['table_id'] is not None: # noqa: E501 query_params.append(('table_id', local_var_params['table_id'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/risk_limit_table', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesRiskLimitTier]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def create_futures_bbo_order(self, settle, futures_bbo_order, **kwargs): # noqa: E501 """Level-based BBO Contract Order Placement # noqa: E501 Compared to the futures trading order placement interface (futures/{settle}/orders), it adds the `level` and `direction` parameters. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_futures_bbo_order(settle, futures_bbo_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesBBOOrder futures_bbo_order: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesOrder :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.create_futures_bbo_order_with_http_info(settle, futures_bbo_order, **kwargs) # noqa: E501 def create_futures_bbo_order_with_http_info(self, settle, futures_bbo_order, **kwargs): # noqa: E501 """Level-based BBO Contract Order Placement # noqa: E501 Compared to the futures trading order placement interface (futures/{settle}/orders), it adds the `level` and `direction` parameters. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_futures_bbo_order_with_http_info(settle, futures_bbo_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesBBOOrder futures_bbo_order: (required) :param str x_gate_exptime: Specify the expiration time (milliseconds); if the GATE receives the request time greater than the expiration time, the request will be rejected :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesOrder, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'futures_bbo_order', 'x_gate_exptime' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_futures_bbo_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `create_futures_bbo_order`") # noqa: E501 # verify the required parameter 'futures_bbo_order' is set if self.api_client.client_side_validation and ('futures_bbo_order' not in local_var_params or # noqa: E501 local_var_params['futures_bbo_order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `futures_bbo_order` when calling `create_futures_bbo_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} if 'x_gate_exptime' in local_var_params: header_params['x-gate-exptime'] = local_var_params['x_gate_exptime'] # noqa: E501 form_params = [] local_var_files = {} body_params = None if 'futures_bbo_order' in local_var_params: body_params = local_var_params['futures_bbo_order'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/bbo_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesOrder', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def create_trail_order(self, settle, create_trail_order, **kwargs): # noqa: E501 """Create trail order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_trail_order(settle, create_trail_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param CreateTrailOrder create_trail_order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.CreateTrailOrderResponse :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.create_trail_order_with_http_info(settle, create_trail_order, **kwargs) # noqa: E501 def create_trail_order_with_http_info(self, settle, create_trail_order, **kwargs): # noqa: E501 """Create trail order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_trail_order_with_http_info(settle, create_trail_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param CreateTrailOrder create_trail_order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.CreateTrailOrderResponse, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'create_trail_order' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_trail_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `create_trail_order`") # noqa: E501 # verify the required parameter 'create_trail_order' is set if self.api_client.client_side_validation and ('create_trail_order' not in local_var_params or # noqa: E501 local_var_params['create_trail_order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `create_trail_order` when calling `create_trail_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'create_trail_order' in local_var_params: body_params = local_var_params['create_trail_order'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/trail/create', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CreateTrailOrderResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def stop_trail_order(self, settle, stop_trail_order, **kwargs): # noqa: E501 """Terminate trail order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.stop_trail_order(settle, stop_trail_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param StopTrailOrder stop_trail_order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.TrailOrderResponse :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.stop_trail_order_with_http_info(settle, stop_trail_order, **kwargs) # noqa: E501 def stop_trail_order_with_http_info(self, settle, stop_trail_order, **kwargs): # noqa: E501 """Terminate trail order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.stop_trail_order_with_http_info(settle, stop_trail_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param StopTrailOrder stop_trail_order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.TrailOrderResponse, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'stop_trail_order' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method stop_trail_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `stop_trail_order`") # noqa: E501 # verify the required parameter 'stop_trail_order' is set if self.api_client.client_side_validation and ('stop_trail_order' not in local_var_params or # noqa: E501 local_var_params['stop_trail_order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `stop_trail_order` when calling `stop_trail_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'stop_trail_order' in local_var_params: body_params = local_var_params['stop_trail_order'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/trail/stop', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TrailOrderResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def stop_all_trail_orders(self, settle, stop_all_trail_orders, **kwargs): # noqa: E501 """Batch terminate trail orders # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.stop_all_trail_orders(settle, stop_all_trail_orders, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param StopAllTrailOrders stop_all_trail_orders: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.TrailOrderListResponse :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.stop_all_trail_orders_with_http_info(settle, stop_all_trail_orders, **kwargs) # noqa: E501 def stop_all_trail_orders_with_http_info(self, settle, stop_all_trail_orders, **kwargs): # noqa: E501 """Batch terminate trail orders # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.stop_all_trail_orders_with_http_info(settle, stop_all_trail_orders, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param StopAllTrailOrders stop_all_trail_orders: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.TrailOrderListResponse, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'stop_all_trail_orders' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method stop_all_trail_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `stop_all_trail_orders`") # noqa: E501 # verify the required parameter 'stop_all_trail_orders' is set if self.api_client.client_side_validation and ('stop_all_trail_orders' not in local_var_params or # noqa: E501 local_var_params['stop_all_trail_orders'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `stop_all_trail_orders` when calling `stop_all_trail_orders`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'stop_all_trail_orders' in local_var_params: body_params = local_var_params['stop_all_trail_orders'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/trail/stop_all', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TrailOrderListResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_trail_orders(self, settle, **kwargs): # noqa: E501 """Get trail order list # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_trail_orders(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Contract name :param bool is_finished: Whether historical order :param int start_at: Start time of time range :param int end_at: End time of time range :param int page_num: Page number, starting from 1 :param int page_size: Number of items per page :param int sort_by: Common sort field, 1-creation time, 2-end time :param bool hide_cancel: Hide cancelled orders :param int related_position: Associated position, if provided, only return orders associated with this position, 1-long, 2-short :param bool sort_by_trigger: Sort by trigger price and activation price, easy to trigger or activate first, only for current orders associated with positions :param int reduce_only: Whether reduce only, 1-yes, 2-no :param int side: Direction, 1-long position, 2-short position :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.TrailOrderListResponse :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_trail_orders_with_http_info(settle, **kwargs) # noqa: E501 def get_trail_orders_with_http_info(self, settle, **kwargs): # noqa: E501 """Get trail order list # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_trail_orders_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Contract name :param bool is_finished: Whether historical order :param int start_at: Start time of time range :param int end_at: End time of time range :param int page_num: Page number, starting from 1 :param int page_size: Number of items per page :param int sort_by: Common sort field, 1-creation time, 2-end time :param bool hide_cancel: Hide cancelled orders :param int related_position: Associated position, if provided, only return orders associated with this position, 1-long, 2-short :param bool sort_by_trigger: Sort by trigger price and activation price, easy to trigger or activate first, only for current orders associated with positions :param int reduce_only: Whether reduce only, 1-yes, 2-no :param int side: Direction, 1-long position, 2-short position :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.TrailOrderListResponse, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract', 'is_finished', 'start_at', 'end_at', 'page_num', 'page_size', 'sort_by', 'hide_cancel', 'related_position', 'sort_by_trigger', 'reduce_only', 'side' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_trail_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_trail_orders`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'is_finished' in local_var_params and local_var_params['is_finished'] is not None: # noqa: E501 query_params.append(('is_finished', local_var_params['is_finished'])) # noqa: E501 if 'start_at' in local_var_params and local_var_params['start_at'] is not None: # noqa: E501 query_params.append(('start_at', local_var_params['start_at'])) # noqa: E501 if 'end_at' in local_var_params and local_var_params['end_at'] is not None: # noqa: E501 query_params.append(('end_at', local_var_params['end_at'])) # noqa: E501 if 'page_num' in local_var_params and local_var_params['page_num'] is not None: # noqa: E501 query_params.append(('page_num', local_var_params['page_num'])) # noqa: E501 if 'page_size' in local_var_params and local_var_params['page_size'] is not None: # noqa: E501 query_params.append(('page_size', local_var_params['page_size'])) # noqa: E501 if 'sort_by' in local_var_params and local_var_params['sort_by'] is not None: # noqa: E501 query_params.append(('sort_by', local_var_params['sort_by'])) # noqa: E501 if 'hide_cancel' in local_var_params and local_var_params['hide_cancel'] is not None: # noqa: E501 query_params.append(('hide_cancel', local_var_params['hide_cancel'])) # noqa: E501 if 'related_position' in local_var_params and local_var_params['related_position'] is not None: # noqa: E501 query_params.append(('related_position', local_var_params['related_position'])) # noqa: E501 if 'sort_by_trigger' in local_var_params and local_var_params['sort_by_trigger'] is not None: # noqa: E501 query_params.append(('sort_by_trigger', local_var_params['sort_by_trigger'])) # noqa: E501 if 'reduce_only' in local_var_params and local_var_params['reduce_only'] is not None: # noqa: E501 query_params.append(('reduce_only', local_var_params['reduce_only'])) # noqa: E501 if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 query_params.append(('side', local_var_params['side'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/trail/list', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TrailOrderListResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_trail_order_detail(self, settle, id, **kwargs): # noqa: E501 """Get trail order details # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_trail_order_detail(settle, id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int id: Order ID (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.TrailOrderDetailResponse :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_trail_order_detail_with_http_info(settle, id, **kwargs) # noqa: E501 def get_trail_order_detail_with_http_info(self, settle, id, **kwargs): # noqa: E501 """Get trail order details # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_trail_order_detail_with_http_info(settle, id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int id: Order ID (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.TrailOrderDetailResponse, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'id' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_trail_order_detail" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_trail_order_detail`") # noqa: E501 # verify the required parameter 'id' is set if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 local_var_params['id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `id` when calling `get_trail_order_detail`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'id' in local_var_params and local_var_params['id'] is not None: # noqa: E501 query_params.append(('id', local_var_params['id'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/trail/detail', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TrailOrderDetailResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def update_trail_order(self, settle, update_trail_order, **kwargs): # noqa: E501 """Update trail order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_trail_order(settle, update_trail_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param UpdateTrailOrder update_trail_order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.TrailOrderResponse :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.update_trail_order_with_http_info(settle, update_trail_order, **kwargs) # noqa: E501 def update_trail_order_with_http_info(self, settle, update_trail_order, **kwargs): # noqa: E501 """Update trail order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_trail_order_with_http_info(settle, update_trail_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param UpdateTrailOrder update_trail_order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.TrailOrderResponse, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'update_trail_order' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_trail_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `update_trail_order`") # noqa: E501 # verify the required parameter 'update_trail_order' is set if self.api_client.client_side_validation and ('update_trail_order' not in local_var_params or # noqa: E501 local_var_params['update_trail_order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `update_trail_order` when calling `update_trail_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'update_trail_order' in local_var_params: body_params = local_var_params['update_trail_order'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/trail/update', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TrailOrderResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_trail_order_change_log(self, settle, id, **kwargs): # noqa: E501 """Get trail order user modification records # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_trail_order_change_log(settle, id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int id: Order ID (required) :param int page_num: Page number, starting from 1 :param int page_size: Number of items per page :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.TrailOrderChangeLogResponse :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_trail_order_change_log_with_http_info(settle, id, **kwargs) # noqa: E501 def get_trail_order_change_log_with_http_info(self, settle, id, **kwargs): # noqa: E501 """Get trail order user modification records # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_trail_order_change_log_with_http_info(settle, id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int id: Order ID (required) :param int page_num: Page number, starting from 1 :param int page_size: Number of items per page :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.TrailOrderChangeLogResponse, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'id', 'page_num', 'page_size' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_trail_order_change_log" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_trail_order_change_log`") # noqa: E501 # verify the required parameter 'id' is set if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 local_var_params['id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `id` when calling `get_trail_order_change_log`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'id' in local_var_params and local_var_params['id'] is not None: # noqa: E501 query_params.append(('id', local_var_params['id'])) # noqa: E501 if 'page_num' in local_var_params and local_var_params['page_num'] is not None: # noqa: E501 query_params.append(('page_num', local_var_params['page_num'])) # noqa: E501 if 'page_size' in local_var_params and local_var_params['page_size'] is not None: # noqa: E501 query_params.append(('page_size', local_var_params['page_size'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/trail/change_log', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TrailOrderChangeLogResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def create_chase_order(self, settle, create_chase_order_req, **kwargs): # noqa: E501 """Create a chase order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_chase_order(settle, create_chase_order_req, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param CreateChaseOrderReq create_chase_order_req: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.CreateChaseOrderResp :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.create_chase_order_with_http_info(settle, create_chase_order_req, **kwargs) # noqa: E501 def create_chase_order_with_http_info(self, settle, create_chase_order_req, **kwargs): # noqa: E501 """Create a chase order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_chase_order_with_http_info(settle, create_chase_order_req, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param CreateChaseOrderReq create_chase_order_req: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.CreateChaseOrderResp, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'create_chase_order_req' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_chase_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `create_chase_order`") # noqa: E501 # verify the required parameter 'create_chase_order_req' is set if self.api_client.client_side_validation and ('create_chase_order_req' not in local_var_params or # noqa: E501 local_var_params['create_chase_order_req'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `create_chase_order_req` when calling `create_chase_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'create_chase_order_req' in local_var_params: body_params = local_var_params['create_chase_order_req'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/chase/create', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CreateChaseOrderResp', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def stop_chase_order(self, settle, stop_chase_order_req, **kwargs): # noqa: E501 """Stop a chase order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.stop_chase_order(settle, stop_chase_order_req, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param StopChaseOrderReq stop_chase_order_req: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.StopChaseOrderResp :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.stop_chase_order_with_http_info(settle, stop_chase_order_req, **kwargs) # noqa: E501 def stop_chase_order_with_http_info(self, settle, stop_chase_order_req, **kwargs): # noqa: E501 """Stop a chase order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.stop_chase_order_with_http_info(settle, stop_chase_order_req, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param StopChaseOrderReq stop_chase_order_req: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.StopChaseOrderResp, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'stop_chase_order_req' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method stop_chase_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `stop_chase_order`") # noqa: E501 # verify the required parameter 'stop_chase_order_req' is set if self.api_client.client_side_validation and ('stop_chase_order_req' not in local_var_params or # noqa: E501 local_var_params['stop_chase_order_req'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `stop_chase_order_req` when calling `stop_chase_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'stop_chase_order_req' in local_var_params: body_params = local_var_params['stop_chase_order_req'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/chase/stop', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='StopChaseOrderResp', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def stop_all_chase_orders(self, settle, stop_all_chase_orders_req, **kwargs): # noqa: E501 """Stop chase orders in batch # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.stop_all_chase_orders(settle, stop_all_chase_orders_req, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param StopAllChaseOrdersReq stop_all_chase_orders_req: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.StopAllChaseOrdersResp :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.stop_all_chase_orders_with_http_info(settle, stop_all_chase_orders_req, **kwargs) # noqa: E501 def stop_all_chase_orders_with_http_info(self, settle, stop_all_chase_orders_req, **kwargs): # noqa: E501 """Stop chase orders in batch # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.stop_all_chase_orders_with_http_info(settle, stop_all_chase_orders_req, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param StopAllChaseOrdersReq stop_all_chase_orders_req: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.StopAllChaseOrdersResp, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'stop_all_chase_orders_req' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method stop_all_chase_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `stop_all_chase_orders`") # noqa: E501 # verify the required parameter 'stop_all_chase_orders_req' is set if self.api_client.client_side_validation and ('stop_all_chase_orders_req' not in local_var_params or # noqa: E501 local_var_params['stop_all_chase_orders_req'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `stop_all_chase_orders_req` when calling `stop_all_chase_orders`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'stop_all_chase_orders_req' in local_var_params: body_params = local_var_params['stop_all_chase_orders_req'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/chase/stop_all', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='StopAllChaseOrdersResp', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_chase_orders(self, settle, sort_by, **kwargs): # noqa: E501 """List chase orders # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_chase_orders(settle, sort_by, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int sort_by: Sort field: 1 ORDER_SORT_CREATED_AT, 2 ORDER_SORT_FINISHED_AT; cannot be 0 (required) :param str contract: Optional. When non-empty, must be a valid contract (validated against the market cache for the path settle); server-side converted to uppercase :param bool is_finished: true to query finished orders, false to query in-progress orders :param int start_at: Lower time bound for the history list, paired with end_at. Required when is_finished is true :param int end_at: Upper time bound for the history list, paired with start_at. Required when is_finished is true :param int page_num: Page number, starting from 1 :param int page_size: Page size; must be between 1 and 100 :param bool hide_cancel: When true, cancelled orders are hidden in the list :param int reduce_only: OptionalBool: 0 unknown, 1 true, 2 false; used to filter by reduce-only flag :param int side: Filter by long/short side: 1 long, 2 short :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.GetChaseOrdersResp :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_chase_orders_with_http_info(settle, sort_by, **kwargs) # noqa: E501 def get_chase_orders_with_http_info(self, settle, sort_by, **kwargs): # noqa: E501 """List chase orders # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_chase_orders_with_http_info(settle, sort_by, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int sort_by: Sort field: 1 ORDER_SORT_CREATED_AT, 2 ORDER_SORT_FINISHED_AT; cannot be 0 (required) :param str contract: Optional. When non-empty, must be a valid contract (validated against the market cache for the path settle); server-side converted to uppercase :param bool is_finished: true to query finished orders, false to query in-progress orders :param int start_at: Lower time bound for the history list, paired with end_at. Required when is_finished is true :param int end_at: Upper time bound for the history list, paired with start_at. Required when is_finished is true :param int page_num: Page number, starting from 1 :param int page_size: Page size; must be between 1 and 100 :param bool hide_cancel: When true, cancelled orders are hidden in the list :param int reduce_only: OptionalBool: 0 unknown, 1 true, 2 false; used to filter by reduce-only flag :param int side: Filter by long/short side: 1 long, 2 short :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.GetChaseOrdersResp, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'sort_by', 'contract', 'is_finished', 'start_at', 'end_at', 'page_num', 'page_size', 'hide_cancel', 'reduce_only', 'side' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_chase_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_chase_orders`") # noqa: E501 # verify the required parameter 'sort_by' is set if self.api_client.client_side_validation and ('sort_by' not in local_var_params or # noqa: E501 local_var_params['sort_by'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `sort_by` when calling `get_chase_orders`") # noqa: E501 if self.api_client.client_side_validation and 'page_num' in local_var_params and local_var_params['page_num'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `page_num` when calling `get_chase_orders`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'page_size' in local_var_params and local_var_params['page_size'] > 100: # noqa: E501 raise ApiValueError("Invalid value for parameter `page_size` when calling `get_chase_orders`, must be a value less than or equal to `100`") # noqa: E501 if self.api_client.client_side_validation and 'page_size' in local_var_params and local_var_params['page_size'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `page_size` when calling `get_chase_orders`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'is_finished' in local_var_params and local_var_params['is_finished'] is not None: # noqa: E501 query_params.append(('is_finished', local_var_params['is_finished'])) # noqa: E501 if 'start_at' in local_var_params and local_var_params['start_at'] is not None: # noqa: E501 query_params.append(('start_at', local_var_params['start_at'])) # noqa: E501 if 'end_at' in local_var_params and local_var_params['end_at'] is not None: # noqa: E501 query_params.append(('end_at', local_var_params['end_at'])) # noqa: E501 if 'page_num' in local_var_params and local_var_params['page_num'] is not None: # noqa: E501 query_params.append(('page_num', local_var_params['page_num'])) # noqa: E501 if 'page_size' in local_var_params and local_var_params['page_size'] is not None: # noqa: E501 query_params.append(('page_size', local_var_params['page_size'])) # noqa: E501 if 'sort_by' in local_var_params and local_var_params['sort_by'] is not None: # noqa: E501 query_params.append(('sort_by', local_var_params['sort_by'])) # noqa: E501 if 'hide_cancel' in local_var_params and local_var_params['hide_cancel'] is not None: # noqa: E501 query_params.append(('hide_cancel', local_var_params['hide_cancel'])) # noqa: E501 if 'reduce_only' in local_var_params and local_var_params['reduce_only'] is not None: # noqa: E501 query_params.append(('reduce_only', local_var_params['reduce_only'])) # noqa: E501 if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501 query_params.append(('side', local_var_params['side'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/chase/list', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='GetChaseOrdersResp', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_chase_order_detail(self, settle, id, **kwargs): # noqa: E501 """Get chase order detail # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_chase_order_detail(settle, id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str id: Order ID, must be a non-zero positive integer (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.GetChaseOrderDetailResp :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_chase_order_detail_with_http_info(settle, id, **kwargs) # noqa: E501 def get_chase_order_detail_with_http_info(self, settle, id, **kwargs): # noqa: E501 """Get chase order detail # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_chase_order_detail_with_http_info(settle, id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str id: Order ID, must be a non-zero positive integer (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.GetChaseOrderDetailResp, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'id' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_chase_order_detail" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_chase_order_detail`") # noqa: E501 # verify the required parameter 'id' is set if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501 local_var_params['id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `id` when calling `get_chase_order_detail`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'id' in local_var_params and local_var_params['id'] is not None: # noqa: E501 query_params.append(('id', local_var_params['id'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/autoorder/v1/chase/detail', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='GetChaseOrderDetailResp', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def list_price_triggered_orders(self, settle, status, **kwargs): # noqa: E501 """Query auto order list # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_price_triggered_orders(settle, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str status: Query order list based on status (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesPriceTriggeredOrder] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_price_triggered_orders_with_http_info(settle, status, **kwargs) # noqa: E501 def list_price_triggered_orders_with_http_info(self, settle, status, **kwargs): # noqa: E501 """Query auto order list # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_price_triggered_orders_with_http_info(settle, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str status: Query order list based on status (required) :param str contract: Futures contract, return related data only if specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'status', 'contract', 'limit', 'offset' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_price_triggered_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `list_price_triggered_orders`") # noqa: E501 # verify the required parameter 'status' is set if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 local_var_params['status'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `status` when calling `list_price_triggered_orders`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_price_triggered_orders`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_price_triggered_orders`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_price_triggered_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'status' in local_var_params and local_var_params['status'] is not None: # noqa: E501 query_params.append(('status', local_var_params['status'])) # noqa: E501 if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/price_orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesPriceTriggeredOrder]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def create_price_triggered_order(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 """Create price-triggered order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_price_triggered_order(settle, futures_price_triggered_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.TriggerOrderResponse :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.create_price_triggered_order_with_http_info(settle, futures_price_triggered_order, **kwargs) # noqa: E501 def create_price_triggered_order_with_http_info(self, settle, futures_price_triggered_order, **kwargs): # noqa: E501 """Create price-triggered order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_price_triggered_order_with_http_info(settle, futures_price_triggered_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesPriceTriggeredOrder futures_price_triggered_order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'futures_price_triggered_order' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method create_price_triggered_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `create_price_triggered_order`") # noqa: E501 # verify the required parameter 'futures_price_triggered_order' is set if self.api_client.client_side_validation and ('futures_price_triggered_order' not in local_var_params or # noqa: E501 local_var_params['futures_price_triggered_order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `futures_price_triggered_order` when calling `create_price_triggered_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'futures_price_triggered_order' in local_var_params: body_params = local_var_params['futures_price_triggered_order'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/price_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TriggerOrderResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def cancel_price_triggered_order_list(self, settle, **kwargs): # noqa: E501 """Cancel all auto orders # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_price_triggered_order_list(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FuturesPriceTriggeredOrder] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.cancel_price_triggered_order_list_with_http_info(settle, **kwargs) # noqa: E501 def cancel_price_triggered_order_list_with_http_info(self, settle, **kwargs): # noqa: E501 """Cancel all auto orders # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_price_triggered_order_list_with_http_info(settle, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param str contract: Futures contract, return related data only if specified :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FuturesPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'contract' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_price_triggered_order_list" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order_list`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501 query_params.append(('contract', local_var_params['contract'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/price_orders', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FuturesPriceTriggeredOrder]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def get_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E501 """Query single auto order details # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_price_triggered_order(settle, order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int order_id: ID returned when order is successfully created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesPriceTriggeredOrder :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def get_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Query single auto order details # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_price_triggered_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int order_id: ID returned when order is successfully created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'order_id' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_price_triggered_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `get_price_triggered_order`") # noqa: E501 # verify the required parameter 'order_id' is set if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 local_var_params['order_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `order_id` when calling `get_price_triggered_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'order_id' in local_var_params: path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/price_orders/{order_id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesPriceTriggeredOrder', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def cancel_price_triggered_order(self, settle, order_id, **kwargs): # noqa: E501 """Cancel single auto order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_price_triggered_order(settle, order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int order_id: ID returned when order is successfully created (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.FuturesPriceTriggeredOrder :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.cancel_price_triggered_order_with_http_info(settle, order_id, **kwargs) # noqa: E501 def cancel_price_triggered_order_with_http_info(self, settle, order_id, **kwargs): # noqa: E501 """Cancel single auto order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_price_triggered_order_with_http_info(settle, order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param int order_id: ID returned when order is successfully created (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.FuturesPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'order_id' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method cancel_price_triggered_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `cancel_price_triggered_order`") # noqa: E501 # verify the required parameter 'order_id' is set if self.api_client.client_side_validation and ('order_id' not in local_var_params or # noqa: E501 local_var_params['order_id'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `order_id` when calling `cancel_price_triggered_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 if 'order_id' in local_var_params: path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/price_orders/{order_id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='FuturesPriceTriggeredOrder', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def update_price_triggered_order(self, settle, futures_update_price_triggered_order, **kwargs): # noqa: E501 """Modify a Single Auto Order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_price_triggered_order(settle, futures_update_price_triggered_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesUpdatePriceTriggeredOrder futures_update_price_triggered_order: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.TriggerOrderResponse :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.update_price_triggered_order_with_http_info(settle, futures_update_price_triggered_order, **kwargs) # noqa: E501 def update_price_triggered_order_with_http_info(self, settle, futures_update_price_triggered_order, **kwargs): # noqa: E501 """Modify a Single Auto Order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_price_triggered_order_with_http_info(settle, futures_update_price_triggered_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str settle: Settle currency (required) :param FuturesUpdatePriceTriggeredOrder futures_update_price_triggered_order: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.TriggerOrderResponse, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'settle', 'futures_update_price_triggered_order' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method update_price_triggered_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'settle' is set if self.api_client.client_side_validation and ('settle' not in local_var_params or # noqa: E501 local_var_params['settle'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `settle` when calling `update_price_triggered_order`") # noqa: E501 # verify the required parameter 'futures_update_price_triggered_order' is set if self.api_client.client_side_validation and ('futures_update_price_triggered_order' not in local_var_params or # noqa: E501 local_var_params['futures_update_price_triggered_order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `futures_update_price_triggered_order` when calling `update_price_triggered_order`") # noqa: E501 collection_formats = {} path_params = {} if 'settle' in local_var_params: path_params['settle'] = local_var_params['settle'] # noqa: E501 query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'futures_update_price_triggered_order' in local_var_params: body_params = local_var_params['futures_update_price_triggered_order'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/futures/{settle}/price_orders/amend', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='TriggerOrderResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats)