# coding: utf-8 """ Gate API v4 Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501 Contact: support@mail.gate.io Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import re # noqa: F401 # python 2 and python 3 compatibility library import six from gate_api.api_client import ApiClient from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401 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. You can refer to the [Formula](#portfolio-account) in the documentation # 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: Retrieve data of the specified 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: 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. You can refer to the [Formula](#portfolio-account) in the documentation # 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: Retrieve data of the specified 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(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'] 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 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 list_unified_account_mode(self, **kwargs): # noqa: E501 """Query mode of the unified account # noqa: E501 cross_margin - cross margin, usdt_futures - usdt futures # 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_account_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: dict(str, bool) :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_unified_account_mode_with_http_info(**kwargs) # noqa: E501 def list_unified_account_mode_with_http_info(self, **kwargs): # noqa: E501 """Query mode of the unified account # noqa: E501 cross_margin - cross margin, usdt_futures - usdt futures # 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_account_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(dict(str, bool), 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_unified_account_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/account_mode', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='dict(str, bool)', # 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_account_mode(self, unified_mode, **kwargs): # noqa: E501 """Set mode of the 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.set_unified_account_mode(unified_mode, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedMode unified_mode: (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: dict(str, bool) :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.set_unified_account_mode_with_http_info(unified_mode, **kwargs) # noqa: E501 def set_unified_account_mode_with_http_info(self, unified_mode, **kwargs): # noqa: E501 """Set mode of the 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.set_unified_account_mode_with_http_info(unified_mode, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param UnifiedMode unified_mode: (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(dict(str, bool), status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = ['unified_mode'] all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout']) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method set_unified_account_mode" % k) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'unified_mode' is set if self.api_client.client_side_validation and ( 'unified_mode' not in local_var_params or local_var_params['unified_mode'] is None # noqa: E501 ): # noqa: E501 raise ApiValueError( "Missing the required parameter `unified_mode` when calling `set_unified_account_mode`" ) # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'unified_mode' in local_var_params: body_params = local_var_params['unified_mode'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501 # HTTP header `Content-Type` header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 ['application/json'] ) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/unified/account_mode', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='dict(str, bool)', # 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 about the maximum borrowing for the 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: Retrieve data of the specified 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.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 about the maximum borrowing for the 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: Retrieve data of the specified 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.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 local_var_params['currency'] is None # noqa: E501 ): # 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 about the maximum transferable for the 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: Retrieve data of the specified 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.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 about the maximum transferable for the 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: Retrieve data of the specified 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.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 local_var_params['currency'] is None # noqa: E501 ): # 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 list_unified_loans(self, **kwargs): # noqa: E501 """List 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: Retrieve data of the specified currency :param int page: Page number :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 :param str type: Loan type, platform - platform, margin - 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 """List 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: Retrieve data of the specified currency :param int page: Page number :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 :param str type: Loan type, platform - platform, margin - 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, it is essential to ensure that 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 the user. The interest on the loan will be automatically deducted from the account at regular intervals. It is the user's responsibility to manage the repayment of the borrowed amount. For repayment, the option to repay the entire borrowed amount is available by setting the parameter `repaid_all=true` # 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: None :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, it is essential to ensure that 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 the user. The interest on the loan will be automatically deducted from the account at regular intervals. It is the user's responsibility to manage the repayment of the borrowed amount. For repayment, the option to repay the entire borrowed amount is available by setting the parameter `repaid_all=true` # 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: None :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 local_var_params['unified_loan'] is None # noqa: E501 ): # 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 `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=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_loan_records(self, **kwargs): # noqa: E501 """Get load 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: The types of lending records, borrow - indicates the action of borrowing funds, repay - indicates the action of repaying the borrowed funds :param str currency: Retrieve data of the specified currency :param int page: Page number :param int limit: Maximum response items. 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 """Get load 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: The types of lending records, borrow - indicates the action of borrowing funds, repay - indicates the action of repaying the borrowed funds :param str currency: Retrieve data of the specified currency :param int page: Page number :param int limit: Maximum response items. 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 """List interest 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: Retrieve data of the specified currency :param int page: Page number :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 :param str type: Loan type, platform - platform, margin - 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.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 """List interest 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: Retrieve data of the specified currency :param int page: Page number :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100 :param str type: Loan type, platform - platform, margin - 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.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', '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 '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_estimate_rate(self, currencies, **kwargs): # noqa: E501 """Get unified estimate rate # noqa: E501 Due to fluctuations in lending depth, hourly interest rates may vary, and thus, I cannot provide exact rates. 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 the currency names for querying in an array, separated by commas, with a maximum of 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 """Get unified estimate rate # noqa: E501 Due to fluctuations in lending depth, hourly interest rates may vary, and thus, I cannot provide exact rates. 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 the currency names for querying in an array, separated by commas, with a maximum of 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 local_var_params['currencies'] is None # noqa: E501 ): # 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 len(local_var_params['currencies']) > 10 # noqa: E501 ): # 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 len(local_var_params['currencies']) < 1 # noqa: E501 ): # 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 """list currency discount tiers # 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 """list currency discount tiers # 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, )