# 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 SpotApi(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_currencies(self, **kwargs): # noqa: E501 """Query all currency information # noqa: E501 When a currency corresponds to multiple chains, you can query the information of multiple chains through the `chains` field, such as the charging and recharge status, identification, etc. of the chain # 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_currencies(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :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.Currency] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_currencies_with_http_info(**kwargs) # noqa: E501 def list_currencies_with_http_info(self, **kwargs): # noqa: E501 """Query all currency information # noqa: E501 When a currency corresponds to multiple chains, you can query the information of multiple chains through the `chains` field, such as the charging and recharge status, identification, etc. of the chain # 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_currencies_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :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.Currency], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ ] 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_currencies" % k ) local_var_params[k] = v del local_var_params['kwargs'] collection_formats = {} path_params = {} 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( '/spot/currencies', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Currency]', # 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_currency(self, currency, **kwargs): # noqa: E501 """Query single currency 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_currency(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Currency 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.Currency :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_currency_with_http_info(currency, **kwargs) # noqa: E501 def get_currency_with_http_info(self, currency, **kwargs): # noqa: E501 """Query single currency 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_currency_with_http_info(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Currency 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.Currency, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency' ] 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_currency" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currency' is set if self.api_client.client_side_validation and ('currency' not in local_var_params or # noqa: E501 local_var_params['currency'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency` when calling `get_currency`") # noqa: E501 collection_formats = {} path_params = {} if 'currency' in local_var_params: path_params['currency'] = local_var_params['currency'] # 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( '/spot/currencies/{currency}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Currency', # 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_currency_pairs(self, **kwargs): # noqa: E501 """Query all supported currency pairs # 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_currency_pairs(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :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.CurrencyPair] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_currency_pairs_with_http_info(**kwargs) # noqa: E501 def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 """Query all supported currency pairs # 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_currency_pairs_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :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.CurrencyPair], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ ] 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_currency_pairs" % k ) local_var_params[k] = v del local_var_params['kwargs'] collection_formats = {} path_params = {} 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( '/spot/currency_pairs', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[CurrencyPair]', # 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_currency_pair(self, currency_pair, **kwargs): # noqa: E501 """Query single currency pair 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_currency_pair(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (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.CurrencyPair :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_currency_pair_with_http_info(currency_pair, **kwargs) # noqa: E501 def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Query single currency pair 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_currency_pair_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (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.CurrencyPair, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair' ] 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_currency_pair" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_currency_pair`") # noqa: E501 collection_formats = {} path_params = {} if 'currency_pair' in local_var_params: path_params['currency_pair'] = local_var_params['currency_pair'] # 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( '/spot/currency_pairs/{currency_pair}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='CurrencyPair', # 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_tickers(self, **kwargs): # noqa: E501 """Get currency pair ticker information # noqa: E501 If `currency_pair` is specified, only query that currency pair; otherwise return all 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_tickers(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair :param str timezone: Timezone :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.Ticker] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_tickers_with_http_info(**kwargs) # noqa: E501 def list_tickers_with_http_info(self, **kwargs): # noqa: E501 """Get currency pair ticker information # noqa: E501 If `currency_pair` is specified, only query that currency pair; otherwise return all 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_tickers_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair :param str timezone: Timezone :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.Ticker], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair', '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_tickers" % k ) local_var_params[k] = v del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # 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( '/spot/tickers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Ticker]', # 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_order_book(self, currency_pair, **kwargs): # noqa: E501 """Get market depth information # noqa: E501 Market depth buy orders are sorted by price from high to low, sell orders are sorted from low to high # 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_order_book(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param str interval: Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified :param int limit: Number of depth levels :param bool with_id: Return order book update 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.OrderBook :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_order_book_with_http_info(currency_pair, **kwargs) # noqa: E501 def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Get market depth information # noqa: E501 Market depth buy orders are sorted by price from high to low, sell orders are sorted from low to high # 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_order_book_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param str interval: Price precision for depth aggregation, 0 means no aggregation, defaults to 0 if not specified :param int limit: Number of depth levels :param bool with_id: Return order book update 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.OrderBook, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair', '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_order_book" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_order_book`") # 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_order_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # 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( '/spot/order_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='OrderBook', # 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_trades(self, currency_pair, **kwargs): # noqa: E501 """Query market transaction records # noqa: E501 Supports querying by time range using `from` and `to` parameters or pagination based on `last_id`. By default, queries the last 30 days. Pagination based on `last_id` is no longer recommended. If `last_id` is specified, the time range query parameters will be ignored. When using limit&page pagination to retrieve data, the maximum number of pages is 100,000, that is, limit * (page - 1) <= 100,000. # 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_trades(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param int limit: Maximum number of items returned in list. Default: 100, minimum: 1, maximum: 1000 :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 bool reverse: Whether to retrieve data less than `last_id`. Default returns records greater than `last_id`. Set to `true` to trace back market trade records, `false` to get latest trades. No effect when `last_id` is not set. :param int _from: Start timestamp for the query :param int to: End timestamp for the query, defaults to current time if not specified :param int page: Page number :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.Trade] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Query market transaction records # noqa: E501 Supports querying by time range using `from` and `to` parameters or pagination based on `last_id`. By default, queries the last 30 days. Pagination based on `last_id` is no longer recommended. If `last_id` is specified, the time range query parameters will be ignored. When using limit&page pagination to retrieve data, the maximum number of pages is 100,000, that is, limit * (page - 1) <= 100,000. # 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_trades_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param int limit: Maximum number of items returned in list. Default: 100, minimum: 1, maximum: 1000 :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 bool reverse: Whether to retrieve data less than `last_id`. Default returns records greater than `last_id`. Set to `true` to trace back market trade records, `false` to get latest trades. No effect when `last_id` is not set. :param int _from: Start timestamp for the query :param int to: End timestamp for the query, defaults to current time if not specified :param int page: Page number :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.Trade], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair', 'limit', 'last_id', 'reverse', '_from', 'to', 'page' ] 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_trades" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_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_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_trades`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `page` when calling `list_trades`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # 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 '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 'reverse' in local_var_params and local_var_params['reverse'] is not None: # noqa: E501 query_params.append(('reverse', local_var_params['reverse'])) # 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 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # 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( '/spot/trades', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Trade]', # 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_candlesticks(self, currency_pair, **kwargs): # noqa: E501 """Market K-line chart # noqa: E501 Maximum of 1000 points can be returned in a 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_candlesticks(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :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 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 str interval: Time interval between data points. Note that `30d` represents a calendar month, not aligned to 30 days :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[list[str]] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_candlesticks_with_http_info(currency_pair, **kwargs) # noqa: E501 def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Market K-line chart # noqa: E501 Maximum of 1000 points can be returned in a 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_candlesticks_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :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 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 str interval: Time interval between data points. Note that `30d` represents a calendar month, not aligned to 30 days :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[list[str]], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair', 'limit', '_from', 'to', '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_candlesticks" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_candlesticks`") # 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_candlesticks`, must be a value less than or equal to `1000`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # 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 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( '/spot/candlesticks', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[list[str]]', # 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_fee(self, **kwargs): # noqa: E501 """Query account fee rates # noqa: E501 This API is deprecated. The new fee query API is `/wallet/fee` # 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_fee(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Specify currency pair to get more accurate fee settings. This field is optional. Usually fee settings are the same for all currency pairs. :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.SpotFee :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_fee_with_http_info(**kwargs) # noqa: E501 def get_fee_with_http_info(self, **kwargs): # noqa: E501 """Query account fee rates # noqa: E501 This API is deprecated. The new fee query API is `/wallet/fee` # 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_fee_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Specify currency pair to get more accurate fee settings. This field is optional. Usually fee settings are the same for all currency pairs. :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.SpotFee, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair' ] 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_fee" % k ) local_var_params[k] = v del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # 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( '/spot/fee', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='SpotFee', # 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_batch_spot_fee(self, currency_pairs, **kwargs): # noqa: E501 """Batch query account 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_batch_spot_fee(currency_pairs, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pairs: Maximum 50 currency pairs per 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: dict(str, gate_api.SpotFee) :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_batch_spot_fee_with_http_info(currency_pairs, **kwargs) # noqa: E501 def get_batch_spot_fee_with_http_info(self, currency_pairs, **kwargs): # noqa: E501 """Batch query account 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_batch_spot_fee_with_http_info(currency_pairs, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pairs: Maximum 50 currency pairs per 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(dict(str, gate_api.SpotFee), status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pairs' ] 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_batch_spot_fee" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currency_pairs' is set if self.api_client.client_side_validation and ('currency_pairs' not in local_var_params or # noqa: E501 local_var_params['currency_pairs'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency_pairs` when calling `get_batch_spot_fee`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currency_pairs' in local_var_params and local_var_params['currency_pairs'] is not None: # noqa: E501 query_params.append(('currency_pairs', local_var_params['currency_pairs'])) # 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( '/spot/batch_fee', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='dict(str, SpotFee)', # 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_spot_accounts(self, **kwargs): # noqa: E501 """List spot trading accounts # 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_spot_accounts(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified currency name :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.SpotAccount] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_spot_accounts_with_http_info(**kwargs) # noqa: E501 def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 """List spot trading accounts # 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_spot_accounts_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified currency name :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.SpotAccount], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency' ] 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_spot_accounts" % k ) local_var_params[k] = v del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501 query_params.append(('currency', local_var_params['currency'])) # 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( '/spot/accounts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[SpotAccount]', # 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_spot_account_book(self, **kwargs): # noqa: E501 """Query spot account transaction history # noqa: E501 Record query time range cannot exceed 30 days. When using limit&page pagination to retrieve data, the maximum number of pages is 100,000, that is, limit * (page - 1) <= 100,000. # 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_spot_account_book(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified currency name :param int _from: Start timestamp for the query :param int to: End timestamp for the query, defaults to current time if not specified :param int page: Page number :param int limit: Maximum number of records returned in a single list :param str type: Query by specified account change type. If not specified, all change types will be included. :param str code: Specify account change code for query. If not specified, all change types are included. This parameter has higher priority than `type` :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.SpotAccountBook] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_spot_account_book_with_http_info(**kwargs) # noqa: E501 def list_spot_account_book_with_http_info(self, **kwargs): # noqa: E501 """Query spot account transaction history # noqa: E501 Record query time range cannot exceed 30 days. When using limit&page pagination to retrieve data, the maximum number of pages is 100,000, that is, limit * (page - 1) <= 100,000. # 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_spot_account_book_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified currency name :param int _from: Start timestamp for the query :param int to: End timestamp for the query, defaults to current time if not specified :param int page: Page number :param int limit: Maximum number of records returned in a single list :param str type: Query by specified account change type. If not specified, all change types will be included. :param str code: Specify account change code for query. If not specified, all change types are included. This parameter has higher priority than `type` :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.SpotAccountBook], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency', '_from', 'to', 'page', 'limit', 'type', 'code' ] 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_spot_account_book" % k ) local_var_params[k] = v del local_var_params['kwargs'] if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `page` when calling `list_spot_account_book`, must be a value greater than or equal to `1`") # 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_spot_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_spot_account_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501 query_params.append(('currency', local_var_params['currency'])) # 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 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # 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 '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 if 'code' in local_var_params and local_var_params['code'] is not None: # noqa: E501 query_params.append(('code', local_var_params['code'])) # 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( '/spot/account_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[SpotAccountBook]', # 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_orders(self, order, **kwargs): # noqa: E501 """Batch place orders # noqa: E501 Batch order requirements: 1. Custom order field `text` must be specified 2. Up to 4 currency pairs per request, with up to 10 orders per currency pair 3. Spot orders and margin orders cannot be mixed; all `account` fields in the same request must be identical # 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_orders(order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param list[Order] 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.BatchOrder] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.create_batch_orders_with_http_info(order, **kwargs) # noqa: E501 def create_batch_orders_with_http_info(self, order, **kwargs): # noqa: E501 """Batch place orders # noqa: E501 Batch order requirements: 1. Custom order field `text` must be specified 2. Up to 4 currency pairs per request, with up to 10 orders per currency pair 3. Spot orders and margin orders cannot be mixed; all `account` fields in the same request must be identical # 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_orders_with_http_info(order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param list[Order] 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.BatchOrder], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ '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_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'order' is set if self.api_client.client_side_validation and ('order' not in local_var_params or # noqa: E501 local_var_params['order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `order` when calling `create_batch_orders`") # noqa: E501 collection_formats = {} path_params = {} 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 'order' in local_var_params: body_params = local_var_params['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( '/spot/batch_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[BatchOrder]', # 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_all_open_orders(self, **kwargs): # noqa: E501 """List all open orders # noqa: E501 Query the current order list of all trading pairs. Please note that the paging parameter controls the number of pending orders in each trading pair. There is no paging control trading pairs. All trading pairs with pending orders will be returned. # 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_all_open_orders(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param int page: Page number :param int limit: Maximum number of records returned in one page in each currency pair :param str account: Specify query account :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.OpenOrders] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_all_open_orders_with_http_info(**kwargs) # noqa: E501 def list_all_open_orders_with_http_info(self, **kwargs): # noqa: E501 """List all open orders # noqa: E501 Query the current order list of all trading pairs. Please note that the paging parameter controls the number of pending orders in each trading pair. There is no paging control trading pairs. All trading pairs with pending orders will be returned. # 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_all_open_orders_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param int page: Page number :param int limit: Maximum number of records returned in one page in each currency pair :param str account: Specify query account :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.OpenOrders], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'page', 'limit', 'account' ] 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_all_open_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `page` when calling `list_all_open_orders`, must be a value greater than or equal to `1`") # 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_all_open_orders`, 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_all_open_orders`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # 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 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 query_params.append(('account', local_var_params['account'])) # 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( '/spot/open_orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[OpenOrders]', # 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_cross_liquidate_order(self, liquidate_order, **kwargs): # noqa: E501 """Close position when cross-currency is disabled # noqa: E501 Currently, only cross-margin accounts are supported to place buy orders for disabled currencies. Maximum buy quantity = (unpaid principal and interest - currency balance - the amount of the currency in pending orders) / 0.998 # 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_cross_liquidate_order(liquidate_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param LiquidateOrder liquidate_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.Order :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.create_cross_liquidate_order_with_http_info(liquidate_order, **kwargs) # noqa: E501 def create_cross_liquidate_order_with_http_info(self, liquidate_order, **kwargs): # noqa: E501 """Close position when cross-currency is disabled # noqa: E501 Currently, only cross-margin accounts are supported to place buy orders for disabled currencies. Maximum buy quantity = (unpaid principal and interest - currency balance - the amount of the currency in pending orders) / 0.998 # 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_cross_liquidate_order_with_http_info(liquidate_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param LiquidateOrder liquidate_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.Order, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'liquidate_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_cross_liquidate_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'liquidate_order' is set if self.api_client.client_side_validation and ('liquidate_order' not in local_var_params or # noqa: E501 local_var_params['liquidate_order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `liquidate_order` when calling `create_cross_liquidate_order`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'liquidate_order' in local_var_params: body_params = local_var_params['liquidate_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( '/spot/cross_liquidate_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Order', # 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_orders(self, currency_pair, status, **kwargs): # noqa: E501 """List orders # noqa: E501 Note that query results default to spot order lists for spot, unified account, and isolated margin accounts. When `status` is set to `open` (i.e., when querying pending order lists), only `page` and `limit` pagination controls are supported. `limit` can only be set to a maximum of 100. The `side` parameter and time range query parameters `from` and `to` are not supported. When `status` is set to `finished` (i.e., when querying historical orders), in addition to pagination queries, `from` and `to` time range queries are also supported. Additionally, the `side` parameter can be set to filter one-sided history. Time range filter parameters are processed according to the order end 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_orders(currency_pair, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Query by specified currency pair. Required for open orders, optional for filled orders (required) :param str status: List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) :param int page: Page number :param int limit: Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 :param str account: Specify query account :param int _from: Start timestamp for the query :param int to: End timestamp for the query, defaults to current time if not specified :param str side: Specify all bids or all asks, both included if not 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.Order] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_orders_with_http_info(currency_pair, status, **kwargs) # noqa: E501 def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: E501 """List orders # noqa: E501 Note that query results default to spot order lists for spot, unified account, and isolated margin accounts. When `status` is set to `open` (i.e., when querying pending order lists), only `page` and `limit` pagination controls are supported. `limit` can only be set to a maximum of 100. The `side` parameter and time range query parameters `from` and `to` are not supported. When `status` is set to `finished` (i.e., when querying historical orders), in addition to pagination queries, `from` and `to` time range queries are also supported. Additionally, the `side` parameter can be set to filter one-sided history. Time range filter parameters are processed according to the order end 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_orders_with_http_info(currency_pair, status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Query by specified currency pair. Required for open orders, optional for filled orders (required) :param str status: List orders based on status `open` - order is waiting to be filled `finished` - order has been filled or cancelled (required) :param int page: Page number :param int limit: Maximum number of records to be returned. If `status` is `open`, maximum of `limit` is 100 :param str account: Specify query account :param int _from: Start timestamp for the query :param int to: End timestamp for the query, defaults to current time if not specified :param str side: Specify all bids or all asks, both included if not 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.Order], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair', 'status', 'page', 'limit', 'account', '_from', 'to', '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 list_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency_pair` when calling `list_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_orders`") # noqa: E501 if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `page` when calling `list_orders`, must be a value greater than or equal to `1`") # 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_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_orders`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # 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 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # 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 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 query_params.append(('account', local_var_params['account'])) # 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 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( '/spot/orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Order]', # 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_order(self, order, **kwargs): # noqa: E501 """Create an order # noqa: E501 Supports spot, margin, leverage, and cross-margin leverage orders. Use different accounts through the `account` field. Default is `spot`, which means using the spot account to place orders. If the user has a `unified` account, the default is to place orders with the unified account. When using leveraged account trading (i.e., when `account` is set to `margin`), you can set `auto_borrow` to `true`. In case of insufficient account balance, the system will automatically execute `POST /margin/uni/loans` to borrow the insufficient amount. Whether assets obtained after leveraged order execution are automatically used to repay borrowing orders of the isolated margin account depends on the automatic repayment settings of the user's isolated margin account. Account automatic repayment settings can be queried and set through `/margin/auto_repay`. When using unified account trading (i.e., when `account` is set to `unified`), `auto_borrow` can also be enabled to realize automatic borrowing of insufficient amounts. However, unlike the isolated margin account, whether unified account orders are automatically repaid depends on the `auto_repay` setting when placing the order. This setting only applies to the current order, meaning only assets obtained after order execution will be used to repay borrowing orders of the cross-margin account. Unified account ordering currently supports enabling both `auto_borrow` and `auto_repay` simultaneously. Auto repayment will be triggered when the order ends, i.e., when `status` is `cancelled` or `closed`. **Order Status** The order status in pending orders is `open`, which remains `open` until all quantity is filled. If fully filled, the order ends and status becomes `closed`. If the order is cancelled before all transactions are completed, regardless of partial fills, the status will become `cancelled`. **Iceberg Orders** `iceberg` is used to set the displayed quantity of iceberg orders and does not support complete hiding. Note that hidden portions are charged according to the taker's fee rate. **Self-Trade Prevention** Set `stp_act` to determine the self-trade prevention strategy to use # 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_order(order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param Order 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.Order :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.create_order_with_http_info(order, **kwargs) # noqa: E501 def create_order_with_http_info(self, order, **kwargs): # noqa: E501 """Create an order # noqa: E501 Supports spot, margin, leverage, and cross-margin leverage orders. Use different accounts through the `account` field. Default is `spot`, which means using the spot account to place orders. If the user has a `unified` account, the default is to place orders with the unified account. When using leveraged account trading (i.e., when `account` is set to `margin`), you can set `auto_borrow` to `true`. In case of insufficient account balance, the system will automatically execute `POST /margin/uni/loans` to borrow the insufficient amount. Whether assets obtained after leveraged order execution are automatically used to repay borrowing orders of the isolated margin account depends on the automatic repayment settings of the user's isolated margin account. Account automatic repayment settings can be queried and set through `/margin/auto_repay`. When using unified account trading (i.e., when `account` is set to `unified`), `auto_borrow` can also be enabled to realize automatic borrowing of insufficient amounts. However, unlike the isolated margin account, whether unified account orders are automatically repaid depends on the `auto_repay` setting when placing the order. This setting only applies to the current order, meaning only assets obtained after order execution will be used to repay borrowing orders of the cross-margin account. Unified account ordering currently supports enabling both `auto_borrow` and `auto_repay` simultaneously. Auto repayment will be triggered when the order ends, i.e., when `status` is `cancelled` or `closed`. **Order Status** The order status in pending orders is `open`, which remains `open` until all quantity is filled. If fully filled, the order ends and status becomes `closed`. If the order is cancelled before all transactions are completed, regardless of partial fills, the status will become `cancelled`. **Iceberg Orders** `iceberg` is used to set the displayed quantity of iceberg orders and does not support complete hiding. Note that hidden portions are charged according to the taker's fee rate. **Self-Trade Prevention** Set `stp_act` to determine the self-trade prevention strategy to use # 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_order_with_http_info(order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param Order 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.Order, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ '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_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'order' is set if self.api_client.client_side_validation and ('order' not in local_var_params or # noqa: E501 local_var_params['order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `order` when calling `create_order`") # noqa: E501 collection_formats = {} path_params = {} 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 'order' in local_var_params: body_params = local_var_params['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( '/spot/orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Order', # 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_orders(self, **kwargs): # noqa: E501 """Cancel all `open` orders in specified currency pair # noqa: E501 When the `account` parameter is not specified, all pending orders including spot, unified account, and isolated margin will be cancelled. When `currency_pair` is not specified, all trading pair pending orders will be cancelled. You can specify a particular account to cancel all pending orders under that 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.cancel_orders(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair :param str side: Specify all bids or all asks, both included if not specified :param str account: Specify account type Classic account: All are included if not specified Unified account: Specify `unified` :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 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.OrderCancel] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.cancel_orders_with_http_info(**kwargs) # noqa: E501 def cancel_orders_with_http_info(self, **kwargs): # noqa: E501 """Cancel all `open` orders in specified currency pair # noqa: E501 When the `account` parameter is not specified, all pending orders including spot, unified account, and isolated margin will be cancelled. When `currency_pair` is not specified, all trading pair pending orders will be cancelled. You can specify a particular account to cancel all pending orders under that 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.cancel_orders_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair :param str side: Specify all bids or all asks, both included if not specified :param str account: Specify account type Classic account: All are included if not specified Unified account: Specify `unified` :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 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.OrderCancel], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair', 'side', 'account', 'action_mode', '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_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # 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 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 query_params.append(('account', local_var_params['account'])) # 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 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( '/spot/orders', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[OrderCancel]', # 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_orders(self, cancel_batch_order, **kwargs): # noqa: E501 """Cancel batch orders by specified ID list # noqa: E501 Multiple currency pairs can be specified, but maximum 20 orders are allowed per 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_orders(cancel_batch_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param list[CancelBatchOrder] cancel_batch_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.CancelOrderResult] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.cancel_batch_orders_with_http_info(cancel_batch_order, **kwargs) # noqa: E501 def cancel_batch_orders_with_http_info(self, cancel_batch_order, **kwargs): # noqa: E501 """Cancel batch orders by specified ID list # noqa: E501 Multiple currency pairs can be specified, but maximum 20 orders are allowed per 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_orders_with_http_info(cancel_batch_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param list[CancelBatchOrder] cancel_batch_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.CancelOrderResult], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'cancel_batch_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 cancel_batch_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'cancel_batch_order' is set if self.api_client.client_side_validation and ('cancel_batch_order' not in local_var_params or # noqa: E501 local_var_params['cancel_batch_order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `cancel_batch_order` when calling `cancel_batch_orders`") # noqa: E501 collection_formats = {} path_params = {} 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 'cancel_batch_order' in local_var_params: body_params = local_var_params['cancel_batch_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( '/spot/cancel_batch_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[CancelOrderResult]', # 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_order(self, order_id, currency_pair, **kwargs): # noqa: E501 """Query single order details # noqa: E501 By default, queries orders for spot, unified account, and isolated margin accounts. # 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_order(order_id, currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str order_id: The order ID returned when the order was successfully created or the custom ID specified by the user's creation (i.e. the `text` field). Operations based on custom IDs can only be checked in pending orders. Only order ID can be used after the order is finished (transaction/cancel) (required) :param str currency_pair: Specify the trading pair to query. This field is required when querying pending order records. This field can be omitted when querying filled order records. (required) :param str account: Specify query account :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.Order :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: E501 """Query single order details # noqa: E501 By default, queries orders for spot, unified account, and isolated margin accounts. # 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_order_with_http_info(order_id, currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str order_id: The order ID returned when the order was successfully created or the custom ID specified by the user's creation (i.e. the `text` field). Operations based on custom IDs can only be checked in pending orders. Only order ID can be used after the order is finished (transaction/cancel) (required) :param str currency_pair: Specify the trading pair to query. This field is required when querying pending order records. This field can be omitted when querying filled order records. (required) :param str account: Specify query account :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.Order, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'order_id', 'currency_pair', 'account' ] 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_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # 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_order`") # noqa: E501 # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_order`") # noqa: E501 collection_formats = {} path_params = {} if 'order_id' in local_var_params: path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 if 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 query_params.append(('account', local_var_params['account'])) # 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( '/spot/orders/{order_id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Order', # 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_order(self, order_id, currency_pair, **kwargs): # noqa: E501 """Cancel single order # noqa: E501 By default, orders for spot, unified accounts and leveraged accounts are revoked. # 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_order(order_id, currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str order_id: The order ID returned when the order was successfully created or the custom ID specified by the user's creation (i.e. the `text` field). Operations based on custom IDs can only be checked in pending orders. Only order ID can be used after the order is finished (transaction/cancel) (required) :param str currency_pair: Currency pair (required) :param str account: Specify query account :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 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.Order :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.cancel_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: E501 """Cancel single order # noqa: E501 By default, orders for spot, unified accounts and leveraged accounts are revoked. # 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_order_with_http_info(order_id, currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str order_id: The order ID returned when the order was successfully created or the custom ID specified by the user's creation (i.e. the `text` field). Operations based on custom IDs can only be checked in pending orders. Only order ID can be used after the order is finished (transaction/cancel) (required) :param str currency_pair: Currency pair (required) :param str account: Specify query account :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 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.Order, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'order_id', 'currency_pair', 'account', 'action_mode', '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_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # 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_order`") # noqa: E501 # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency_pair` when calling `cancel_order`") # noqa: E501 collection_formats = {} path_params = {} if 'order_id' in local_var_params: path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 if 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 query_params.append(('account', local_var_params['account'])) # 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 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( '/spot/orders/{order_id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Order', # 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_order(self, order_id, order_patch, **kwargs): # noqa: E501 """Amend single order # noqa: E501 Modify orders in spot, unified account and isolated margin account by default. Currently both request body and query support currency_pair and account parameters, but request body has higher priority. currency_pair must be filled in one of the request body or query parameters. About rate limit: Order modification and order creation share the same rate limit rules. About matching priority: Only reducing the quantity does not affect the matching priority. Modifying the price or increasing the quantity will adjust the priority to the end of the new price level. Note: Modifying the quantity to be less than the filled quantity will trigger a cancellation and isolated margin account by default. Currently both request body and query support currency_pair and account parameters, but request body has higher priority. currency_pair must be filled in one of the request body or query parameters. About rate limit: Order modification and order creation share the same rate limit rules. About matching priority: Only reducing the quantity does not affect the matching priority. Modifying the price or increasing the quantity will adjust the priority to the end of the new price level. Note: Modifying the quantity to be less than the filled quantity will trigger a cancellation operation. # 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_order(order_id, order_patch, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str order_id: The order ID returned when the order was successfully created or the custom ID specified by the user's creation (i.e. the `text` field). Operations based on custom IDs can only be checked in pending orders. Only order ID can be used after the order is finished (transaction/cancel) (required) :param OrderPatch order_patch: (required) :param str currency_pair: Currency pair :param str account: Specify query account :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.Order :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.amend_order_with_http_info(order_id, order_patch, **kwargs) # noqa: E501 def amend_order_with_http_info(self, order_id, order_patch, **kwargs): # noqa: E501 """Amend single order # noqa: E501 Modify orders in spot, unified account and isolated margin account by default. Currently both request body and query support currency_pair and account parameters, but request body has higher priority. currency_pair must be filled in one of the request body or query parameters. About rate limit: Order modification and order creation share the same rate limit rules. About matching priority: Only reducing the quantity does not affect the matching priority. Modifying the price or increasing the quantity will adjust the priority to the end of the new price level. Note: Modifying the quantity to be less than the filled quantity will trigger a cancellation and isolated margin account by default. Currently both request body and query support currency_pair and account parameters, but request body has higher priority. currency_pair must be filled in one of the request body or query parameters. About rate limit: Order modification and order creation share the same rate limit rules. About matching priority: Only reducing the quantity does not affect the matching priority. Modifying the price or increasing the quantity will adjust the priority to the end of the new price level. Note: Modifying the quantity to be less than the filled quantity will trigger a cancellation operation. # 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_order_with_http_info(order_id, order_patch, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str order_id: The order ID returned when the order was successfully created or the custom ID specified by the user's creation (i.e. the `text` field). Operations based on custom IDs can only be checked in pending orders. Only order ID can be used after the order is finished (transaction/cancel) (required) :param OrderPatch order_patch: (required) :param str currency_pair: Currency pair :param str account: Specify query account :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.Order, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'order_id', 'order_patch', 'currency_pair', 'account', '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_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # 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_order`") # noqa: E501 # verify the required parameter 'order_patch' is set if self.api_client.client_side_validation and ('order_patch' not in local_var_params or # noqa: E501 local_var_params['order_patch'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `order_patch` when calling `amend_order`") # noqa: E501 collection_formats = {} path_params = {} if 'order_id' in local_var_params: path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 if 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 query_params.append(('account', local_var_params['account'])) # 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 if 'order_patch' in local_var_params: body_params = local_var_params['order_patch'] # 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( '/spot/orders/{order_id}', 'PATCH', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='Order', # 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_my_trades(self, **kwargs): # noqa: E501 """Query personal trading records # noqa: E501 By default query of transaction records for spot, unified account and warehouse-by-site leverage accounts. The history within a specified time range can be queried by specifying `from` or (and) `to`. - If no time parameters are specified, only data for the last 7 days can be obtained. - If only any parameter of `from` or `to` is specified, only 7-day data from the start (or end) of the specified time is returned. - The range not allowed to exceed 30 days. The parameters of the time range filter are processed according to the order end time. The maximum number of pages when searching data using limit&page paging function is 100,0, that is, limit * (page - 1) <= 100,0. # 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_my_trades(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Retrieve results with specified currency pair :param int limit: Maximum number of items returned in list. Default: 100, minimum: 1, maximum: 1000 :param int page: Page number :param str order_id: Filter trades with specified order ID. `currency_pair` is also required if this field is present :param str account: Specify query account :param int _from: Start timestamp for the query :param int to: End timestamp for the query, defaults to current time if not 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.Trade] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_my_trades_with_http_info(**kwargs) # noqa: E501 def list_my_trades_with_http_info(self, **kwargs): # noqa: E501 """Query personal trading records # noqa: E501 By default query of transaction records for spot, unified account and warehouse-by-site leverage accounts. The history within a specified time range can be queried by specifying `from` or (and) `to`. - If no time parameters are specified, only data for the last 7 days can be obtained. - If only any parameter of `from` or `to` is specified, only 7-day data from the start (or end) of the specified time is returned. - The range not allowed to exceed 30 days. The parameters of the time range filter are processed according to the order end time. The maximum number of pages when searching data using limit&page paging function is 100,0, that is, limit * (page - 1) <= 100,0. # 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_my_trades_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Retrieve results with specified currency pair :param int limit: Maximum number of items returned in list. Default: 100, minimum: 1, maximum: 1000 :param int page: Page number :param str order_id: Filter trades with specified order ID. `currency_pair` is also required if this field is present :param str account: Specify query account :param int _from: Start timestamp for the query :param int to: End timestamp for the query, defaults to current time if not 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.Trade], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair', 'limit', 'page', 'order_id', 'account', '_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_my_trades" % k ) local_var_params[k] = v del local_var_params['kwargs'] 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_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 `list_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `page` when calling `list_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # 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 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # noqa: E501 if 'order_id' in local_var_params and local_var_params['order_id'] is not None: # noqa: E501 query_params.append(('order_id', local_var_params['order_id'])) # noqa: E501 if 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 query_params.append(('account', local_var_params['account'])) # 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 = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/spot/my_trades', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[Trade]', # 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_system_time(self, **kwargs): # noqa: E501 """Get server current 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.get_system_time(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :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.SystemTime :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_system_time_with_http_info(**kwargs) # noqa: E501 def get_system_time_with_http_info(self, **kwargs): # noqa: E501 """Get server current 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.get_system_time_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :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.SystemTime, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ ] 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_system_time" % k ) local_var_params[k] = v del local_var_params['kwargs'] collection_formats = {} path_params = {} 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( '/spot/time', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='SystemTime', # 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_spot(self, countdown_cancel_all_spot_task, **kwargs): # noqa: E501 """Countdown cancel orders # noqa: E501 Spot order heartbeat detection. If there is no \"cancel existing countdown\" or \"set new countdown\" when the user-set `timeout` time is reached, the related `spot pending orders` will be automatically cancelled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at 30s intervals, setting the countdown `timeout` to `30 (seconds)` each time. If this interface is not called again within 30 seconds, all pending orders on the `market` you specified will be automatically cancelled. If no `market` is specified, all market cancelled. If the `timeout` is set to 0 within 30 seconds, the countdown timer will be terminated and the automatic order cancellation function will be cancelled. # 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_spot(countdown_cancel_all_spot_task, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param CountdownCancelAllSpotTask countdown_cancel_all_spot_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_spot_with_http_info(countdown_cancel_all_spot_task, **kwargs) # noqa: E501 def countdown_cancel_all_spot_with_http_info(self, countdown_cancel_all_spot_task, **kwargs): # noqa: E501 """Countdown cancel orders # noqa: E501 Spot order heartbeat detection. If there is no \"cancel existing countdown\" or \"set new countdown\" when the user-set `timeout` time is reached, the related `spot pending orders` will be automatically cancelled. This interface can be called repeatedly to set a new countdown or cancel the countdown. Usage example: Repeat this interface at 30s intervals, setting the countdown `timeout` to `30 (seconds)` each time. If this interface is not called again within 30 seconds, all pending orders on the `market` you specified will be automatically cancelled. If no `market` is specified, all market cancelled. If the `timeout` is set to 0 within 30 seconds, the countdown timer will be terminated and the automatic order cancellation function will be cancelled. # 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_spot_with_http_info(countdown_cancel_all_spot_task, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param CountdownCancelAllSpotTask countdown_cancel_all_spot_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 = [ 'countdown_cancel_all_spot_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_spot" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'countdown_cancel_all_spot_task' is set if self.api_client.client_side_validation and ('countdown_cancel_all_spot_task' not in local_var_params or # noqa: E501 local_var_params['countdown_cancel_all_spot_task'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `countdown_cancel_all_spot_task` when calling `countdown_cancel_all_spot`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'countdown_cancel_all_spot_task' in local_var_params: body_params = local_var_params['countdown_cancel_all_spot_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( '/spot/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 amend_batch_orders(self, batch_amend_item, **kwargs): # noqa: E501 """Batch modification of orders # noqa: E501 Modify orders in spot, unified account and isolated margin account by default. Modify uncompleted orders, up to 5 orders can be modified at a time. Request parameters should be passed in array format. If there are order modification failures during the batch modification process, the modification of the next order will continue to be executed, and the execution will return with the corresponding order failure information. The call order of batch modification orders is consistent with the order list order. The return content order of batch modification orders is consistent with the order list 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_batch_orders(batch_amend_item, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param list[BatchAmendItem] batch_amend_item: (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.BatchOrder] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.amend_batch_orders_with_http_info(batch_amend_item, **kwargs) # noqa: E501 def amend_batch_orders_with_http_info(self, batch_amend_item, **kwargs): # noqa: E501 """Batch modification of orders # noqa: E501 Modify orders in spot, unified account and isolated margin account by default. Modify uncompleted orders, up to 5 orders can be modified at a time. Request parameters should be passed in array format. If there are order modification failures during the batch modification process, the modification of the next order will continue to be executed, and the execution will return with the corresponding order failure information. The call order of batch modification orders is consistent with the order list order. The return content order of batch modification orders is consistent with the order list 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_batch_orders_with_http_info(batch_amend_item, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param list[BatchAmendItem] batch_amend_item: (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.BatchOrder], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'batch_amend_item', '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_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'batch_amend_item' is set if self.api_client.client_side_validation and ('batch_amend_item' not in local_var_params or # noqa: E501 local_var_params['batch_amend_item'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `batch_amend_item` when calling `amend_batch_orders`") # noqa: E501 collection_formats = {} path_params = {} 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_item' in local_var_params: body_params = local_var_params['batch_amend_item'] # 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( '/spot/amend_batch_orders', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[BatchOrder]', # 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_spot_insurance_history(self, business, currency, _from, to, **kwargs): # noqa: E501 """Query spot insurance fund historical data # 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_spot_insurance_history(business, currency, _from, to, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str business: Leverage business, margin - position by position; unified - unified account (required) :param str currency: Currency (required) :param int _from: Start timestamp in seconds (required) :param int to: End timestamp in seconds (required) :param int page: Page number :param int limit: The maximum number of items returned in the list, the default value is 30 :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.SpotInsuranceHistory] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_spot_insurance_history_with_http_info(business, currency, _from, to, **kwargs) # noqa: E501 def get_spot_insurance_history_with_http_info(self, business, currency, _from, to, **kwargs): # noqa: E501 """Query spot insurance fund historical data # 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_spot_insurance_history_with_http_info(business, currency, _from, to, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str business: Leverage business, margin - position by position; unified - unified account (required) :param str currency: Currency (required) :param int _from: Start timestamp in seconds (required) :param int to: End timestamp in seconds (required) :param int page: Page number :param int limit: The maximum number of items returned in the list, the default value is 30 :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.SpotInsuranceHistory], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'business', 'currency', '_from', 'to', 'page', '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 get_spot_insurance_history" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'business' is set if self.api_client.client_side_validation and ('business' not in local_var_params or # noqa: E501 local_var_params['business'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `business` when calling `get_spot_insurance_history`") # noqa: E501 # verify the required parameter 'currency' is set if self.api_client.client_side_validation and ('currency' not in local_var_params or # noqa: E501 local_var_params['currency'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency` when calling `get_spot_insurance_history`") # noqa: E501 # verify the required parameter '_from' is set if self.api_client.client_side_validation and ('_from' not in local_var_params or # noqa: E501 local_var_params['_from'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `_from` when calling `get_spot_insurance_history`") # noqa: E501 # verify the required parameter 'to' is set if self.api_client.client_side_validation and ('to' not in local_var_params or # noqa: E501 local_var_params['to'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `to` when calling `get_spot_insurance_history`") # noqa: E501 if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `page` when calling `get_spot_insurance_history`, must be a value greater than or equal to `1`") # 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_spot_insurance_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 `get_spot_insurance_history`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'business' in local_var_params and local_var_params['business'] is not None: # noqa: E501 query_params.append(('business', local_var_params['business'])) # noqa: E501 if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501 query_params.append(('currency', local_var_params['currency'])) # noqa: E501 if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # 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( '/spot/insurance_history', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[SpotInsuranceHistory]', # 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_spot_price_triggered_orders(self, status, **kwargs): # noqa: E501 """Query running 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_spot_price_triggered_orders(status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str status: Query order list based on status (required) :param str market: Trading market :param str account: Trading account type. Unified account must be set to `unified` :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.SpotPriceTriggeredOrder] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_spot_price_triggered_orders_with_http_info(status, **kwargs) # noqa: E501 def list_spot_price_triggered_orders_with_http_info(self, status, **kwargs): # noqa: E501 """Query running 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_spot_price_triggered_orders_with_http_info(status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str status: Query order list based on status (required) :param str market: Trading market :param str account: Trading account type. Unified account must be set to `unified` :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.SpotPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'status', 'market', 'account', '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_spot_price_triggered_orders" % k ) local_var_params[k] = v del local_var_params['kwargs'] # 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_spot_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_spot_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_spot_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_spot_price_triggered_orders`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} 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 'market' in local_var_params and local_var_params['market'] is not None: # noqa: E501 query_params.append(('market', local_var_params['market'])) # noqa: E501 if 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 query_params.append(('account', local_var_params['account'])) # 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( '/spot/price_orders', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[SpotPriceTriggeredOrder]', # 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_spot_price_triggered_order(self, spot_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_spot_price_triggered_order(spot_price_triggered_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param SpotPriceTriggeredOrder spot_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_spot_price_triggered_order_with_http_info(spot_price_triggered_order, **kwargs) # noqa: E501 def create_spot_price_triggered_order_with_http_info(self, spot_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_spot_price_triggered_order_with_http_info(spot_price_triggered_order, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param SpotPriceTriggeredOrder spot_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 = [ 'spot_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_spot_price_triggered_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'spot_price_triggered_order' is set if self.api_client.client_side_validation and ('spot_price_triggered_order' not in local_var_params or # noqa: E501 local_var_params['spot_price_triggered_order'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `spot_price_triggered_order` when calling `create_spot_price_triggered_order`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'spot_price_triggered_order' in local_var_params: body_params = local_var_params['spot_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( '/spot/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_spot_price_triggered_order_list(self, **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_spot_price_triggered_order_list(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str market: Trading market :param str account: Trading account type. Unified account must be set to `unified` :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.SpotPriceTriggeredOrder] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.cancel_spot_price_triggered_order_list_with_http_info(**kwargs) # noqa: E501 def cancel_spot_price_triggered_order_list_with_http_info(self, **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_spot_price_triggered_order_list_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str market: Trading market :param str account: Trading account type. Unified account must be set to `unified` :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.SpotPriceTriggeredOrder], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'market', 'account' ] 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_spot_price_triggered_order_list" % k ) local_var_params[k] = v del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'market' in local_var_params and local_var_params['market'] is not None: # noqa: E501 query_params.append(('market', local_var_params['market'])) # noqa: E501 if 'account' in local_var_params and local_var_params['account'] is not None: # noqa: E501 query_params.append(('account', local_var_params['account'])) # 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( '/spot/price_orders', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[SpotPriceTriggeredOrder]', # 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_spot_price_triggered_order(self, 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_spot_price_triggered_order(order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str 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.SpotPriceTriggeredOrder :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_spot_price_triggered_order_with_http_info(order_id, **kwargs) # noqa: E501 def get_spot_price_triggered_order_with_http_info(self, 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_spot_price_triggered_order_with_http_info(order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str 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.SpotPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ '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_spot_price_triggered_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # 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_spot_price_triggered_order`") # noqa: E501 collection_formats = {} path_params = {} 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( '/spot/price_orders/{order_id}', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='SpotPriceTriggeredOrder', # 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_spot_price_triggered_order(self, 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_spot_price_triggered_order(order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str 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.SpotPriceTriggeredOrder :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.cancel_spot_price_triggered_order_with_http_info(order_id, **kwargs) # noqa: E501 def cancel_spot_price_triggered_order_with_http_info(self, 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_spot_price_triggered_order_with_http_info(order_id, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str 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.SpotPriceTriggeredOrder, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ '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_spot_price_triggered_order" % k ) local_var_params[k] = v del local_var_params['kwargs'] # 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_spot_price_triggered_order`") # noqa: E501 collection_formats = {} path_params = {} 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( '/spot/price_orders/{order_id}', 'DELETE', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='SpotPriceTriggeredOrder', # 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)