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

839 lines
40 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 MarginUniApi(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 list_uni_currency_pairs(self, **kwargs): # noqa: E501
  24. """List lending markets # 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.list_uni_currency_pairs(async_req=True)
  28. >>> result = thread.get()
  29. :param bool async_req: execute request asynchronously
  30. :param _preload_content: if False, the urllib3.HTTPResponse object will
  31. be returned without reading/decoding response
  32. data. Default is True.
  33. :param _request_timeout: timeout setting for this request. If one
  34. number provided, it will be total request
  35. timeout. It can also be a pair (tuple) of
  36. (connection, read) timeouts.
  37. :rtype: list[gate_api.UniCurrencyPair]
  38. :return: If the method is called asynchronously,
  39. returns the request thread.
  40. """
  41. kwargs['_return_http_data_only'] = True
  42. return self.list_uni_currency_pairs_with_http_info(**kwargs) # noqa: E501
  43. def list_uni_currency_pairs_with_http_info(self, **kwargs): # noqa: E501
  44. """List lending markets # noqa: E501
  45. This method makes a synchronous HTTP request by default. To make an
  46. asynchronous HTTP request, please pass async_req=True
  47. >>> thread = api.list_uni_currency_pairs_with_http_info(async_req=True)
  48. >>> result = thread.get()
  49. :param bool async_req: execute request asynchronously
  50. :param _return_http_data_only: response data without head status code
  51. and headers
  52. :param _preload_content: if False, the urllib3.HTTPResponse object will
  53. be returned without reading/decoding response
  54. data. Default is True.
  55. :param _request_timeout: timeout setting for this request. If one
  56. number provided, it will be total request
  57. timeout. It can also be a pair (tuple) of
  58. (connection, read) timeouts.
  59. :rtype: tuple(list[gate_api.UniCurrencyPair], status_code(int), headers(HTTPHeaderDict))
  60. :return: If the method is called asynchronously,
  61. returns the request thread.
  62. """
  63. local_var_params = locals()
  64. all_params = []
  65. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  66. for k, v in six.iteritems(local_var_params['kwargs']):
  67. if k not in all_params:
  68. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_uni_currency_pairs" % k)
  69. local_var_params[k] = v
  70. del local_var_params['kwargs']
  71. collection_formats = {}
  72. path_params = {}
  73. query_params = []
  74. header_params = {}
  75. form_params = []
  76. local_var_files = {}
  77. body_params = None
  78. # HTTP header `Accept`
  79. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  80. # Authentication setting
  81. auth_settings = [] # noqa: E501
  82. return self.api_client.call_api(
  83. '/margin/uni/currency_pairs',
  84. 'GET',
  85. path_params,
  86. query_params,
  87. header_params,
  88. body=body_params,
  89. post_params=form_params,
  90. files=local_var_files,
  91. response_type='list[UniCurrencyPair]', # noqa: E501
  92. auth_settings=auth_settings,
  93. async_req=local_var_params.get('async_req'),
  94. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  95. _preload_content=local_var_params.get('_preload_content', True),
  96. _request_timeout=local_var_params.get('_request_timeout'),
  97. collection_formats=collection_formats,
  98. )
  99. def get_uni_currency_pair(self, currency_pair, **kwargs): # noqa: E501
  100. """Get detail of lending market # noqa: E501
  101. This method makes a synchronous HTTP request by default. To make an
  102. asynchronous HTTP request, please pass async_req=True
  103. >>> thread = api.get_uni_currency_pair(currency_pair, async_req=True)
  104. >>> result = thread.get()
  105. :param bool async_req: execute request asynchronously
  106. :param str currency_pair: Currency pair (required)
  107. :param _preload_content: if False, the urllib3.HTTPResponse object will
  108. be returned without reading/decoding response
  109. data. Default is True.
  110. :param _request_timeout: timeout setting for this request. If one
  111. number provided, it will be total request
  112. timeout. It can also be a pair (tuple) of
  113. (connection, read) timeouts.
  114. :rtype: gate_api.UniCurrencyPair
  115. :return: If the method is called asynchronously,
  116. returns the request thread.
  117. """
  118. kwargs['_return_http_data_only'] = True
  119. return self.get_uni_currency_pair_with_http_info(currency_pair, **kwargs) # noqa: E501
  120. def get_uni_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E501
  121. """Get detail of lending market # noqa: E501
  122. This method makes a synchronous HTTP request by default. To make an
  123. asynchronous HTTP request, please pass async_req=True
  124. >>> thread = api.get_uni_currency_pair_with_http_info(currency_pair, async_req=True)
  125. >>> result = thread.get()
  126. :param bool async_req: execute request asynchronously
  127. :param str currency_pair: Currency pair (required)
  128. :param _return_http_data_only: response data without head status code
  129. and headers
  130. :param _preload_content: if False, the urllib3.HTTPResponse object will
  131. be returned without reading/decoding response
  132. data. Default is True.
  133. :param _request_timeout: timeout setting for this request. If one
  134. number provided, it will be total request
  135. timeout. It can also be a pair (tuple) of
  136. (connection, read) timeouts.
  137. :rtype: tuple(gate_api.UniCurrencyPair, status_code(int), headers(HTTPHeaderDict))
  138. :return: If the method is called asynchronously,
  139. returns the request thread.
  140. """
  141. local_var_params = locals()
  142. all_params = ['currency_pair']
  143. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  144. for k, v in six.iteritems(local_var_params['kwargs']):
  145. if k not in all_params:
  146. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_uni_currency_pair" % k)
  147. local_var_params[k] = v
  148. del local_var_params['kwargs']
  149. # verify the required parameter 'currency_pair' is set
  150. if self.api_client.client_side_validation and (
  151. 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501
  152. ): # noqa: E501
  153. raise ApiValueError(
  154. "Missing the required parameter `currency_pair` when calling `get_uni_currency_pair`"
  155. ) # noqa: E501
  156. collection_formats = {}
  157. path_params = {}
  158. if 'currency_pair' in local_var_params:
  159. path_params['currency_pair'] = local_var_params['currency_pair'] # noqa: E501
  160. query_params = []
  161. header_params = {}
  162. form_params = []
  163. local_var_files = {}
  164. body_params = None
  165. # HTTP header `Accept`
  166. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  167. # Authentication setting
  168. auth_settings = [] # noqa: E501
  169. return self.api_client.call_api(
  170. '/margin/uni/currency_pairs/{currency_pair}',
  171. 'GET',
  172. path_params,
  173. query_params,
  174. header_params,
  175. body=body_params,
  176. post_params=form_params,
  177. files=local_var_files,
  178. response_type='UniCurrencyPair', # noqa: E501
  179. auth_settings=auth_settings,
  180. async_req=local_var_params.get('async_req'),
  181. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  182. _preload_content=local_var_params.get('_preload_content', True),
  183. _request_timeout=local_var_params.get('_request_timeout'),
  184. collection_formats=collection_formats,
  185. )
  186. def list_uni_loans(self, **kwargs): # noqa: E501
  187. """List loans # noqa: E501
  188. This method makes a synchronous HTTP request by default. To make an
  189. asynchronous HTTP request, please pass async_req=True
  190. >>> thread = api.list_uni_loans(async_req=True)
  191. >>> result = thread.get()
  192. :param bool async_req: execute request asynchronously
  193. :param str currency_pair: Currency pair
  194. :param str currency: Retrieve data of the specified currency
  195. :param int page: Page number
  196. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  197. :param _preload_content: if False, the urllib3.HTTPResponse object will
  198. be returned without reading/decoding response
  199. data. Default is True.
  200. :param _request_timeout: timeout setting for this request. If one
  201. number provided, it will be total request
  202. timeout. It can also be a pair (tuple) of
  203. (connection, read) timeouts.
  204. :rtype: list[gate_api.UniLoan]
  205. :return: If the method is called asynchronously,
  206. returns the request thread.
  207. """
  208. kwargs['_return_http_data_only'] = True
  209. return self.list_uni_loans_with_http_info(**kwargs) # noqa: E501
  210. def list_uni_loans_with_http_info(self, **kwargs): # noqa: E501
  211. """List loans # noqa: E501
  212. This method makes a synchronous HTTP request by default. To make an
  213. asynchronous HTTP request, please pass async_req=True
  214. >>> thread = api.list_uni_loans_with_http_info(async_req=True)
  215. >>> result = thread.get()
  216. :param bool async_req: execute request asynchronously
  217. :param str currency_pair: Currency pair
  218. :param str currency: Retrieve data of the specified currency
  219. :param int page: Page number
  220. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  221. :param _return_http_data_only: response data without head status code
  222. and headers
  223. :param _preload_content: if False, the urllib3.HTTPResponse object will
  224. be returned without reading/decoding response
  225. data. Default is True.
  226. :param _request_timeout: timeout setting for this request. If one
  227. number provided, it will be total request
  228. timeout. It can also be a pair (tuple) of
  229. (connection, read) timeouts.
  230. :rtype: tuple(list[gate_api.UniLoan], status_code(int), headers(HTTPHeaderDict))
  231. :return: If the method is called asynchronously,
  232. returns the request thread.
  233. """
  234. local_var_params = locals()
  235. all_params = ['currency_pair', 'currency', 'page', 'limit']
  236. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  237. for k, v in six.iteritems(local_var_params['kwargs']):
  238. if k not in all_params:
  239. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_uni_loans" % k)
  240. local_var_params[k] = v
  241. del local_var_params['kwargs']
  242. if (
  243. self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1
  244. ): # noqa: E501
  245. raise ApiValueError(
  246. "Invalid value for parameter `page` when calling `list_uni_loans`, must be a value greater than or equal to `1`"
  247. ) # noqa: E501
  248. if (
  249. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 100
  250. ): # noqa: E501
  251. raise ApiValueError(
  252. "Invalid value for parameter `limit` when calling `list_uni_loans`, must be a value less than or equal to `100`"
  253. ) # noqa: E501
  254. if (
  255. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  256. ): # noqa: E501
  257. raise ApiValueError(
  258. "Invalid value for parameter `limit` when calling `list_uni_loans`, must be a value greater than or equal to `1`"
  259. ) # noqa: E501
  260. collection_formats = {}
  261. path_params = {}
  262. query_params = []
  263. if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501
  264. query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501
  265. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  266. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  267. if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
  268. query_params.append(('page', local_var_params['page'])) # noqa: E501
  269. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  270. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  271. header_params = {}
  272. form_params = []
  273. local_var_files = {}
  274. body_params = None
  275. # HTTP header `Accept`
  276. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  277. # Authentication setting
  278. auth_settings = ['apiv4'] # noqa: E501
  279. return self.api_client.call_api(
  280. '/margin/uni/loans',
  281. 'GET',
  282. path_params,
  283. query_params,
  284. header_params,
  285. body=body_params,
  286. post_params=form_params,
  287. files=local_var_files,
  288. response_type='list[UniLoan]', # noqa: E501
  289. auth_settings=auth_settings,
  290. async_req=local_var_params.get('async_req'),
  291. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  292. _preload_content=local_var_params.get('_preload_content', True),
  293. _request_timeout=local_var_params.get('_request_timeout'),
  294. collection_formats=collection_formats,
  295. )
  296. def create_uni_loan(self, create_uni_loan, **kwargs): # noqa: E501
  297. """Borrow or repay # noqa: E501
  298. This method makes a synchronous HTTP request by default. To make an
  299. asynchronous HTTP request, please pass async_req=True
  300. >>> thread = api.create_uni_loan(create_uni_loan, async_req=True)
  301. >>> result = thread.get()
  302. :param bool async_req: execute request asynchronously
  303. :param CreateUniLoan create_uni_loan: (required)
  304. :param _preload_content: if False, the urllib3.HTTPResponse object will
  305. be returned without reading/decoding response
  306. data. Default is True.
  307. :param _request_timeout: timeout setting for this request. If one
  308. number provided, it will be total request
  309. timeout. It can also be a pair (tuple) of
  310. (connection, read) timeouts.
  311. :rtype: None
  312. :return: If the method is called asynchronously,
  313. returns the request thread.
  314. """
  315. kwargs['_return_http_data_only'] = True
  316. return self.create_uni_loan_with_http_info(create_uni_loan, **kwargs) # noqa: E501
  317. def create_uni_loan_with_http_info(self, create_uni_loan, **kwargs): # noqa: E501
  318. """Borrow or repay # noqa: E501
  319. This method makes a synchronous HTTP request by default. To make an
  320. asynchronous HTTP request, please pass async_req=True
  321. >>> thread = api.create_uni_loan_with_http_info(create_uni_loan, async_req=True)
  322. >>> result = thread.get()
  323. :param bool async_req: execute request asynchronously
  324. :param CreateUniLoan create_uni_loan: (required)
  325. :param _return_http_data_only: response data without head status code
  326. and headers
  327. :param _preload_content: if False, the urllib3.HTTPResponse object will
  328. be returned without reading/decoding response
  329. data. Default is True.
  330. :param _request_timeout: timeout setting for this request. If one
  331. number provided, it will be total request
  332. timeout. It can also be a pair (tuple) of
  333. (connection, read) timeouts.
  334. :rtype: None
  335. :return: If the method is called asynchronously,
  336. returns the request thread.
  337. """
  338. local_var_params = locals()
  339. all_params = ['create_uni_loan']
  340. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  341. for k, v in six.iteritems(local_var_params['kwargs']):
  342. if k not in all_params:
  343. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_uni_loan" % k)
  344. local_var_params[k] = v
  345. del local_var_params['kwargs']
  346. # verify the required parameter 'create_uni_loan' is set
  347. if self.api_client.client_side_validation and (
  348. 'create_uni_loan' not in local_var_params or local_var_params['create_uni_loan'] is None # noqa: E501
  349. ): # noqa: E501
  350. raise ApiValueError(
  351. "Missing the required parameter `create_uni_loan` when calling `create_uni_loan`"
  352. ) # noqa: E501
  353. collection_formats = {}
  354. path_params = {}
  355. query_params = []
  356. header_params = {}
  357. form_params = []
  358. local_var_files = {}
  359. body_params = None
  360. if 'create_uni_loan' in local_var_params:
  361. body_params = local_var_params['create_uni_loan']
  362. # HTTP header `Content-Type`
  363. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  364. ['application/json']
  365. ) # noqa: E501
  366. # Authentication setting
  367. auth_settings = ['apiv4'] # noqa: E501
  368. return self.api_client.call_api(
  369. '/margin/uni/loans',
  370. 'POST',
  371. path_params,
  372. query_params,
  373. header_params,
  374. body=body_params,
  375. post_params=form_params,
  376. files=local_var_files,
  377. response_type=None, # noqa: E501
  378. auth_settings=auth_settings,
  379. async_req=local_var_params.get('async_req'),
  380. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  381. _preload_content=local_var_params.get('_preload_content', True),
  382. _request_timeout=local_var_params.get('_request_timeout'),
  383. collection_formats=collection_formats,
  384. )
  385. def list_uni_loan_records(self, **kwargs): # noqa: E501
  386. """Get load records # noqa: E501
  387. This method makes a synchronous HTTP request by default. To make an
  388. asynchronous HTTP request, please pass async_req=True
  389. >>> thread = api.list_uni_loan_records(async_req=True)
  390. >>> result = thread.get()
  391. :param bool async_req: execute request asynchronously
  392. :param str type: type: borrow - borrow, repay - repay
  393. :param str currency: Retrieve data of the specified currency
  394. :param str currency_pair: Currency pair
  395. :param int page: Page number
  396. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  397. :param _preload_content: if False, the urllib3.HTTPResponse object will
  398. be returned without reading/decoding response
  399. data. Default is True.
  400. :param _request_timeout: timeout setting for this request. If one
  401. number provided, it will be total request
  402. timeout. It can also be a pair (tuple) of
  403. (connection, read) timeouts.
  404. :rtype: list[gate_api.UniLoanRecord]
  405. :return: If the method is called asynchronously,
  406. returns the request thread.
  407. """
  408. kwargs['_return_http_data_only'] = True
  409. return self.list_uni_loan_records_with_http_info(**kwargs) # noqa: E501
  410. def list_uni_loan_records_with_http_info(self, **kwargs): # noqa: E501
  411. """Get load records # noqa: E501
  412. This method makes a synchronous HTTP request by default. To make an
  413. asynchronous HTTP request, please pass async_req=True
  414. >>> thread = api.list_uni_loan_records_with_http_info(async_req=True)
  415. >>> result = thread.get()
  416. :param bool async_req: execute request asynchronously
  417. :param str type: type: borrow - borrow, repay - repay
  418. :param str currency: Retrieve data of the specified currency
  419. :param str currency_pair: Currency pair
  420. :param int page: Page number
  421. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  422. :param _return_http_data_only: response data without head status code
  423. and headers
  424. :param _preload_content: if False, the urllib3.HTTPResponse object will
  425. be returned without reading/decoding response
  426. data. Default is True.
  427. :param _request_timeout: timeout setting for this request. If one
  428. number provided, it will be total request
  429. timeout. It can also be a pair (tuple) of
  430. (connection, read) timeouts.
  431. :rtype: tuple(list[gate_api.UniLoanRecord], status_code(int), headers(HTTPHeaderDict))
  432. :return: If the method is called asynchronously,
  433. returns the request thread.
  434. """
  435. local_var_params = locals()
  436. all_params = ['type', 'currency', 'currency_pair', 'page', 'limit']
  437. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  438. for k, v in six.iteritems(local_var_params['kwargs']):
  439. if k not in all_params:
  440. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_uni_loan_records" % k)
  441. local_var_params[k] = v
  442. del local_var_params['kwargs']
  443. if (
  444. self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1
  445. ): # noqa: E501
  446. raise ApiValueError(
  447. "Invalid value for parameter `page` when calling `list_uni_loan_records`, must be a value greater than or equal to `1`"
  448. ) # noqa: E501
  449. if (
  450. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 100
  451. ): # noqa: E501
  452. raise ApiValueError(
  453. "Invalid value for parameter `limit` when calling `list_uni_loan_records`, must be a value less than or equal to `100`"
  454. ) # noqa: E501
  455. if (
  456. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  457. ): # noqa: E501
  458. raise ApiValueError(
  459. "Invalid value for parameter `limit` when calling `list_uni_loan_records`, must be a value greater than or equal to `1`"
  460. ) # noqa: E501
  461. collection_formats = {}
  462. path_params = {}
  463. query_params = []
  464. if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501
  465. query_params.append(('type', local_var_params['type'])) # noqa: E501
  466. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  467. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  468. if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501
  469. query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501
  470. if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
  471. query_params.append(('page', local_var_params['page'])) # noqa: E501
  472. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  473. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  474. header_params = {}
  475. form_params = []
  476. local_var_files = {}
  477. body_params = None
  478. # HTTP header `Accept`
  479. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  480. # Authentication setting
  481. auth_settings = ['apiv4'] # noqa: E501
  482. return self.api_client.call_api(
  483. '/margin/uni/loan_records',
  484. 'GET',
  485. path_params,
  486. query_params,
  487. header_params,
  488. body=body_params,
  489. post_params=form_params,
  490. files=local_var_files,
  491. response_type='list[UniLoanRecord]', # noqa: E501
  492. auth_settings=auth_settings,
  493. async_req=local_var_params.get('async_req'),
  494. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  495. _preload_content=local_var_params.get('_preload_content', True),
  496. _request_timeout=local_var_params.get('_request_timeout'),
  497. collection_formats=collection_formats,
  498. )
  499. def list_uni_loan_interest_records(self, **kwargs): # noqa: E501
  500. """List interest records # noqa: E501
  501. This method makes a synchronous HTTP request by default. To make an
  502. asynchronous HTTP request, please pass async_req=True
  503. >>> thread = api.list_uni_loan_interest_records(async_req=True)
  504. >>> result = thread.get()
  505. :param bool async_req: execute request asynchronously
  506. :param str currency_pair: Currency pair
  507. :param str currency: Retrieve data of the specified currency
  508. :param int page: Page number
  509. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  510. :param _preload_content: if False, the urllib3.HTTPResponse object will
  511. be returned without reading/decoding response
  512. data. Default is True.
  513. :param _request_timeout: timeout setting for this request. If one
  514. number provided, it will be total request
  515. timeout. It can also be a pair (tuple) of
  516. (connection, read) timeouts.
  517. :rtype: list[gate_api.UniLoanInterestRecord]
  518. :return: If the method is called asynchronously,
  519. returns the request thread.
  520. """
  521. kwargs['_return_http_data_only'] = True
  522. return self.list_uni_loan_interest_records_with_http_info(**kwargs) # noqa: E501
  523. def list_uni_loan_interest_records_with_http_info(self, **kwargs): # noqa: E501
  524. """List interest records # noqa: E501
  525. This method makes a synchronous HTTP request by default. To make an
  526. asynchronous HTTP request, please pass async_req=True
  527. >>> thread = api.list_uni_loan_interest_records_with_http_info(async_req=True)
  528. >>> result = thread.get()
  529. :param bool async_req: execute request asynchronously
  530. :param str currency_pair: Currency pair
  531. :param str currency: Retrieve data of the specified currency
  532. :param int page: Page number
  533. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  534. :param _return_http_data_only: response data without head status code
  535. and headers
  536. :param _preload_content: if False, the urllib3.HTTPResponse object will
  537. be returned without reading/decoding response
  538. data. Default is True.
  539. :param _request_timeout: timeout setting for this request. If one
  540. number provided, it will be total request
  541. timeout. It can also be a pair (tuple) of
  542. (connection, read) timeouts.
  543. :rtype: tuple(list[gate_api.UniLoanInterestRecord], status_code(int), headers(HTTPHeaderDict))
  544. :return: If the method is called asynchronously,
  545. returns the request thread.
  546. """
  547. local_var_params = locals()
  548. all_params = ['currency_pair', 'currency', 'page', 'limit']
  549. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  550. for k, v in six.iteritems(local_var_params['kwargs']):
  551. if k not in all_params:
  552. raise ApiTypeError(
  553. "Got an unexpected keyword argument '%s'" " to method list_uni_loan_interest_records" % k
  554. )
  555. local_var_params[k] = v
  556. del local_var_params['kwargs']
  557. if (
  558. self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1
  559. ): # noqa: E501
  560. raise ApiValueError(
  561. "Invalid value for parameter `page` when calling `list_uni_loan_interest_records`, must be a value greater than or equal to `1`"
  562. ) # noqa: E501
  563. if (
  564. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 100
  565. ): # noqa: E501
  566. raise ApiValueError(
  567. "Invalid value for parameter `limit` when calling `list_uni_loan_interest_records`, must be a value less than or equal to `100`"
  568. ) # noqa: E501
  569. if (
  570. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  571. ): # noqa: E501
  572. raise ApiValueError(
  573. "Invalid value for parameter `limit` when calling `list_uni_loan_interest_records`, must be a value greater than or equal to `1`"
  574. ) # noqa: E501
  575. collection_formats = {}
  576. path_params = {}
  577. query_params = []
  578. if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501
  579. query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501
  580. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  581. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  582. if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
  583. query_params.append(('page', local_var_params['page'])) # noqa: E501
  584. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  585. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  586. header_params = {}
  587. form_params = []
  588. local_var_files = {}
  589. body_params = None
  590. # HTTP header `Accept`
  591. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  592. # Authentication setting
  593. auth_settings = ['apiv4'] # noqa: E501
  594. return self.api_client.call_api(
  595. '/margin/uni/interest_records',
  596. 'GET',
  597. path_params,
  598. query_params,
  599. header_params,
  600. body=body_params,
  601. post_params=form_params,
  602. files=local_var_files,
  603. response_type='list[UniLoanInterestRecord]', # noqa: E501
  604. auth_settings=auth_settings,
  605. async_req=local_var_params.get('async_req'),
  606. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  607. _preload_content=local_var_params.get('_preload_content', True),
  608. _request_timeout=local_var_params.get('_request_timeout'),
  609. collection_formats=collection_formats,
  610. )
  611. def get_uni_borrowable(self, currency, currency_pair, **kwargs): # noqa: E501
  612. """Get maximum borrowable # noqa: E501
  613. This method makes a synchronous HTTP request by default. To make an
  614. asynchronous HTTP request, please pass async_req=True
  615. >>> thread = api.get_uni_borrowable(currency, currency_pair, async_req=True)
  616. >>> result = thread.get()
  617. :param bool async_req: execute request asynchronously
  618. :param str currency: Retrieve data of the specified currency (required)
  619. :param str currency_pair: Currency pair (required)
  620. :param _preload_content: if False, the urllib3.HTTPResponse object will
  621. be returned without reading/decoding response
  622. data. Default is True.
  623. :param _request_timeout: timeout setting for this request. If one
  624. number provided, it will be total request
  625. timeout. It can also be a pair (tuple) of
  626. (connection, read) timeouts.
  627. :rtype: gate_api.MaxUniBorrowable
  628. :return: If the method is called asynchronously,
  629. returns the request thread.
  630. """
  631. kwargs['_return_http_data_only'] = True
  632. return self.get_uni_borrowable_with_http_info(currency, currency_pair, **kwargs) # noqa: E501
  633. def get_uni_borrowable_with_http_info(self, currency, currency_pair, **kwargs): # noqa: E501
  634. """Get maximum borrowable # noqa: E501
  635. This method makes a synchronous HTTP request by default. To make an
  636. asynchronous HTTP request, please pass async_req=True
  637. >>> thread = api.get_uni_borrowable_with_http_info(currency, currency_pair, async_req=True)
  638. >>> result = thread.get()
  639. :param bool async_req: execute request asynchronously
  640. :param str currency: Retrieve data of the specified currency (required)
  641. :param str currency_pair: Currency pair (required)
  642. :param _return_http_data_only: response data without head status code
  643. and headers
  644. :param _preload_content: if False, the urllib3.HTTPResponse object will
  645. be returned without reading/decoding response
  646. data. Default is True.
  647. :param _request_timeout: timeout setting for this request. If one
  648. number provided, it will be total request
  649. timeout. It can also be a pair (tuple) of
  650. (connection, read) timeouts.
  651. :rtype: tuple(gate_api.MaxUniBorrowable, status_code(int), headers(HTTPHeaderDict))
  652. :return: If the method is called asynchronously,
  653. returns the request thread.
  654. """
  655. local_var_params = locals()
  656. all_params = ['currency', 'currency_pair']
  657. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  658. for k, v in six.iteritems(local_var_params['kwargs']):
  659. if k not in all_params:
  660. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_uni_borrowable" % k)
  661. local_var_params[k] = v
  662. del local_var_params['kwargs']
  663. # verify the required parameter 'currency' is set
  664. if self.api_client.client_side_validation and (
  665. 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501
  666. ): # noqa: E501
  667. raise ApiValueError(
  668. "Missing the required parameter `currency` when calling `get_uni_borrowable`"
  669. ) # noqa: E501
  670. # verify the required parameter 'currency_pair' is set
  671. if self.api_client.client_side_validation and (
  672. 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501
  673. ): # noqa: E501
  674. raise ApiValueError(
  675. "Missing the required parameter `currency_pair` when calling `get_uni_borrowable`"
  676. ) # noqa: E501
  677. collection_formats = {}
  678. path_params = {}
  679. query_params = []
  680. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  681. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  682. if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501
  683. query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501
  684. header_params = {}
  685. form_params = []
  686. local_var_files = {}
  687. body_params = None
  688. # HTTP header `Accept`
  689. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  690. # Authentication setting
  691. auth_settings = ['apiv4'] # noqa: E501
  692. return self.api_client.call_api(
  693. '/margin/uni/borrowable',
  694. 'GET',
  695. path_params,
  696. query_params,
  697. header_params,
  698. body=body_params,
  699. post_params=form_params,
  700. files=local_var_files,
  701. response_type='MaxUniBorrowable', # noqa: E501
  702. auth_settings=auth_settings,
  703. async_req=local_var_params.get('async_req'),
  704. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  705. _preload_content=local_var_params.get('_preload_content', True),
  706. _request_timeout=local_var_params.get('_request_timeout'),
  707. collection_formats=collection_formats,
  708. )