# coding: utf-8 """ Gate API v4 APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 OpenAPI spec version: 4.7.2 Contact: support@mail.gate.io 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 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 cancel_order(self, order_id, currency_pair, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_order(order_id, currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str order_id: ID returned on order successfully being created (required) :param str currency_pair: Currency pair (required) :return: Order If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.cancel_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 else: (data) = self.cancel_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 return data def cancel_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: E501 """Cancel a single order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.cancel_order_with_http_info(order_id, currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str order_id: ID returned on order successfully being created (required) :param str currency_pair: Currency pair (required) :return: Order If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['order_id', 'currency_pair'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method cancel_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order_id' is set if ('order_id' not in local_var_params or local_var_params['order_id'] is None): raise ValueError("Missing the required parameter `order_id` when calling `cancel_order`") # noqa: E501 # verify the required parameter 'currency_pair' is set if ('currency_pair' not in local_var_params or local_var_params['currency_pair'] is None): raise ValueError("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: 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 = ['api_key', 'api_sign', 'api_timestamp'] # 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 cancel_orders(self, currency_pair, **kwargs): # noqa: E501 """Cancel all `open` orders in specified currency pair # 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(currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str currency_pair: Currency pair (required) :param str side: All bids or asks. Both included in not specified :param str account: Specify account type. Default to all account types being included :return: list[Order] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.cancel_orders_with_http_info(currency_pair, **kwargs) # noqa: E501 else: (data) = self.cancel_orders_with_http_info(currency_pair, **kwargs) # noqa: E501 return data def cancel_orders_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Cancel all `open` orders in specified currency pair # 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(currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str currency_pair: Currency pair (required) :param str side: All bids or asks. Both included in not specified :param str account: Specify account type. Default to all account types being included :return: list[Order] If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['currency_pair', 'side', 'account'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method cancel_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if ('currency_pair' not in local_var_params or local_var_params['currency_pair'] is None): raise ValueError("Missing the required parameter `currency_pair` when calling `cancel_orders`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params: query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 if 'side' in local_var_params: query_params.append(('side', local_var_params['side'])) # noqa: E501 if 'account' in local_var_params: 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 = ['api_key', 'api_sign', 'api_timestamp'] # 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[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 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 async_req bool :param Order order: (required) :return: Order If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.create_order_with_http_info(order, **kwargs) # noqa: E501 else: (data) = self.create_order_with_http_info(order, **kwargs) # noqa: E501 return data def create_order_with_http_info(self, order, **kwargs): # noqa: E501 """Create an 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_order_with_http_info(order, async_req=True) >>> result = thread.get() :param async_req bool :param Order order: (required) :return: Order If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['order'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method create_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order' is set if ('order' not in local_var_params or local_var_params['order'] is None): raise ValueError("Missing the required parameter `order` when calling `create_order`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} 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 = ['api_key', 'api_sign', 'api_timestamp'] # 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 get_currency_pair(self, currency_pair, **kwargs): # noqa: E501 """Get detail of one single order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_currency_pair(currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str currency_pair: Currency pair (required) :return: CurrencyPair If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.get_currency_pair_with_http_info(currency_pair, **kwargs) # noqa: E501 else: (data) = self.get_currency_pair_with_http_info(currency_pair, **kwargs) # noqa: E501 return data def get_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Get detail of one single order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_currency_pair_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str currency_pair: Currency pair (required) :return: CurrencyPair If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['currency_pair'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_currency_pair" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if ('currency_pair' not in local_var_params or local_var_params['currency_pair'] is None): raise ValueError("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 get_order(self, order_id, currency_pair, **kwargs): # noqa: E501 """Get a single order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_order(order_id, currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str order_id: ID returned on order successfully being created (required) :param str currency_pair: Currency pair (required) :return: Order If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.get_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 else: (data) = self.get_order_with_http_info(order_id, currency_pair, **kwargs) # noqa: E501 return data def get_order_with_http_info(self, order_id, currency_pair, **kwargs): # noqa: E501 """Get a single order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_order_with_http_info(order_id, currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str order_id: ID returned on order successfully being created (required) :param str currency_pair: Currency pair (required) :return: Order If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['order_id', 'currency_pair'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method get_order" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order_id' is set if ('order_id' not in local_var_params or local_var_params['order_id'] is None): raise ValueError("Missing the required parameter `order_id` when calling `get_order`") # noqa: E501 # verify the required parameter 'currency_pair' is set if ('currency_pair' not in local_var_params or local_var_params['currency_pair'] is None): raise ValueError("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: 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 = ['api_key', 'api_sign', 'api_timestamp'] # 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 list_candlesticks(self, currency_pair, **kwargs): # noqa: E501 """Market candlesticks # noqa: E501 Candlestick data will start from (current time - limit * interval), end at 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.list_candlesticks(currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str currency_pair: Currency pair (required) :param int limit: Maximum number of record returned in one list :param str interval: Interval time between data points :return: list[list[str]] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.list_candlesticks_with_http_info(currency_pair, **kwargs) # noqa: E501 else: (data) = self.list_candlesticks_with_http_info(currency_pair, **kwargs) # noqa: E501 return data def list_candlesticks_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Market candlesticks # noqa: E501 Candlestick data will start from (current time - limit * interval), end at 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.list_candlesticks_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str currency_pair: Currency pair (required) :param int limit: Maximum number of record returned in one list :param str interval: Interval time between data points :return: list[list[str]] If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['currency_pair', 'limit', 'interval'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_candlesticks" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if ('currency_pair' not in local_var_params or local_var_params['currency_pair'] is None): raise ValueError("Missing the required parameter `currency_pair` when calling `list_candlesticks`") # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ValueError("Invalid value for parameter `limit` when calling `list_candlesticks`, must be a value less than or equal to `1000`") # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ValueError("Invalid value for parameter `limit` when calling `list_candlesticks`, 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: query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 if 'limit' in local_var_params: query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'interval' in local_var_params: 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 list_currency_pairs(self, **kwargs): # noqa: E501 """List all currency pairs supported # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_currency_pairs(async_req=True) >>> result = thread.get() :param async_req bool :return: list[CurrencyPair] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.list_currency_pairs_with_http_info(**kwargs) # noqa: E501 else: (data) = self.list_currency_pairs_with_http_info(**kwargs) # noqa: E501 return data def list_currency_pairs_with_http_info(self, **kwargs): # noqa: E501 """List all currency pairs supported # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_currency_pairs_with_http_info(async_req=True) >>> result = thread.get() :param async_req bool :return: list[CurrencyPair] If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_currency_pairs" % key ) local_var_params[key] = val 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 list_my_trades(self, currency_pair, **kwargs): # noqa: E501 """List personal trading history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_my_trades(currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str currency_pair: Currency pair (required) :param int limit: Maximum number of record returned in one list :param int page: Page number :param str order_id: List all trades of specified order :return: list[Trade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.list_my_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 else: (data) = self.list_my_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 return data def list_my_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """List personal trading history # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_my_trades_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param async_req bool :param str currency_pair: Currency pair (required) :param int limit: Maximum number of record returned in one list :param int page: Page number :param str order_id: List all trades of specified order :return: list[Trade] If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['currency_pair', 'limit', 'page', 'order_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_my_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if ('currency_pair' not in local_var_params or local_var_params['currency_pair'] is None): raise ValueError("Missing the required parameter `currency_pair` when calling `list_my_trades`") # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ValueError("Invalid value for parameter `limit` when calling `list_my_trades`, must be a value less than or equal to `1000`") # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ValueError("Invalid value for parameter `limit` when calling `list_my_trades`, must be a value greater than or equal to `1`") # noqa: E501 if 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 raise ValueError("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: query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 if 'limit' in local_var_params: query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'page' in local_var_params: query_params.append(('page', local_var_params['page'])) # noqa: E501 if 'order_id' in local_var_params: query_params.append(('order_id', local_var_params['order_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 = ['api_key', 'api_sign', 'api_timestamp'] # 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 list_order_book(self, currency_pair, **kwargs): # noqa: E501 """Retrieve order book # noqa: E501 Order book will be sorted by price from high to low on bids; reversed on asks # 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 async_req bool :param str currency_pair: Currency pair (required) :param str interval: Price precision of order book. 0 means no aggregation is applied :param int limit: Maximum number of order depth data in asks or bids :return: OrderBook If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.list_order_book_with_http_info(currency_pair, **kwargs) # noqa: E501 else: (data) = self.list_order_book_with_http_info(currency_pair, **kwargs) # noqa: E501 return data def list_order_book_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Retrieve order book # noqa: E501 Order book will be sorted by price from high to low on bids; reversed on asks # 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 async_req bool :param str currency_pair: Currency pair (required) :param str interval: Price precision of order book. 0 means no aggregation is applied :param int limit: Maximum number of order depth data in asks or bids :return: OrderBook If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['currency_pair', 'interval', 'limit'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_order_book" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if ('currency_pair' not in local_var_params or local_var_params['currency_pair'] is None): raise ValueError("Missing the required parameter `currency_pair` when calling `list_order_book`") # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] > 30: # noqa: E501 raise ValueError("Invalid value for parameter `limit` when calling `list_order_book`, must be a value less than or equal to `30`") # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ValueError("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: query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 if 'interval' in local_var_params: query_params.append(('interval', local_var_params['interval'])) # noqa: E501 if 'limit' in local_var_params: query_params.append(('limit', local_var_params['limit'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/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_orders(self, currency_pair, status, **kwargs): # noqa: E501 """List 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.list_orders(currency_pair, status, async_req=True) >>> result = thread.get() :param async_req bool :param str currency_pair: Currency pair (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 record returned in one list :return: list[Order] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.list_orders_with_http_info(currency_pair, status, **kwargs) # noqa: E501 else: (data) = self.list_orders_with_http_info(currency_pair, status, **kwargs) # noqa: E501 return data def list_orders_with_http_info(self, currency_pair, status, **kwargs): # noqa: E501 """List 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.list_orders_with_http_info(currency_pair, status, async_req=True) >>> result = thread.get() :param async_req bool :param str currency_pair: Currency pair (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 record returned in one list :return: list[Order] If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['currency_pair', 'status', 'page', 'limit'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_orders" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if ('currency_pair' not in local_var_params or local_var_params['currency_pair'] is None): raise ValueError("Missing the required parameter `currency_pair` when calling `list_orders`") # noqa: E501 # verify the required parameter 'status' is set if ('status' not in local_var_params or local_var_params['status'] is None): raise ValueError("Missing the required parameter `status` when calling `list_orders`") # noqa: E501 if 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 raise ValueError("Invalid value for parameter `page` when calling `list_orders`, must be a value greater than or equal to `1`") # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ValueError("Invalid value for parameter `limit` when calling `list_orders`, must be a value less than or equal to `1000`") # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ValueError("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: query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 if 'status' in local_var_params: query_params.append(('status', local_var_params['status'])) # noqa: E501 if 'page' in local_var_params: query_params.append(('page', local_var_params['page'])) # noqa: E501 if 'limit' in local_var_params: query_params.append(('limit', local_var_params['limit'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['api_key', 'api_sign', 'api_timestamp'] # 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 list_spot_accounts(self, **kwargs): # noqa: E501 """List spot 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 async_req bool :param str currency: Retrieved specified currency related data :return: list[SpotAccount] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.list_spot_accounts_with_http_info(**kwargs) # noqa: E501 else: (data) = self.list_spot_accounts_with_http_info(**kwargs) # noqa: E501 return data def list_spot_accounts_with_http_info(self, **kwargs): # noqa: E501 """List spot 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 async_req bool :param str currency: Retrieved specified currency related data :return: list[SpotAccount] If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['currency'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_spot_accounts" % key ) local_var_params[key] = val del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'currency' in local_var_params: 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 = ['api_key', 'api_sign', 'api_timestamp'] # 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_tickers(self, **kwargs): # noqa: E501 """Retrieve ticker information # noqa: E501 Return only related data if `currency_pair` is specified; otherwise return all of them # 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 async_req bool :param str currency_pair: Currency pair :return: list[Ticker] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.list_tickers_with_http_info(**kwargs) # noqa: E501 else: (data) = self.list_tickers_with_http_info(**kwargs) # noqa: E501 return data def list_tickers_with_http_info(self, **kwargs): # noqa: E501 """Retrieve ticker information # noqa: E501 Return only related data if `currency_pair` is specified; otherwise return all of them # 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 async_req bool :param str currency_pair: Currency pair :return: list[Ticker] If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['currency_pair'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_tickers" % key ) local_var_params[key] = val del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params: 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 = [] # 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_trades(self, currency_pair, **kwargs): # noqa: E501 """Retrieve market trades # 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 async_req bool :param str currency_pair: Currency pair (required) :param int limit: Maximum number of record returned in one list :param str last_id: Specify list staring point using the last record of `id` in previous list-query results :return: list[Trade] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): return self.list_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 else: (data) = self.list_trades_with_http_info(currency_pair, **kwargs) # noqa: E501 return data def list_trades_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Retrieve market trades # 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 async_req bool :param str currency_pair: Currency pair (required) :param int limit: Maximum number of record returned in one list :param str last_id: Specify list staring point using the last record of `id` in previous list-query results :return: list[Trade] If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['currency_pair', 'limit', 'last_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') all_params.append('_request_timeout') for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" " to method list_trades" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if ('currency_pair' not in local_var_params or local_var_params['currency_pair'] is None): raise ValueError("Missing the required parameter `currency_pair` when calling `list_trades`") # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ValueError("Invalid value for parameter `limit` when calling `list_trades`, must be a value less than or equal to `1000`") # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ValueError("Invalid value for parameter `limit` 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: query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 if 'limit' in local_var_params: query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'last_id' in local_var_params: query_params.append(('last_id', local_var_params['last_id'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # 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)