天择加密量化开放框架下载
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

312 lines
16 KiB

1 year ago
  1. # coding: utf-8
  2. """
  3. Gate API v4
  4. 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
  5. Contact: support@mail.gate.io
  6. Generated by: https://openapi-generator.tech
  7. """
  8. from __future__ import absolute_import
  9. import re # noqa: F401
  10. # python 2 and python 3 compatibility library
  11. import six
  12. from gate_api.api_client import ApiClient
  13. from gate_api.exceptions import ApiTypeError, ApiValueError # noqa: F401
  14. class RebateApi(object):
  15. """NOTE: This class is auto generated by OpenAPI Generator
  16. Ref: https://openapi-generator.tech
  17. Do not edit the class manually.
  18. """
  19. def __init__(self, api_client=None):
  20. if api_client is None:
  21. api_client = ApiClient()
  22. self.api_client = api_client
  23. def agency_transaction_history(self, **kwargs): # noqa: E501
  24. """The broker obtains the transaction history of the recommended user # noqa: E501
  25. Record time range cannot exceed 30 days # noqa: E501
  26. This method makes a synchronous HTTP request by default. To make an
  27. asynchronous HTTP request, please pass async_req=True
  28. >>> thread = api.agency_transaction_history(async_req=True)
  29. >>> result = thread.get()
  30. :param bool async_req: execute request asynchronously
  31. :param str currency_pair: Specify the currency pair, if not specified, return all currency pairs
  32. :param str user_id: User ID. If not specified, all user records will be returned
  33. :param int _from: Time range beginning, default to 7 days before current time
  34. :param int to: Time range ending, default to current time
  35. :param int limit: Maximum number of records to be returned in a single list
  36. :param int offset: List offset, starting from 0
  37. :param _preload_content: if False, the urllib3.HTTPResponse object will
  38. be returned without reading/decoding response
  39. data. Default is True.
  40. :param _request_timeout: timeout setting for this request. If one
  41. number provided, it will be total request
  42. timeout. It can also be a pair (tuple) of
  43. (connection, read) timeouts.
  44. :rtype: list[gate_api.AgencyTransactionHistory]
  45. :return: If the method is called asynchronously,
  46. returns the request thread.
  47. """
  48. kwargs['_return_http_data_only'] = True
  49. return self.agency_transaction_history_with_http_info(**kwargs) # noqa: E501
  50. def agency_transaction_history_with_http_info(self, **kwargs): # noqa: E501
  51. """The broker obtains the transaction history of the recommended user # noqa: E501
  52. Record time range cannot exceed 30 days # noqa: E501
  53. This method makes a synchronous HTTP request by default. To make an
  54. asynchronous HTTP request, please pass async_req=True
  55. >>> thread = api.agency_transaction_history_with_http_info(async_req=True)
  56. >>> result = thread.get()
  57. :param bool async_req: execute request asynchronously
  58. :param str currency_pair: Specify the currency pair, if not specified, return all currency pairs
  59. :param str user_id: User ID. If not specified, all user records will be returned
  60. :param int _from: Time range beginning, default to 7 days before current time
  61. :param int to: Time range ending, default to current time
  62. :param int limit: Maximum number of records to be returned in a single list
  63. :param int offset: List offset, starting from 0
  64. :param _return_http_data_only: response data without head status code
  65. and headers
  66. :param _preload_content: if False, the urllib3.HTTPResponse object will
  67. be returned without reading/decoding response
  68. data. Default is True.
  69. :param _request_timeout: timeout setting for this request. If one
  70. number provided, it will be total request
  71. timeout. It can also be a pair (tuple) of
  72. (connection, read) timeouts.
  73. :rtype: tuple(list[gate_api.AgencyTransactionHistory], status_code(int), headers(HTTPHeaderDict))
  74. :return: If the method is called asynchronously,
  75. returns the request thread.
  76. """
  77. local_var_params = locals()
  78. all_params = ['currency_pair', 'user_id', '_from', 'to', 'limit', 'offset']
  79. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  80. for k, v in six.iteritems(local_var_params['kwargs']):
  81. if k not in all_params:
  82. raise ApiTypeError(
  83. "Got an unexpected keyword argument '%s'" " to method agency_transaction_history" % k
  84. )
  85. local_var_params[k] = v
  86. del local_var_params['kwargs']
  87. if (
  88. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  89. ): # noqa: E501
  90. raise ApiValueError(
  91. "Invalid value for parameter `limit` when calling `agency_transaction_history`, must be a value less than or equal to `1000`"
  92. ) # noqa: E501
  93. if (
  94. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  95. ): # noqa: E501
  96. raise ApiValueError(
  97. "Invalid value for parameter `limit` when calling `agency_transaction_history`, must be a value greater than or equal to `1`"
  98. ) # noqa: E501
  99. if (
  100. self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0
  101. ): # noqa: E501
  102. raise ApiValueError(
  103. "Invalid value for parameter `offset` when calling `agency_transaction_history`, must be a value greater than or equal to `0`"
  104. ) # noqa: E501
  105. collection_formats = {}
  106. path_params = {}
  107. query_params = []
  108. if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501
  109. query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501
  110. if 'user_id' in local_var_params and local_var_params['user_id'] is not None: # noqa: E501
  111. query_params.append(('user_id', local_var_params['user_id'])) # noqa: E501
  112. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  113. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  114. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  115. query_params.append(('to', local_var_params['to'])) # noqa: E501
  116. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  117. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  118. if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501
  119. query_params.append(('offset', local_var_params['offset'])) # noqa: E501
  120. header_params = {}
  121. form_params = []
  122. local_var_files = {}
  123. body_params = None
  124. # HTTP header `Accept`
  125. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  126. # Authentication setting
  127. auth_settings = ['apiv4'] # noqa: E501
  128. return self.api_client.call_api(
  129. '/rebate/agency/transaction_history',
  130. 'GET',
  131. path_params,
  132. query_params,
  133. header_params,
  134. body=body_params,
  135. post_params=form_params,
  136. files=local_var_files,
  137. response_type='list[AgencyTransactionHistory]', # noqa: E501
  138. auth_settings=auth_settings,
  139. async_req=local_var_params.get('async_req'),
  140. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  141. _preload_content=local_var_params.get('_preload_content', True),
  142. _request_timeout=local_var_params.get('_request_timeout'),
  143. collection_formats=collection_formats,
  144. )
  145. def agency_commissions_history(self, **kwargs): # noqa: E501
  146. """The broker obtains the commission history of the recommended user # noqa: E501
  147. Record time range cannot exceed 30 days # noqa: E501
  148. This method makes a synchronous HTTP request by default. To make an
  149. asynchronous HTTP request, please pass async_req=True
  150. >>> thread = api.agency_commissions_history(async_req=True)
  151. >>> result = thread.get()
  152. :param bool async_req: execute request asynchronously
  153. :param str currency: Filter by currency. Return all currency records if not specified
  154. :param str user_id: User ID. If not specified, all user records will be returned
  155. :param int _from: Time range beginning, default to 7 days before current time
  156. :param int to: Time range ending, default to current time
  157. :param int limit: Maximum number of records to be returned in a single list
  158. :param int offset: List offset, starting from 0
  159. :param _preload_content: if False, the urllib3.HTTPResponse object will
  160. be returned without reading/decoding response
  161. data. Default is True.
  162. :param _request_timeout: timeout setting for this request. If one
  163. number provided, it will be total request
  164. timeout. It can also be a pair (tuple) of
  165. (connection, read) timeouts.
  166. :rtype: list[gate_api.AgencyCommissionHistory]
  167. :return: If the method is called asynchronously,
  168. returns the request thread.
  169. """
  170. kwargs['_return_http_data_only'] = True
  171. return self.agency_commissions_history_with_http_info(**kwargs) # noqa: E501
  172. def agency_commissions_history_with_http_info(self, **kwargs): # noqa: E501
  173. """The broker obtains the commission history of the recommended user # noqa: E501
  174. Record time range cannot exceed 30 days # noqa: E501
  175. This method makes a synchronous HTTP request by default. To make an
  176. asynchronous HTTP request, please pass async_req=True
  177. >>> thread = api.agency_commissions_history_with_http_info(async_req=True)
  178. >>> result = thread.get()
  179. :param bool async_req: execute request asynchronously
  180. :param str currency: Filter by currency. Return all currency records if not specified
  181. :param str user_id: User ID. If not specified, all user records will be returned
  182. :param int _from: Time range beginning, default to 7 days before current time
  183. :param int to: Time range ending, default to current time
  184. :param int limit: Maximum number of records to be returned in a single list
  185. :param int offset: List offset, starting from 0
  186. :param _return_http_data_only: response data without head status code
  187. and headers
  188. :param _preload_content: if False, the urllib3.HTTPResponse object will
  189. be returned without reading/decoding response
  190. data. Default is True.
  191. :param _request_timeout: timeout setting for this request. If one
  192. number provided, it will be total request
  193. timeout. It can also be a pair (tuple) of
  194. (connection, read) timeouts.
  195. :rtype: tuple(list[gate_api.AgencyCommissionHistory], status_code(int), headers(HTTPHeaderDict))
  196. :return: If the method is called asynchronously,
  197. returns the request thread.
  198. """
  199. local_var_params = locals()
  200. all_params = ['currency', 'user_id', '_from', 'to', 'limit', 'offset']
  201. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  202. for k, v in six.iteritems(local_var_params['kwargs']):
  203. if k not in all_params:
  204. raise ApiTypeError(
  205. "Got an unexpected keyword argument '%s'" " to method agency_commissions_history" % k
  206. )
  207. local_var_params[k] = v
  208. del local_var_params['kwargs']
  209. if (
  210. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  211. ): # noqa: E501
  212. raise ApiValueError(
  213. "Invalid value for parameter `limit` when calling `agency_commissions_history`, must be a value less than or equal to `1000`"
  214. ) # noqa: E501
  215. if (
  216. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  217. ): # noqa: E501
  218. raise ApiValueError(
  219. "Invalid value for parameter `limit` when calling `agency_commissions_history`, must be a value greater than or equal to `1`"
  220. ) # noqa: E501
  221. if (
  222. self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0
  223. ): # noqa: E501
  224. raise ApiValueError(
  225. "Invalid value for parameter `offset` when calling `agency_commissions_history`, must be a value greater than or equal to `0`"
  226. ) # noqa: E501
  227. collection_formats = {}
  228. path_params = {}
  229. query_params = []
  230. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  231. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  232. if 'user_id' in local_var_params and local_var_params['user_id'] is not None: # noqa: E501
  233. query_params.append(('user_id', local_var_params['user_id'])) # noqa: E501
  234. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  235. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  236. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  237. query_params.append(('to', local_var_params['to'])) # noqa: E501
  238. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  239. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  240. if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501
  241. query_params.append(('offset', local_var_params['offset'])) # noqa: E501
  242. header_params = {}
  243. form_params = []
  244. local_var_files = {}
  245. body_params = None
  246. # HTTP header `Accept`
  247. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  248. # Authentication setting
  249. auth_settings = ['apiv4'] # noqa: E501
  250. return self.api_client.call_api(
  251. '/rebate/agency/commission_history',
  252. 'GET',
  253. path_params,
  254. query_params,
  255. header_params,
  256. body=body_params,
  257. post_params=form_params,
  258. files=local_var_files,
  259. response_type='list[AgencyCommissionHistory]', # noqa: E501
  260. auth_settings=auth_settings,
  261. async_req=local_var_params.get('async_req'),
  262. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  263. _preload_content=local_var_params.get('_preload_content', True),
  264. _request_timeout=local_var_params.get('_request_timeout'),
  265. collection_formats=collection_formats,
  266. )