# 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 MarginApi(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_margin_accounts(self, **kwargs): # noqa: E501 """Margin account list # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_margin_accounts(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for 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.MarginAccount] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_margin_accounts_with_http_info(**kwargs) # noqa: E501 def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501 """Margin account list # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_margin_accounts_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair :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.MarginAccount], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_margin_accounts" % k ) local_var_params[k] = v del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/margin/accounts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[MarginAccount]', # 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_margin_account_book(self, **kwargs): # noqa: E501 """Query margin account balance change history # noqa: E501 Currently only provides transfer history to and from margin accounts. Query time range cannot exceed 30 days # 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_margin_account_book(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query history for specified currency. If `currency` is specified, `currency_pair` must also be specified. :param str currency_pair: Specify margin account currency pair. Used in combination with `currency`. Ignored if `currency` is not specified :param str type: Query by specified account change type. If not specified, all change types will be included. :param int _from: Start timestamp for the query :param int to: End timestamp for the query, defaults to current time if not specified :param int page: Page number :param int limit: Maximum number of records returned in a single list :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for 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.MarginAccountBook] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_margin_account_book_with_http_info(**kwargs) # noqa: E501 def list_margin_account_book_with_http_info(self, **kwargs): # noqa: E501 """Query margin account balance change history # noqa: E501 Currently only provides transfer history to and from margin accounts. Query time range cannot exceed 30 days # 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_margin_account_book_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query history for specified currency. If `currency` is specified, `currency_pair` must also be specified. :param str currency_pair: Specify margin account currency pair. Used in combination with `currency`. Ignored if `currency` is not specified :param str type: Query by specified account change type. If not specified, all change types will be included. :param int _from: Start timestamp for the query :param int to: End timestamp for the query, defaults to current time if not specified :param int page: Page number :param int limit: Maximum number of records returned in a single list :param _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.MarginAccountBook], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency', 'currency_pair', 'type', '_from', 'to', 'page', 'limit' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_margin_account_book" % k ) local_var_params[k] = v del local_var_params['kwargs'] if self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `page` when calling `list_margin_account_book`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 500: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_margin_account_book`, must be a value less than or equal to `500`") # 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_margin_account_book`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501 query_params.append(('currency', local_var_params['currency'])) # noqa: E501 if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 if '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 '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501 query_params.append(('from', local_var_params['_from'])) # noqa: E501 if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501 query_params.append(('to', local_var_params['to'])) # noqa: E501 if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501 query_params.append(('page', local_var_params['page'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 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( '/margin/account_book', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[MarginAccountBook]', # 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_funding_accounts(self, **kwargs): # noqa: E501 """Funding account list # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_funding_accounts(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified currency name :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.FundingAccount] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_funding_accounts_with_http_info(**kwargs) # noqa: E501 def list_funding_accounts_with_http_info(self, **kwargs): # noqa: E501 """Funding account list # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_funding_accounts_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: Query by specified currency name :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.FundingAccount], 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_funding_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( '/margin/funding_accounts', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[FundingAccount]', # 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_auto_repay_status(self, **kwargs): # noqa: E501 """Query user auto repayment settings # 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_auto_repay_status(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.AutoRepaySetting :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_auto_repay_status_with_http_info(**kwargs) # noqa: E501 def get_auto_repay_status_with_http_info(self, **kwargs): # noqa: E501 """Query user auto repayment settings # 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_auto_repay_status_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.AutoRepaySetting, 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_auto_repay_status" % 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( '/margin/auto_repay', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='AutoRepaySetting', # 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_auto_repay(self, status, **kwargs): # noqa: E501 """Update user auto repayment settings # 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_auto_repay(status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str status: Whether to enable auto repayment: `on` - enabled, `off` - disabled (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.AutoRepaySetting :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.set_auto_repay_with_http_info(status, **kwargs) # noqa: E501 def set_auto_repay_with_http_info(self, status, **kwargs): # noqa: E501 """Update user auto repayment settings # 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_auto_repay_with_http_info(status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str status: Whether to enable auto repayment: `on` - enabled, `off` - disabled (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.AutoRepaySetting, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'status' ] 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_auto_repay" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'status' is set if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 local_var_params['status'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `status` when calling `set_auto_repay`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'status' in local_var_params and local_var_params['status'] is not None: # noqa: E501 query_params.append(('status', local_var_params['status'])) # noqa: E501 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( '/margin/auto_repay', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='AutoRepaySetting', # 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_margin_transferable(self, currency, **kwargs): # noqa: E501 """Get maximum transferable amount for isolated 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.get_margin_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 str currency_pair: Currency pair :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for 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.MarginTransferable :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_margin_transferable_with_http_info(currency, **kwargs) # noqa: E501 def get_margin_transferable_with_http_info(self, currency, **kwargs): # noqa: E501 """Get maximum transferable amount for isolated 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.get_margin_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 str currency_pair: Currency pair :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.MarginTransferable, status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency', 'currency_pair' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_margin_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_margin_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 if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/margin/transferable', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='MarginTransferable', # 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_margin_tier(self, currency_pair, **kwargs): # noqa: E501 """Query user's own leverage lending tiers in current market # 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_margin_tier(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.MarginLeverageTier] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_user_margin_tier_with_http_info(currency_pair, **kwargs) # noqa: E501 def get_user_margin_tier_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Query user's own leverage lending tiers in current market # 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_margin_tier_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.MarginLeverageTier], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_user_margin_tier" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_user_margin_tier`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 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( '/margin/user/loan_margin_tiers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[MarginLeverageTier]', # 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_market_margin_tier(self, currency_pair, **kwargs): # noqa: E501 """Query current market leverage lending 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.get_market_margin_tier(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: list[gate_api.MarginLeverageTier] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.get_market_margin_tier_with_http_info(currency_pair, **kwargs) # noqa: E501 def get_market_margin_tier_with_http_info(self, currency_pair, **kwargs): # noqa: E501 """Query current market leverage lending 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.get_market_margin_tier_with_http_info(currency_pair, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :rtype: tuple(list[gate_api.MarginLeverageTier], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method get_market_margin_tier" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'currency_pair' is set if self.api_client.client_side_validation and ('currency_pair' not in local_var_params or # noqa: E501 local_var_params['currency_pair'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `currency_pair` when calling `get_market_margin_tier`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 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( '/margin/loan_margin_tiers', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[MarginLeverageTier]', # 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_market_leverage(self, margin_market_leverage, **kwargs): # noqa: E501 """Set user market leverage multiplier # 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_market_leverage(margin_market_leverage, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param MarginMarketLeverage margin_market_leverage: (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_market_leverage_with_http_info(margin_market_leverage, **kwargs) # noqa: E501 def set_user_market_leverage_with_http_info(self, margin_market_leverage, **kwargs): # noqa: E501 """Set user market leverage multiplier # 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_market_leverage_with_http_info(margin_market_leverage, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param MarginMarketLeverage margin_market_leverage: (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 = [ 'margin_market_leverage' ] 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_market_leverage" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'margin_market_leverage' is set if self.api_client.client_side_validation and ('margin_market_leverage' not in local_var_params or # noqa: E501 local_var_params['margin_market_leverage'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `margin_market_leverage` when calling `set_user_market_leverage`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] header_params = {} form_params = [] local_var_files = {} body_params = None if 'margin_market_leverage' in local_var_params: body_params = local_var_params['margin_market_leverage'] # 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( '/margin/leverage/user_market_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_margin_user_account(self, **kwargs): # noqa: E501 """Query user's isolated margin account list # noqa: E501 Supports querying risk ratio isolated accounts and margin ratio isolated accounts # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_margin_user_account(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for 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.MarginAccount] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_margin_user_account_with_http_info(**kwargs) # noqa: E501 def list_margin_user_account_with_http_info(self, **kwargs): # noqa: E501 """Query user's isolated margin account list # noqa: E501 Supports querying risk ratio isolated accounts and margin ratio isolated accounts # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_margin_user_account_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency_pair: Currency pair :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.MarginAccount], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency_pair' ] all_params.extend( [ 'async_req', '_return_http_data_only', '_preload_content', '_request_timeout' ] ) for k, v in six.iteritems(local_var_params['kwargs']): if k not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" " to method list_margin_user_account" % k ) local_var_params[k] = v del local_var_params['kwargs'] collection_formats = {} path_params = {} query_params = [] if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501 query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501 header_params = {} form_params = [] local_var_files = {} body_params = None # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['apiv4'] # noqa: E501 return self.api_client.call_api( '/margin/user/account', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[MarginAccount]', # 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_cross_margin_loans(self, status, **kwargs): # noqa: E501 """Query cross margin borrow history (deprecated) # noqa: E501 Sorted by creation time in descending order by default. Set `reverse=false` for ascending order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_cross_margin_loans(status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param int status: Filter by status. Supported values are 2 and 3. (deprecated.) (required) :param str currency: Query by specified currency, includes all currencies if not specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for 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.CrossMarginLoan] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_cross_margin_loans_with_http_info(status, **kwargs) # noqa: E501 def list_cross_margin_loans_with_http_info(self, status, **kwargs): # noqa: E501 """Query cross margin borrow history (deprecated) # noqa: E501 Sorted by creation time in descending order by default. Set `reverse=false` for ascending order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_cross_margin_loans_with_http_info(status, async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param int status: Filter by status. Supported values are 2 and 3. (deprecated.) (required) :param str currency: Query by specified currency, includes all currencies if not specified :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results :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.CrossMarginLoan], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'status', 'currency', 'limit', 'offset', 'reverse' ] 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_cross_margin_loans" % k ) local_var_params[k] = v del local_var_params['kwargs'] # verify the required parameter 'status' is set if self.api_client.client_side_validation and ('status' not in local_var_params or # noqa: E501 local_var_params['status'] is None): # noqa: E501 raise ApiValueError("Missing the required parameter `status` when calling `list_cross_margin_loans`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_cross_margin_loans`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_cross_margin_loans`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_cross_margin_loans`, must be a value greater than or equal to `0`") # noqa: E501 collection_formats = {} path_params = {} query_params = [] if 'status' in local_var_params and local_var_params['status'] is not None: # noqa: E501 query_params.append(('status', local_var_params['status'])) # noqa: E501 if '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 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 if 'reverse' in local_var_params and local_var_params['reverse'] is not None: # noqa: E501 query_params.append(('reverse', local_var_params['reverse'])) # noqa: E501 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( '/margin/cross/loans', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[CrossMarginLoan]', # 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_cross_margin_repayments(self, **kwargs): # noqa: E501 """Retrieve cross margin repayments. (deprecated) # noqa: E501 Sorted by creation time in descending order by default. Set `reverse=false` for ascending order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_cross_margin_repayments(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: :param str loan_id: :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for 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.CrossMarginRepayment] :return: If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True return self.list_cross_margin_repayments_with_http_info(**kwargs) # noqa: E501 def list_cross_margin_repayments_with_http_info(self, **kwargs): # noqa: E501 """Retrieve cross margin repayments. (deprecated) # noqa: E501 Sorted by creation time in descending order by default. Set `reverse=false` for ascending order # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_cross_margin_repayments_with_http_info(async_req=True) >>> result = thread.get() :param bool async_req: execute request asynchronously :param str currency: :param str loan_id: :param int limit: Maximum number of records returned in a single list :param int offset: List offset, starting from 0 :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results :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.CrossMarginRepayment], status_code(int), headers(HTTPHeaderDict)) :return: If the method is called asynchronously, returns the request thread. """ local_var_params = locals() all_params = [ 'currency', 'loan_id', 'limit', 'offset', 'reverse' ] 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_cross_margin_repayments" % k ) local_var_params[k] = v del local_var_params['kwargs'] if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_cross_margin_repayments`, must be a value less than or equal to `1000`") # noqa: E501 if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501 raise ApiValueError("Invalid value for parameter `limit` when calling `list_cross_margin_repayments`, must be a value greater than or equal to `1`") # noqa: E501 if self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0: # noqa: E501 raise ApiValueError("Invalid value for parameter `offset` when calling `list_cross_margin_repayments`, must be a value greater than or equal to `0`") # 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 'loan_id' in local_var_params and local_var_params['loan_id'] is not None: # noqa: E501 query_params.append(('loan_id', local_var_params['loan_id'])) # noqa: E501 if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501 query_params.append(('limit', local_var_params['limit'])) # noqa: E501 if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501 query_params.append(('offset', local_var_params['offset'])) # noqa: E501 if 'reverse' in local_var_params and local_var_params['reverse'] is not None: # noqa: E501 query_params.append(('reverse', local_var_params['reverse'])) # noqa: E501 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( '/margin/cross/repayments', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='list[CrossMarginRepayment]', # 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)