天择加密量化开放框架下载
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.

245 lines
11 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 WithdrawalApi(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 withdraw(self, ledger_record, **kwargs): # noqa: E501
  24. """Withdraw # noqa: E501
  25. This method makes a synchronous HTTP request by default. To make an
  26. asynchronous HTTP request, please pass async_req=True
  27. >>> thread = api.withdraw(ledger_record, async_req=True)
  28. >>> result = thread.get()
  29. :param bool async_req: execute request asynchronously
  30. :param LedgerRecord ledger_record: (required)
  31. :param _preload_content: if False, the urllib3.HTTPResponse object will
  32. be returned without reading/decoding response
  33. data. Default is True.
  34. :param _request_timeout: timeout setting for this request. If one
  35. number provided, it will be total request
  36. timeout. It can also be a pair (tuple) of
  37. (connection, read) timeouts.
  38. :rtype: gate_api.LedgerRecord
  39. :return: If the method is called asynchronously,
  40. returns the request thread.
  41. """
  42. kwargs['_return_http_data_only'] = True
  43. return self.withdraw_with_http_info(ledger_record, **kwargs) # noqa: E501
  44. def withdraw_with_http_info(self, ledger_record, **kwargs): # noqa: E501
  45. """Withdraw # noqa: E501
  46. This method makes a synchronous HTTP request by default. To make an
  47. asynchronous HTTP request, please pass async_req=True
  48. >>> thread = api.withdraw_with_http_info(ledger_record, async_req=True)
  49. >>> result = thread.get()
  50. :param bool async_req: execute request asynchronously
  51. :param LedgerRecord ledger_record: (required)
  52. :param _return_http_data_only: response data without head status code
  53. and headers
  54. :param _preload_content: if False, the urllib3.HTTPResponse object will
  55. be returned without reading/decoding response
  56. data. Default is True.
  57. :param _request_timeout: timeout setting for this request. If one
  58. number provided, it will be total request
  59. timeout. It can also be a pair (tuple) of
  60. (connection, read) timeouts.
  61. :rtype: tuple(gate_api.LedgerRecord, status_code(int), headers(HTTPHeaderDict))
  62. :return: If the method is called asynchronously,
  63. returns the request thread.
  64. """
  65. local_var_params = locals()
  66. all_params = ['ledger_record']
  67. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  68. for k, v in six.iteritems(local_var_params['kwargs']):
  69. if k not in all_params:
  70. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method withdraw" % k)
  71. local_var_params[k] = v
  72. del local_var_params['kwargs']
  73. # verify the required parameter 'ledger_record' is set
  74. if self.api_client.client_side_validation and (
  75. 'ledger_record' not in local_var_params or local_var_params['ledger_record'] is None # noqa: E501
  76. ): # noqa: E501
  77. raise ApiValueError("Missing the required parameter `ledger_record` when calling `withdraw`") # noqa: E501
  78. collection_formats = {}
  79. path_params = {}
  80. query_params = []
  81. header_params = {}
  82. form_params = []
  83. local_var_files = {}
  84. body_params = None
  85. if 'ledger_record' in local_var_params:
  86. body_params = local_var_params['ledger_record']
  87. # HTTP header `Accept`
  88. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  89. # HTTP header `Content-Type`
  90. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  91. ['application/json']
  92. ) # noqa: E501
  93. # Authentication setting
  94. auth_settings = ['apiv4'] # noqa: E501
  95. return self.api_client.call_api(
  96. '/withdrawals',
  97. 'POST',
  98. path_params,
  99. query_params,
  100. header_params,
  101. body=body_params,
  102. post_params=form_params,
  103. files=local_var_files,
  104. response_type='LedgerRecord', # noqa: E501
  105. auth_settings=auth_settings,
  106. async_req=local_var_params.get('async_req'),
  107. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  108. _preload_content=local_var_params.get('_preload_content', True),
  109. _request_timeout=local_var_params.get('_request_timeout'),
  110. collection_formats=collection_formats,
  111. )
  112. def cancel_withdrawal(self, withdrawal_id, **kwargs): # noqa: E501
  113. """Cancel withdrawal with specified ID # noqa: E501
  114. This method makes a synchronous HTTP request by default. To make an
  115. asynchronous HTTP request, please pass async_req=True
  116. >>> thread = api.cancel_withdrawal(withdrawal_id, async_req=True)
  117. >>> result = thread.get()
  118. :param bool async_req: execute request asynchronously
  119. :param str withdrawal_id: (required)
  120. :param _preload_content: if False, the urllib3.HTTPResponse object will
  121. be returned without reading/decoding response
  122. data. Default is True.
  123. :param _request_timeout: timeout setting for this request. If one
  124. number provided, it will be total request
  125. timeout. It can also be a pair (tuple) of
  126. (connection, read) timeouts.
  127. :rtype: gate_api.LedgerRecord
  128. :return: If the method is called asynchronously,
  129. returns the request thread.
  130. """
  131. kwargs['_return_http_data_only'] = True
  132. return self.cancel_withdrawal_with_http_info(withdrawal_id, **kwargs) # noqa: E501
  133. def cancel_withdrawal_with_http_info(self, withdrawal_id, **kwargs): # noqa: E501
  134. """Cancel withdrawal with specified ID # noqa: E501
  135. This method makes a synchronous HTTP request by default. To make an
  136. asynchronous HTTP request, please pass async_req=True
  137. >>> thread = api.cancel_withdrawal_with_http_info(withdrawal_id, async_req=True)
  138. >>> result = thread.get()
  139. :param bool async_req: execute request asynchronously
  140. :param str withdrawal_id: (required)
  141. :param _return_http_data_only: response data without head status code
  142. and headers
  143. :param _preload_content: if False, the urllib3.HTTPResponse object will
  144. be returned without reading/decoding response
  145. data. Default is True.
  146. :param _request_timeout: timeout setting for this request. If one
  147. number provided, it will be total request
  148. timeout. It can also be a pair (tuple) of
  149. (connection, read) timeouts.
  150. :rtype: tuple(gate_api.LedgerRecord, status_code(int), headers(HTTPHeaderDict))
  151. :return: If the method is called asynchronously,
  152. returns the request thread.
  153. """
  154. local_var_params = locals()
  155. all_params = ['withdrawal_id']
  156. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  157. for k, v in six.iteritems(local_var_params['kwargs']):
  158. if k not in all_params:
  159. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_withdrawal" % k)
  160. local_var_params[k] = v
  161. del local_var_params['kwargs']
  162. # verify the required parameter 'withdrawal_id' is set
  163. if self.api_client.client_side_validation and (
  164. 'withdrawal_id' not in local_var_params or local_var_params['withdrawal_id'] is None # noqa: E501
  165. ): # noqa: E501
  166. raise ApiValueError(
  167. "Missing the required parameter `withdrawal_id` when calling `cancel_withdrawal`"
  168. ) # noqa: E501
  169. collection_formats = {}
  170. path_params = {}
  171. if 'withdrawal_id' in local_var_params:
  172. path_params['withdrawal_id'] = local_var_params['withdrawal_id'] # noqa: E501
  173. query_params = []
  174. header_params = {}
  175. form_params = []
  176. local_var_files = {}
  177. body_params = None
  178. # HTTP header `Accept`
  179. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  180. # Authentication setting
  181. auth_settings = ['apiv4'] # noqa: E501
  182. return self.api_client.call_api(
  183. '/withdrawals/{withdrawal_id}',
  184. 'DELETE',
  185. path_params,
  186. query_params,
  187. header_params,
  188. body=body_params,
  189. post_params=form_params,
  190. files=local_var_files,
  191. response_type='LedgerRecord', # noqa: E501
  192. auth_settings=auth_settings,
  193. async_req=local_var_params.get('async_req'),
  194. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  195. _preload_content=local_var_params.get('_preload_content', True),
  196. _request_timeout=local_var_params.get('_request_timeout'),
  197. collection_formats=collection_formats,
  198. )