# 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 UnifiedApi(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_unified_accounts(self, **kwargs): # noqa: E501 """Get unified account information # noqa: E501 The assets of each currency in the account will be adjusted according to their liquidity, defined by corresponding adjustment coefficients, and then uniformly converted to USD to calculate the total asset value and position value of the account. For specific formulas, please refer to [Margin Formula](#margin-formula) # 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_unified_accounts(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified currency name :param str sub_uid: Sub account user 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.UnifiedAccount :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_unified_accounts_with_http_info(**kwargs) # noqa: E501 def list_unified_accounts_with_http_info(self, **kwargs): # noqa: E501 """Get unified account information # noqa: E501 The assets of each currency in the account will be adjusted according to their liquidity, defined by corresponding adjustment coefficients, and then uniformly converted to USD to calculate the total asset value and position value of the account. For specific formulas, please refer to [Margin Formula](#margin-formula) # 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_unified_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 str sub_uid: Sub account user 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.UnifiedAccount, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency', 'sub_uid' ] 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_unified_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 if 'sub_uid' in local_var_params and local_var_params['sub_uid'] is not None: # noqa: E501 query_params.append(('sub_uid', local_var_params['sub_uid'])) # 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( '/unified/accounts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UnifiedAccount', # 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_unified_borrowable(self, currency, **kwargs): # noqa: E501 """Query maximum borrowable amount for unified account # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_unified_borrowable(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified 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.UnifiedBorrowable :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_unified_borrowable_with_http_info(currency, **kwargs) # noqa: E501 def get_unified_borrowable_with_http_info(self, currency, **kwargs): # noqa: E501 """Query maximum borrowable amount for unified account # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_unified_borrowable_with_http_info(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified 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.UnifiedBorrowable, 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_unified_borrowable" % 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_unified_borrowable`") # 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 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( '/unified/borrowable', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UnifiedBorrowable', # 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_unified_transferable(self, currency, **kwargs): # noqa: E501 """Query maximum transferable amount for unified account # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_unified_transferable(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified 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.UnifiedTransferable :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_unified_transferable_with_http_info(currency, **kwargs) # noqa: E501 def get_unified_transferable_with_http_info(self, currency, **kwargs): # noqa: E501 """Query maximum transferable amount for unified account # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_unified_transferable_with_http_info(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified 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.UnifiedTransferable, 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_unified_transferable" % 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_unified_transferable`") # 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 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( '/unified/transferable', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UnifiedTransferable', # 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_unified_transferables(self, currencies, **kwargs): # noqa: E501 """Batch query maximum transferable amount for unified accounts. Each currency shows the maximum value. After user withdrawal, the transferable amount for all currencies will change # 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_unified_transferables(currencies, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currencies: Specify the currency name to query in batches, and support up to 100 pass parameters at a time (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.TransferablesResult] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_unified_transferables_with_http_info(currencies, **kwargs) # noqa: E501 def get_unified_transferables_with_http_info(self, currencies, **kwargs): # noqa: E501 """Batch query maximum transferable amount for unified accounts. Each currency shows the maximum value. After user withdrawal, the transferable amount for all currencies will change # 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_unified_transferables_with_http_info(currencies, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currencies: Specify the currency name to query in batches, and support up to 100 pass parameters at a time (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.TransferablesResult], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currencies' ] 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_unified_transferables" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currencies' is set if self.api_client.client_side_validation and ('currencies' not in local_var_params or # noqa: E501 local_var_params['currencies'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currencies` when calling `get_unified_transferables`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currencies' in local_var_params and local_var_params['currencies'] is not None: # noqa: E501 query_params.append(('currencies', local_var_params['currencies'])) # 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( '/unified/transferables', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[TransferablesResult]', # 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_unified_borrowable_list(self, currencies, **kwargs): # noqa: E501 """Batch query unified account maximum borrowable amount # 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_unified_borrowable_list(currencies, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param list[str] currencies: Specify currency names for querying in an array, separated by commas, maximum 10 currencies (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.UnifiedBorrowable1] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_unified_borrowable_list_with_http_info(currencies, **kwargs) # noqa: E501 def get_unified_borrowable_list_with_http_info(self, currencies, **kwargs): # noqa: E501 """Batch query unified account maximum borrowable amount # 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_unified_borrowable_list_with_http_info(currencies, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param list[str] currencies: Specify currency names for querying in an array, separated by commas, maximum 10 currencies (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.UnifiedBorrowable1], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currencies' ] 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_unified_borrowable_list" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currencies' is set if self.api_client.client_side_validation and ('currencies' not in local_var_params or # noqa: E501 local_var_params['currencies'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currencies` when calling `get_unified_borrowable_list`") # noqa: E501 if self.api_client.client_side_validation and ('currencies' in local_var_params and # noqa: E501 len(local_var_params['currencies']) > 10): # noqa: E501 raise ApiValueError("Invalid value for parameter `currencies` when calling `get_unified_borrowable_list`, number of items must be less than or equal to `10`") # noqa: E501 if self.api_client.client_side_validation and ('currencies' in local_var_params and # noqa: E501 len(local_var_params['currencies']) < 1): # noqa: E501 raise ApiValueError("Invalid value for parameter `currencies` when calling `get_unified_borrowable_list`, number of items must be greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currencies' in local_var_params and local_var_params['currencies'] is not None: # noqa: E501 query_params.append(('currencies', local_var_params['currencies'])) # noqa: E501 collection_formats['currencies'] = 'multi' # 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( '/unified/batch_borrowable', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[UnifiedBorrowable1]', # 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_unified_loans(self, **kwargs): # noqa: E501 """Query loans # 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_unified_loans(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified currency name :param int page: Page number :param int limit: Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 :param str type: Loan type: platform borrowing - platform, margin borrowing - margin :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.UniLoan] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_unified_loans_with_http_info(**kwargs) # noqa: E501 def list_unified_loans_with_http_info(self, **kwargs): # noqa: E501 """Query loans # 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_unified_loans_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 page: Page number :param int limit: Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 :param str type: Loan type: platform borrowing - platform, margin borrowing - margin :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.UniLoan], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency', 'page', 'limit', 'type' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_unified_loans" % 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_unified_loans`, 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_unified_loans`, 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_unified_loans`, 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 '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 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( '/unified/loans', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[UniLoan]', # 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_unified_loan(self, unified_loan, **kwargs): # noqa: E501 """Borrow or repay # noqa: E501 When borrowing, ensure the borrowed amount is not below the minimum borrowing threshold for the specific cryptocurrency and does not exceed the maximum borrowing limit set by the platform and user. Loan interest will be automatically deducted from the account at regular intervals. Users are responsible for managing repayment of borrowed amounts. For repayment, use `repaid_all=true` to repay all available amounts # 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_unified_loan(unified_loan, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedLoan unified_loan: (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.UnifiedLoanResult :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.create_unified_loan_with_http_info(unified_loan, **kwargs) # noqa: E501 def create_unified_loan_with_http_info(self, unified_loan, **kwargs): # noqa: E501 """Borrow or repay # noqa: E501 When borrowing, ensure the borrowed amount is not below the minimum borrowing threshold for the specific cryptocurrency and does not exceed the maximum borrowing limit set by the platform and user. Loan interest will be automatically deducted from the account at regular intervals. Users are responsible for managing repayment of borrowed amounts. For repayment, use `repaid_all=true` to repay all available amounts # 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_unified_loan_with_http_info(unified_loan, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedLoan unified_loan: (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.UnifiedLoanResult, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'unified_loan' ] 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_unified_loan" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'unified_loan' is set if self.api_client.client_side_validation and ('unified_loan' not in local_var_params or # noqa: E501 local_var_params['unified_loan'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `unified_loan` when calling `create_unified_loan`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'unified_loan' in local_var_params: body_params = local_var_params['unified_loan'] # 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( '/unified/loans', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UnifiedLoanResult', # 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_unified_loan_records(self, **kwargs): # noqa: E501 """Query loan records # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_unified_loan_records(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str type: Loan record type: borrow - borrowing, repay - repayment :param str currency: Query by specified currency name :param int page: Page number :param int limit: Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 :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.UnifiedLoanRecord] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_unified_loan_records_with_http_info(**kwargs) # noqa: E501 def list_unified_loan_records_with_http_info(self, **kwargs): # noqa: E501 """Query loan records # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_unified_loan_records_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str type: Loan record type: borrow - borrowing, repay - repayment :param str currency: Query by specified currency name :param int page: Page number :param int limit: Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 :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.UnifiedLoanRecord], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'type', 'currency', '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 list_unified_loan_records" % 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_unified_loan_records`, 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_unified_loan_records`, 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_unified_loan_records`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] 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 '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 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( '/unified/loan_records', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[UnifiedLoanRecord]', # 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_unified_loan_interest_records(self, **kwargs): # noqa: E501 """Query interest deduction records # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_unified_loan_interest_records(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified currency name :param int page: Page number :param int limit: Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 :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 type: Loan type: platform borrowing - platform, margin borrowing - margin. Defaults to margin 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.UniLoanInterestRecord] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_unified_loan_interest_records_with_http_info(**kwargs) # noqa: E501 def list_unified_loan_interest_records_with_http_info(self, **kwargs): # noqa: E501 """Query interest deduction records # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_unified_loan_interest_records_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 page: Page number :param int limit: Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 :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 type: Loan type: platform borrowing - platform, margin borrowing - margin. Defaults to margin 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.UniLoanInterestRecord], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency', 'page', 'limit', '_from', 'to', 'type' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_unified_loan_interest_records" % 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_unified_loan_interest_records`, 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_unified_loan_interest_records`, 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_unified_loan_interest_records`, 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 '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 if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501 query_params.append(('type', local_var_params['type'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/unified/interest_records', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[UniLoanInterestRecord]', # 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_unified_risk_units(self, **kwargs): # noqa: E501 """Get user risk unit details # noqa: E501 Get user risk unit details, only valid in portfolio margin mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_unified_risk_units(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.UnifiedRiskUnits :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_unified_risk_units_with_http_info(**kwargs) # noqa: E501 def get_unified_risk_units_with_http_info(self, **kwargs): # noqa: E501 """Get user risk unit details # noqa: E501 Get user risk unit details, only valid in portfolio margin mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_unified_risk_units_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.UnifiedRiskUnits, 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_unified_risk_units" % 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 = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/unified/risk_units', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UnifiedRiskUnits', # 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_unified_mode(self, **kwargs): # noqa: E501 """Query mode of the unified account # noqa: E501 Unified account mode: - `classic`: Classic account mode - `multi_currency`: Cross-currency margin mode - `portfolio`: Portfolio margin mode - `single_currency`: Single-currency margin mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_unified_mode(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.UnifiedModeSet :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_unified_mode_with_http_info(**kwargs) # noqa: E501 def get_unified_mode_with_http_info(self, **kwargs): # noqa: E501 """Query mode of the unified account # noqa: E501 Unified account mode: - `classic`: Classic account mode - `multi_currency`: Cross-currency margin mode - `portfolio`: Portfolio margin mode - `single_currency`: Single-currency margin mode # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.get_unified_mode_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.UnifiedModeSet, 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_unified_mode" % 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 = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/unified/unified_mode', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UnifiedModeSet', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def set_unified_mode(self, unified_mode_set, **kwargs): # noqa: E501 """Set unified account mode # noqa: E501 Each account mode switch only requires passing the corresponding account mode parameter, and also supports turning on or off the configuration switches under the corresponding account mode during the switch. - When enabling the classic account mode, mode=classic ``` PUT /unified/unified_mode { \"mode\": \"classic\" } ``` - When enabling the cross-currency margin \"multi_currency\", \"settings\": { \"usdt_futures\": true } } ``` - When enabling the portfolio margin mode, mode=portfolio ``` PUT /unified/unified_mode { \"mode\": \"portfolio\", \"settings\": { \"spot_hedge\": true } } ``` - When enabling the single-currency margin mode, mode=single_currency ``` PUT /unified/unified_mode { \"mode\": \"single_currency\" } ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.set_unified_mode(unified_mode_set, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedModeSet unified_mode_set: (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: None :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.set_unified_mode_with_http_info(unified_mode_set, **kwargs) # noqa: E501 def set_unified_mode_with_http_info(self, unified_mode_set, **kwargs): # noqa: E501 """Set unified account mode # noqa: E501 Each account mode switch only requires passing the corresponding account mode parameter, and also supports turning on or off the configuration switches under the corresponding account mode during the switch. - When enabling the classic account mode, mode=classic ``` PUT /unified/unified_mode { \"mode\": \"classic\" } ``` - When enabling the cross-currency margin \"multi_currency\", \"settings\": { \"usdt_futures\": true } } ``` - When enabling the portfolio margin mode, mode=portfolio ``` PUT /unified/unified_mode { \"mode\": \"portfolio\", \"settings\": { \"spot_hedge\": true } } ``` - When enabling the single-currency margin mode, mode=single_currency ``` PUT /unified/unified_mode { \"mode\": \"single_currency\" } ``` # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.set_unified_mode_with_http_info(unified_mode_set, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedModeSet unified_mode_set: (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: None :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'unified_mode_set' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method set_unified_mode" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'unified_mode_set' is set if self.api_client.client_side_validation and ('unified_mode_set' not in local_var_params or # noqa: E501 local_var_params['unified_mode_set'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `unified_mode_set` when calling `set_unified_mode`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'unified_mode_set' in local_var_params: body_params = local_var_params['unified_mode_set'] # 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( '/unified/unified_mode', 'PUT', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, # 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_unified_estimate_rate(self, currencies, **kwargs): # noqa: E501 """Query unified account estimated interest rate # noqa: E501 Interest rates fluctuate hourly based on lending depth, so exact rates cannot be provided. When a currency is not supported, the interest rate returned will be an empty string # 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_unified_estimate_rate(currencies, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param list[str] currencies: Specify currency names for querying in an array, separated by commas, maximum 10 currencies (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 :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_unified_estimate_rate_with_http_info(currencies, **kwargs) # noqa: E501 def get_unified_estimate_rate_with_http_info(self, currencies, **kwargs): # noqa: E501 """Query unified account estimated interest rate # noqa: E501 Interest rates fluctuate hourly based on lending depth, so exact rates cannot be provided. When a currency is not supported, the interest rate returned will be an empty string # 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_unified_estimate_rate_with_http_info(currencies, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param list[str] currencies: Specify currency names for querying in an array, separated by commas, maximum 10 currencies (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, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currencies' ] 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_unified_estimate_rate" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currencies' is set if self.api_client.client_side_validation and ('currencies' not in local_var_params or # noqa: E501 local_var_params['currencies'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currencies` when calling `get_unified_estimate_rate`") # noqa: E501 if self.api_client.client_side_validation and ('currencies' in local_var_params and # noqa: E501 len(local_var_params['currencies']) > 10): # noqa: E501 raise ApiValueError("Invalid value for parameter `currencies` when calling `get_unified_estimate_rate`, number of items must be less than or equal to `10`") # noqa: E501 if self.api_client.client_side_validation and ('currencies' in local_var_params and # noqa: E501 len(local_var_params['currencies']) < 1): # noqa: E501 raise ApiValueError("Invalid value for parameter `currencies` when calling `get_unified_estimate_rate`, number of items must be greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currencies' in local_var_params and local_var_params['currencies'] is not None: # noqa: E501 query_params.append(('currencies', local_var_params['currencies'])) # noqa: E501 collection_formats['currencies'] = 'multi' # 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( '/unified/estimate_rate', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='dict(str, 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_discount_tiers(self, **kwargs): # noqa: E501 """Query unified account tiered # 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_discount_tiers(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.UnifiedDiscount] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_currency_discount_tiers_with_http_info(**kwargs) # noqa: E501 def list_currency_discount_tiers_with_http_info(self, **kwargs): # noqa: E501 """Query unified account tiered # 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_discount_tiers_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.UnifiedDiscount], 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_discount_tiers" % 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( '/unified/currency_discount_tiers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[UnifiedDiscount]', # 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_loan_margin_tiers(self, **kwargs): # noqa: E501 """Query unified account tiered loan margin # 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_loan_margin_tiers(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.UnifiedMarginTiers] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_loan_margin_tiers_with_http_info(**kwargs) # noqa: E501 def list_loan_margin_tiers_with_http_info(self, **kwargs): # noqa: E501 """Query unified account tiered loan margin # 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_loan_margin_tiers_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.UnifiedMarginTiers], 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_loan_margin_tiers" % 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( '/unified/loan_margin_tiers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[UnifiedMarginTiers]', # 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 calculate_portfolio_margin(self, unified_portfolio_input, **kwargs): # noqa: E501 """Portfolio margin calculator # noqa: E501 Portfolio Margin Calculator When inputting simulated position portfolios, each position includes the position name and quantity held, supporting markets within the range of BTC and ETH perpetual contracts, options, and spot markets. When inputting simulated orders, each order includes the market identifier, order price, and order quantity, supporting markets within the range of BTC and ETH perpetual contracts, options, and spot markets. Market orders are not included. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.calculate_portfolio_margin(unified_portfolio_input, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedPortfolioInput unified_portfolio_input: (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.UnifiedPortfolioOutput :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.calculate_portfolio_margin_with_http_info(unified_portfolio_input, **kwargs) # noqa: E501 def calculate_portfolio_margin_with_http_info(self, unified_portfolio_input, **kwargs): # noqa: E501 """Portfolio margin calculator # noqa: E501 Portfolio Margin Calculator When inputting simulated position portfolios, each position includes the position name and quantity held, supporting markets within the range of BTC and ETH perpetual contracts, options, and spot markets. When inputting simulated orders, each order includes the market identifier, order price, and order quantity, supporting markets within the range of BTC and ETH perpetual contracts, options, and spot markets. Market orders are not included. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.calculate_portfolio_margin_with_http_info(unified_portfolio_input, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedPortfolioInput unified_portfolio_input: (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.UnifiedPortfolioOutput, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'unified_portfolio_input' ] 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 calculate_portfolio_margin" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'unified_portfolio_input' is set if self.api_client.client_side_validation and ('unified_portfolio_input' not in local_var_params or # noqa: E501 local_var_params['unified_portfolio_input'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `unified_portfolio_input` when calling `calculate_portfolio_margin`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'unified_portfolio_input' in local_var_params: body_params = local_var_params['unified_portfolio_input'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( '/unified/portfolio_calculator', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UnifiedPortfolioOutput', # 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_user_leverage_currency_config(self, currency, **kwargs): # noqa: E501 """Maximum and minimum currency leverage that can be set # 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_user_leverage_currency_config(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Currency (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.UnifiedLeverageConfig :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_user_leverage_currency_config_with_http_info(currency, **kwargs) # noqa: E501 def get_user_leverage_currency_config_with_http_info(self, currency, **kwargs): # noqa: E501 """Maximum and minimum currency leverage that can be set # 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_user_leverage_currency_config_with_http_info(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Currency (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.UnifiedLeverageConfig, 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_user_leverage_currency_config" % 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_user_leverage_currency_config`") # 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 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( '/unified/leverage/user_currency_config', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UnifiedLeverageConfig', # 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_user_leverage_currency_setting(self, **kwargs): # noqa: E501 """Get user currency leverage # noqa: E501 Get user currency leverage. If currency is not specified, query all currencies # 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_user_leverage_currency_setting(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Currency :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.UnifiedLeverageSetting] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_user_leverage_currency_setting_with_http_info(**kwargs) # noqa: E501 def get_user_leverage_currency_setting_with_http_info(self, **kwargs): # noqa: E501 """Get user currency leverage # noqa: E501 Get user currency leverage. If currency is not specified, query all currencies # 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_user_leverage_currency_setting_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Currency :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.UnifiedLeverageSetting], 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_user_leverage_currency_setting" % 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( '/unified/leverage/user_currency_setting', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[UnifiedLeverageSetting]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def set_user_leverage_currency_setting(self, unified_leverage_setting, **kwargs): # noqa: E501 """Set loan currency leverage # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.set_user_leverage_currency_setting(unified_leverage_setting, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedLeverageSetting unified_leverage_setting: (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: None :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.set_user_leverage_currency_setting_with_http_info(unified_leverage_setting, **kwargs) # noqa: E501 def set_user_leverage_currency_setting_with_http_info(self, unified_leverage_setting, **kwargs): # noqa: E501 """Set loan currency leverage # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.set_user_leverage_currency_setting_with_http_info(unified_leverage_setting, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedLeverageSetting unified_leverage_setting: (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: None :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'unified_leverage_setting' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method set_user_leverage_currency_setting" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'unified_leverage_setting' is set if self.api_client.client_side_validation and ('unified_leverage_setting' not in local_var_params or # noqa: E501 local_var_params['unified_leverage_setting'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `unified_leverage_setting` when calling `set_user_leverage_currency_setting`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'unified_leverage_setting' in local_var_params: body_params = local_var_params['unified_leverage_setting'] # 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( '/unified/leverage/user_currency_setting', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type=None, # 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_unified_currencies(self, **kwargs): # noqa: E501 """List of loan currencies supported by unified account # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_unified_currencies(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Currency :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.UnifiedCurrency] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_unified_currencies_with_http_info(**kwargs) # noqa: E501 def list_unified_currencies_with_http_info(self, **kwargs): # noqa: E501 """List of loan currencies supported by unified account # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_unified_currencies_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Currency :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.UnifiedCurrency], 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_unified_currencies" % 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 = [] # noqa: E501 return self.api_client.call_api( '/unified/currencies', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[UnifiedCurrency]', # 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_history_loan_rate(self, currency, **kwargs): # noqa: E501 """Get historical lending 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_history_loan_rate(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Currency (required) :param str tier: VIP level for the floating rate to be queried :param int page: Page number :param int limit: Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 :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.UnifiedHistoryLoanRate :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_history_loan_rate_with_http_info(currency, **kwargs) # noqa: E501 def get_history_loan_rate_with_http_info(self, currency, **kwargs): # noqa: E501 """Get historical lending 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_history_loan_rate_with_http_info(currency, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Currency (required) :param str tier: VIP level for the floating rate to be queried :param int page: Page number :param int limit: Maximum number of items returned. Default: 100, minimum: 1, maximum: 100 :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.UnifiedHistoryLoanRate, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency', 'tier', '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_history_loan_rate" % 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_history_loan_rate`") # 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_history_loan_rate`, 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 `get_history_loan_rate`, 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 `get_history_loan_rate`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'tier' in local_var_params and local_var_params['tier'] is not None: # noqa: E501 query_params.append(('tier', local_var_params['tier'])) # 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 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( '/unified/history_loan_rate', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UnifiedHistoryLoanRate', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) def set_unified_collateral(self, unified_collateral_req, **kwargs): # noqa: E501 """Set collateral currency # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.set_unified_collateral(unified_collateral_req, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedCollateralReq unified_collateral_req: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: gate_api.UnifiedCollateralRes :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.set_unified_collateral_with_http_info(unified_collateral_req, **kwargs) # noqa: E501 def set_unified_collateral_with_http_info(self, unified_collateral_req, **kwargs): # noqa: E501 """Set collateral currency # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.set_unified_collateral_with_http_info(unified_collateral_req, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedCollateralReq unified_collateral_req: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(gate_api.UnifiedCollateralRes, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'unified_collateral_req' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method set_unified_collateral" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'unified_collateral_req' is set if self.api_client.client_side_validation and ('unified_collateral_req' not in local_var_params or # noqa: E501 local_var_params['unified_collateral_req'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `unified_collateral_req` when calling `set_unified_collateral`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'unified_collateral_req' in local_var_params: body_params = local_var_params['unified_collateral_req'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/unified/collateral_currencies', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='UnifiedCollateralRes', # 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)