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

924 lines
44 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 EarnUniApi(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_currencies(self, **kwargs): # noqa: E501
  24. """List currencies for lending # 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_currencies(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.UniCurrency]
  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_currencies_with_http_info(**kwargs) # noqa: E501
  43. def list_uni_currencies_with_http_info(self, **kwargs): # noqa: E501
  44. """List currencies for lending # 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_currencies_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.UniCurrency], 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_currencies" % 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. '/earn/uni/currencies',
  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[UniCurrency]', # 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(self, currency, **kwargs): # noqa: E501
  100. """Get currency detail for lending # 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(currency, async_req=True)
  104. >>> result = thread.get()
  105. :param bool async_req: execute request asynchronously
  106. :param str currency: Currency (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.UniCurrency
  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_with_http_info(currency, **kwargs) # noqa: E501
  120. def get_uni_currency_with_http_info(self, currency, **kwargs): # noqa: E501
  121. """Get currency detail for lending # 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_with_http_info(currency, async_req=True)
  125. >>> result = thread.get()
  126. :param bool async_req: execute request asynchronously
  127. :param str currency: Currency (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.UniCurrency, 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']
  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" % k)
  147. local_var_params[k] = v
  148. del local_var_params['kwargs']
  149. # verify the required parameter 'currency' is set
  150. if self.api_client.client_side_validation and (
  151. 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501
  152. ): # noqa: E501
  153. raise ApiValueError(
  154. "Missing the required parameter `currency` when calling `get_uni_currency`"
  155. ) # noqa: E501
  156. collection_formats = {}
  157. path_params = {}
  158. if 'currency' in local_var_params:
  159. path_params['currency'] = local_var_params['currency'] # 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. '/earn/uni/currencies/{currency}',
  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='UniCurrency', # 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_user_uni_lends(self, **kwargs): # noqa: E501
  187. """List user's lending orders # 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_user_uni_lends(async_req=True)
  191. >>> result = thread.get()
  192. :param bool async_req: execute request asynchronously
  193. :param str currency: Retrieve data of the specified currency
  194. :param int page: Page number
  195. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  196. :param _preload_content: if False, the urllib3.HTTPResponse object will
  197. be returned without reading/decoding response
  198. data. Default is True.
  199. :param _request_timeout: timeout setting for this request. If one
  200. number provided, it will be total request
  201. timeout. It can also be a pair (tuple) of
  202. (connection, read) timeouts.
  203. :rtype: list[gate_api.UniLend]
  204. :return: If the method is called asynchronously,
  205. returns the request thread.
  206. """
  207. kwargs['_return_http_data_only'] = True
  208. return self.list_user_uni_lends_with_http_info(**kwargs) # noqa: E501
  209. def list_user_uni_lends_with_http_info(self, **kwargs): # noqa: E501
  210. """List user's lending orders # noqa: E501
  211. This method makes a synchronous HTTP request by default. To make an
  212. asynchronous HTTP request, please pass async_req=True
  213. >>> thread = api.list_user_uni_lends_with_http_info(async_req=True)
  214. >>> result = thread.get()
  215. :param bool async_req: execute request asynchronously
  216. :param str currency: Retrieve data of the specified currency
  217. :param int page: Page number
  218. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  219. :param _return_http_data_only: response data without head status code
  220. and headers
  221. :param _preload_content: if False, the urllib3.HTTPResponse object will
  222. be returned without reading/decoding response
  223. data. Default is True.
  224. :param _request_timeout: timeout setting for this request. If one
  225. number provided, it will be total request
  226. timeout. It can also be a pair (tuple) of
  227. (connection, read) timeouts.
  228. :rtype: tuple(list[gate_api.UniLend], status_code(int), headers(HTTPHeaderDict))
  229. :return: If the method is called asynchronously,
  230. returns the request thread.
  231. """
  232. local_var_params = locals()
  233. all_params = ['currency', 'page', 'limit']
  234. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  235. for k, v in six.iteritems(local_var_params['kwargs']):
  236. if k not in all_params:
  237. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_user_uni_lends" % k)
  238. local_var_params[k] = v
  239. del local_var_params['kwargs']
  240. if (
  241. self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1
  242. ): # noqa: E501
  243. raise ApiValueError(
  244. "Invalid value for parameter `page` when calling `list_user_uni_lends`, must be a value greater than or equal to `1`"
  245. ) # noqa: E501
  246. if (
  247. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 100
  248. ): # noqa: E501
  249. raise ApiValueError(
  250. "Invalid value for parameter `limit` when calling `list_user_uni_lends`, must be a value less than or equal to `100`"
  251. ) # noqa: E501
  252. if (
  253. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  254. ): # noqa: E501
  255. raise ApiValueError(
  256. "Invalid value for parameter `limit` when calling `list_user_uni_lends`, must be a value greater than or equal to `1`"
  257. ) # noqa: E501
  258. collection_formats = {}
  259. path_params = {}
  260. query_params = []
  261. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  262. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  263. if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
  264. query_params.append(('page', local_var_params['page'])) # noqa: E501
  265. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  266. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  267. header_params = {}
  268. form_params = []
  269. local_var_files = {}
  270. body_params = None
  271. # HTTP header `Accept`
  272. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  273. # Authentication setting
  274. auth_settings = ['apiv4'] # noqa: E501
  275. return self.api_client.call_api(
  276. '/earn/uni/lends',
  277. 'GET',
  278. path_params,
  279. query_params,
  280. header_params,
  281. body=body_params,
  282. post_params=form_params,
  283. files=local_var_files,
  284. response_type='list[UniLend]', # noqa: E501
  285. auth_settings=auth_settings,
  286. async_req=local_var_params.get('async_req'),
  287. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  288. _preload_content=local_var_params.get('_preload_content', True),
  289. _request_timeout=local_var_params.get('_request_timeout'),
  290. collection_formats=collection_formats,
  291. )
  292. def create_uni_lend(self, create_uni_lend, **kwargs): # noqa: E501
  293. """Lend or redeem # noqa: E501
  294. `Lending`: The minimum interest rate is required in lending. The lending result is updated hourly and the interest profit is paid on the next hour. A high interest rate might lead to unsuccessful lending and no profit will be gained for that hour. If the funds are redeemed before the hourly settlement, no interest can be obtained for that hour. About priority: the orders created or amended first under the same interest rate will be lent out first `Redemption`: Funds that failed to be lent can be redeemed immediately. For the successfully lent funds, enjoy the hourly income, and the redemption will arrive at the next hour `Note`: Two minutes before and after the hour is the settlement time, lending and redemption are prohibited. # noqa: E501
  295. This method makes a synchronous HTTP request by default. To make an
  296. asynchronous HTTP request, please pass async_req=True
  297. >>> thread = api.create_uni_lend(create_uni_lend, async_req=True)
  298. >>> result = thread.get()
  299. :param bool async_req: execute request asynchronously
  300. :param CreateUniLend create_uni_lend: (required)
  301. :param _preload_content: if False, the urllib3.HTTPResponse object will
  302. be returned without reading/decoding response
  303. data. Default is True.
  304. :param _request_timeout: timeout setting for this request. If one
  305. number provided, it will be total request
  306. timeout. It can also be a pair (tuple) of
  307. (connection, read) timeouts.
  308. :rtype: None
  309. :return: If the method is called asynchronously,
  310. returns the request thread.
  311. """
  312. kwargs['_return_http_data_only'] = True
  313. return self.create_uni_lend_with_http_info(create_uni_lend, **kwargs) # noqa: E501
  314. def create_uni_lend_with_http_info(self, create_uni_lend, **kwargs): # noqa: E501
  315. """Lend or redeem # noqa: E501
  316. `Lending`: The minimum interest rate is required in lending. The lending result is updated hourly and the interest profit is paid on the next hour. A high interest rate might lead to unsuccessful lending and no profit will be gained for that hour. If the funds are redeemed before the hourly settlement, no interest can be obtained for that hour. About priority: the orders created or amended first under the same interest rate will be lent out first `Redemption`: Funds that failed to be lent can be redeemed immediately. For the successfully lent funds, enjoy the hourly income, and the redemption will arrive at the next hour `Note`: Two minutes before and after the hour is the settlement time, lending and redemption are prohibited. # noqa: E501
  317. This method makes a synchronous HTTP request by default. To make an
  318. asynchronous HTTP request, please pass async_req=True
  319. >>> thread = api.create_uni_lend_with_http_info(create_uni_lend, async_req=True)
  320. >>> result = thread.get()
  321. :param bool async_req: execute request asynchronously
  322. :param CreateUniLend create_uni_lend: (required)
  323. :param _return_http_data_only: response data without head status code
  324. and headers
  325. :param _preload_content: if False, the urllib3.HTTPResponse object will
  326. be returned without reading/decoding response
  327. data. Default is True.
  328. :param _request_timeout: timeout setting for this request. If one
  329. number provided, it will be total request
  330. timeout. It can also be a pair (tuple) of
  331. (connection, read) timeouts.
  332. :rtype: None
  333. :return: If the method is called asynchronously,
  334. returns the request thread.
  335. """
  336. local_var_params = locals()
  337. all_params = ['create_uni_lend']
  338. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  339. for k, v in six.iteritems(local_var_params['kwargs']):
  340. if k not in all_params:
  341. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_uni_lend" % k)
  342. local_var_params[k] = v
  343. del local_var_params['kwargs']
  344. # verify the required parameter 'create_uni_lend' is set
  345. if self.api_client.client_side_validation and (
  346. 'create_uni_lend' not in local_var_params or local_var_params['create_uni_lend'] is None # noqa: E501
  347. ): # noqa: E501
  348. raise ApiValueError(
  349. "Missing the required parameter `create_uni_lend` when calling `create_uni_lend`"
  350. ) # noqa: E501
  351. collection_formats = {}
  352. path_params = {}
  353. query_params = []
  354. header_params = {}
  355. form_params = []
  356. local_var_files = {}
  357. body_params = None
  358. if 'create_uni_lend' in local_var_params:
  359. body_params = local_var_params['create_uni_lend']
  360. # HTTP header `Content-Type`
  361. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  362. ['application/json']
  363. ) # noqa: E501
  364. # Authentication setting
  365. auth_settings = ['apiv4'] # noqa: E501
  366. return self.api_client.call_api(
  367. '/earn/uni/lends',
  368. 'POST',
  369. path_params,
  370. query_params,
  371. header_params,
  372. body=body_params,
  373. post_params=form_params,
  374. files=local_var_files,
  375. response_type=None, # noqa: E501
  376. auth_settings=auth_settings,
  377. async_req=local_var_params.get('async_req'),
  378. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  379. _preload_content=local_var_params.get('_preload_content', True),
  380. _request_timeout=local_var_params.get('_request_timeout'),
  381. collection_formats=collection_formats,
  382. )
  383. def change_uni_lend(self, patch_uni_lend, **kwargs): # noqa: E501
  384. """Amend lending order # noqa: E501
  385. Currently only supports amending the minimum interest rate (hour) # noqa: E501
  386. This method makes a synchronous HTTP request by default. To make an
  387. asynchronous HTTP request, please pass async_req=True
  388. >>> thread = api.change_uni_lend(patch_uni_lend, async_req=True)
  389. >>> result = thread.get()
  390. :param bool async_req: execute request asynchronously
  391. :param PatchUniLend patch_uni_lend: (required)
  392. :param _preload_content: if False, the urllib3.HTTPResponse object will
  393. be returned without reading/decoding response
  394. data. Default is True.
  395. :param _request_timeout: timeout setting for this request. If one
  396. number provided, it will be total request
  397. timeout. It can also be a pair (tuple) of
  398. (connection, read) timeouts.
  399. :rtype: None
  400. :return: If the method is called asynchronously,
  401. returns the request thread.
  402. """
  403. kwargs['_return_http_data_only'] = True
  404. return self.change_uni_lend_with_http_info(patch_uni_lend, **kwargs) # noqa: E501
  405. def change_uni_lend_with_http_info(self, patch_uni_lend, **kwargs): # noqa: E501
  406. """Amend lending order # noqa: E501
  407. Currently only supports amending the minimum interest rate (hour) # noqa: E501
  408. This method makes a synchronous HTTP request by default. To make an
  409. asynchronous HTTP request, please pass async_req=True
  410. >>> thread = api.change_uni_lend_with_http_info(patch_uni_lend, async_req=True)
  411. >>> result = thread.get()
  412. :param bool async_req: execute request asynchronously
  413. :param PatchUniLend patch_uni_lend: (required)
  414. :param _return_http_data_only: response data without head status code
  415. and headers
  416. :param _preload_content: if False, the urllib3.HTTPResponse object will
  417. be returned without reading/decoding response
  418. data. Default is True.
  419. :param _request_timeout: timeout setting for this request. If one
  420. number provided, it will be total request
  421. timeout. It can also be a pair (tuple) of
  422. (connection, read) timeouts.
  423. :rtype: None
  424. :return: If the method is called asynchronously,
  425. returns the request thread.
  426. """
  427. local_var_params = locals()
  428. all_params = ['patch_uni_lend']
  429. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  430. for k, v in six.iteritems(local_var_params['kwargs']):
  431. if k not in all_params:
  432. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method change_uni_lend" % k)
  433. local_var_params[k] = v
  434. del local_var_params['kwargs']
  435. # verify the required parameter 'patch_uni_lend' is set
  436. if self.api_client.client_side_validation and (
  437. 'patch_uni_lend' not in local_var_params or local_var_params['patch_uni_lend'] is None # noqa: E501
  438. ): # noqa: E501
  439. raise ApiValueError(
  440. "Missing the required parameter `patch_uni_lend` when calling `change_uni_lend`"
  441. ) # noqa: E501
  442. collection_formats = {}
  443. path_params = {}
  444. query_params = []
  445. header_params = {}
  446. form_params = []
  447. local_var_files = {}
  448. body_params = None
  449. if 'patch_uni_lend' in local_var_params:
  450. body_params = local_var_params['patch_uni_lend']
  451. # HTTP header `Content-Type`
  452. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  453. ['application/json']
  454. ) # noqa: E501
  455. # Authentication setting
  456. auth_settings = ['apiv4'] # noqa: E501
  457. return self.api_client.call_api(
  458. '/earn/uni/lends',
  459. 'PATCH',
  460. path_params,
  461. query_params,
  462. header_params,
  463. body=body_params,
  464. post_params=form_params,
  465. files=local_var_files,
  466. response_type=None, # noqa: E501
  467. auth_settings=auth_settings,
  468. async_req=local_var_params.get('async_req'),
  469. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  470. _preload_content=local_var_params.get('_preload_content', True),
  471. _request_timeout=local_var_params.get('_request_timeout'),
  472. collection_formats=collection_formats,
  473. )
  474. def list_uni_lend_records(self, **kwargs): # noqa: E501
  475. """List records of lending # noqa: E501
  476. This method makes a synchronous HTTP request by default. To make an
  477. asynchronous HTTP request, please pass async_req=True
  478. >>> thread = api.list_uni_lend_records(async_req=True)
  479. >>> result = thread.get()
  480. :param bool async_req: execute request asynchronously
  481. :param str currency: Retrieve data of the specified currency
  482. :param int page: Page number
  483. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  484. :param str type: type: lend - lend, redeem - redeem
  485. :param _preload_content: if False, the urllib3.HTTPResponse object will
  486. be returned without reading/decoding response
  487. data. Default is True.
  488. :param _request_timeout: timeout setting for this request. If one
  489. number provided, it will be total request
  490. timeout. It can also be a pair (tuple) of
  491. (connection, read) timeouts.
  492. :rtype: list[gate_api.UniLendRecord]
  493. :return: If the method is called asynchronously,
  494. returns the request thread.
  495. """
  496. kwargs['_return_http_data_only'] = True
  497. return self.list_uni_lend_records_with_http_info(**kwargs) # noqa: E501
  498. def list_uni_lend_records_with_http_info(self, **kwargs): # noqa: E501
  499. """List records of lending # noqa: E501
  500. This method makes a synchronous HTTP request by default. To make an
  501. asynchronous HTTP request, please pass async_req=True
  502. >>> thread = api.list_uni_lend_records_with_http_info(async_req=True)
  503. >>> result = thread.get()
  504. :param bool async_req: execute request asynchronously
  505. :param str currency: Retrieve data of the specified currency
  506. :param int page: Page number
  507. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  508. :param str type: type: lend - lend, redeem - redeem
  509. :param _return_http_data_only: response data without head status code
  510. and headers
  511. :param _preload_content: if False, the urllib3.HTTPResponse object will
  512. be returned without reading/decoding response
  513. data. Default is True.
  514. :param _request_timeout: timeout setting for this request. If one
  515. number provided, it will be total request
  516. timeout. It can also be a pair (tuple) of
  517. (connection, read) timeouts.
  518. :rtype: tuple(list[gate_api.UniLendRecord], status_code(int), headers(HTTPHeaderDict))
  519. :return: If the method is called asynchronously,
  520. returns the request thread.
  521. """
  522. local_var_params = locals()
  523. all_params = ['currency', 'page', 'limit', 'type']
  524. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  525. for k, v in six.iteritems(local_var_params['kwargs']):
  526. if k not in all_params:
  527. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_uni_lend_records" % k)
  528. local_var_params[k] = v
  529. del local_var_params['kwargs']
  530. if (
  531. self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1
  532. ): # noqa: E501
  533. raise ApiValueError(
  534. "Invalid value for parameter `page` when calling `list_uni_lend_records`, must be a value greater than or equal to `1`"
  535. ) # noqa: E501
  536. if (
  537. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 100
  538. ): # noqa: E501
  539. raise ApiValueError(
  540. "Invalid value for parameter `limit` when calling `list_uni_lend_records`, must be a value less than or equal to `100`"
  541. ) # noqa: E501
  542. if (
  543. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  544. ): # noqa: E501
  545. raise ApiValueError(
  546. "Invalid value for parameter `limit` when calling `list_uni_lend_records`, must be a value greater than or equal to `1`"
  547. ) # noqa: E501
  548. collection_formats = {}
  549. path_params = {}
  550. query_params = []
  551. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  552. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  553. if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
  554. query_params.append(('page', local_var_params['page'])) # noqa: E501
  555. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  556. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  557. if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501
  558. query_params.append(('type', local_var_params['type'])) # noqa: E501
  559. header_params = {}
  560. form_params = []
  561. local_var_files = {}
  562. body_params = None
  563. # HTTP header `Accept`
  564. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  565. # Authentication setting
  566. auth_settings = ['apiv4'] # noqa: E501
  567. return self.api_client.call_api(
  568. '/earn/uni/lend_records',
  569. 'GET',
  570. path_params,
  571. query_params,
  572. header_params,
  573. body=body_params,
  574. post_params=form_params,
  575. files=local_var_files,
  576. response_type='list[UniLendRecord]', # noqa: E501
  577. auth_settings=auth_settings,
  578. async_req=local_var_params.get('async_req'),
  579. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  580. _preload_content=local_var_params.get('_preload_content', True),
  581. _request_timeout=local_var_params.get('_request_timeout'),
  582. collection_formats=collection_formats,
  583. )
  584. def get_uni_interest(self, currency, **kwargs): # noqa: E501
  585. """Get the user's total interest income of specified currency # noqa: E501
  586. This method makes a synchronous HTTP request by default. To make an
  587. asynchronous HTTP request, please pass async_req=True
  588. >>> thread = api.get_uni_interest(currency, async_req=True)
  589. >>> result = thread.get()
  590. :param bool async_req: execute request asynchronously
  591. :param str currency: Currency (required)
  592. :param _preload_content: if False, the urllib3.HTTPResponse object will
  593. be returned without reading/decoding response
  594. data. Default is True.
  595. :param _request_timeout: timeout setting for this request. If one
  596. number provided, it will be total request
  597. timeout. It can also be a pair (tuple) of
  598. (connection, read) timeouts.
  599. :rtype: gate_api.UniLendInterest
  600. :return: If the method is called asynchronously,
  601. returns the request thread.
  602. """
  603. kwargs['_return_http_data_only'] = True
  604. return self.get_uni_interest_with_http_info(currency, **kwargs) # noqa: E501
  605. def get_uni_interest_with_http_info(self, currency, **kwargs): # noqa: E501
  606. """Get the user's total interest income of specified currency # noqa: E501
  607. This method makes a synchronous HTTP request by default. To make an
  608. asynchronous HTTP request, please pass async_req=True
  609. >>> thread = api.get_uni_interest_with_http_info(currency, async_req=True)
  610. >>> result = thread.get()
  611. :param bool async_req: execute request asynchronously
  612. :param str currency: Currency (required)
  613. :param _return_http_data_only: response data without head status code
  614. and headers
  615. :param _preload_content: if False, the urllib3.HTTPResponse object will
  616. be returned without reading/decoding response
  617. data. Default is True.
  618. :param _request_timeout: timeout setting for this request. If one
  619. number provided, it will be total request
  620. timeout. It can also be a pair (tuple) of
  621. (connection, read) timeouts.
  622. :rtype: tuple(gate_api.UniLendInterest, status_code(int), headers(HTTPHeaderDict))
  623. :return: If the method is called asynchronously,
  624. returns the request thread.
  625. """
  626. local_var_params = locals()
  627. all_params = ['currency']
  628. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  629. for k, v in six.iteritems(local_var_params['kwargs']):
  630. if k not in all_params:
  631. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_uni_interest" % k)
  632. local_var_params[k] = v
  633. del local_var_params['kwargs']
  634. # verify the required parameter 'currency' is set
  635. if self.api_client.client_side_validation and (
  636. 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501
  637. ): # noqa: E501
  638. raise ApiValueError(
  639. "Missing the required parameter `currency` when calling `get_uni_interest`"
  640. ) # noqa: E501
  641. collection_formats = {}
  642. path_params = {}
  643. if 'currency' in local_var_params:
  644. path_params['currency'] = local_var_params['currency'] # noqa: E501
  645. query_params = []
  646. header_params = {}
  647. form_params = []
  648. local_var_files = {}
  649. body_params = None
  650. # HTTP header `Accept`
  651. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  652. # Authentication setting
  653. auth_settings = ['apiv4'] # noqa: E501
  654. return self.api_client.call_api(
  655. '/earn/uni/interests/{currency}',
  656. 'GET',
  657. path_params,
  658. query_params,
  659. header_params,
  660. body=body_params,
  661. post_params=form_params,
  662. files=local_var_files,
  663. response_type='UniLendInterest', # noqa: E501
  664. auth_settings=auth_settings,
  665. async_req=local_var_params.get('async_req'),
  666. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  667. _preload_content=local_var_params.get('_preload_content', True),
  668. _request_timeout=local_var_params.get('_request_timeout'),
  669. collection_formats=collection_formats,
  670. )
  671. def list_uni_interest_records(self, **kwargs): # noqa: E501
  672. """List interest records # noqa: E501
  673. This method makes a synchronous HTTP request by default. To make an
  674. asynchronous HTTP request, please pass async_req=True
  675. >>> thread = api.list_uni_interest_records(async_req=True)
  676. >>> result = thread.get()
  677. :param bool async_req: execute request asynchronously
  678. :param str currency: Retrieve data of the specified currency
  679. :param int page: Page number
  680. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  681. :param _preload_content: if False, the urllib3.HTTPResponse object will
  682. be returned without reading/decoding response
  683. data. Default is True.
  684. :param _request_timeout: timeout setting for this request. If one
  685. number provided, it will be total request
  686. timeout. It can also be a pair (tuple) of
  687. (connection, read) timeouts.
  688. :rtype: list[gate_api.UniInterestRecord]
  689. :return: If the method is called asynchronously,
  690. returns the request thread.
  691. """
  692. kwargs['_return_http_data_only'] = True
  693. return self.list_uni_interest_records_with_http_info(**kwargs) # noqa: E501
  694. def list_uni_interest_records_with_http_info(self, **kwargs): # noqa: E501
  695. """List interest records # noqa: E501
  696. This method makes a synchronous HTTP request by default. To make an
  697. asynchronous HTTP request, please pass async_req=True
  698. >>> thread = api.list_uni_interest_records_with_http_info(async_req=True)
  699. >>> result = thread.get()
  700. :param bool async_req: execute request asynchronously
  701. :param str currency: Retrieve data of the specified currency
  702. :param int page: Page number
  703. :param int limit: Maximum response items. Default: 100, minimum: 1, Maximum: 100
  704. :param _return_http_data_only: response data without head status code
  705. and headers
  706. :param _preload_content: if False, the urllib3.HTTPResponse object will
  707. be returned without reading/decoding response
  708. data. Default is True.
  709. :param _request_timeout: timeout setting for this request. If one
  710. number provided, it will be total request
  711. timeout. It can also be a pair (tuple) of
  712. (connection, read) timeouts.
  713. :rtype: tuple(list[gate_api.UniInterestRecord], status_code(int), headers(HTTPHeaderDict))
  714. :return: If the method is called asynchronously,
  715. returns the request thread.
  716. """
  717. local_var_params = locals()
  718. all_params = ['currency', 'page', 'limit']
  719. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  720. for k, v in six.iteritems(local_var_params['kwargs']):
  721. if k not in all_params:
  722. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_uni_interest_records" % k)
  723. local_var_params[k] = v
  724. del local_var_params['kwargs']
  725. if (
  726. self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1
  727. ): # noqa: E501
  728. raise ApiValueError(
  729. "Invalid value for parameter `page` when calling `list_uni_interest_records`, must be a value greater than or equal to `1`"
  730. ) # noqa: E501
  731. if (
  732. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 100
  733. ): # noqa: E501
  734. raise ApiValueError(
  735. "Invalid value for parameter `limit` when calling `list_uni_interest_records`, must be a value less than or equal to `100`"
  736. ) # noqa: E501
  737. if (
  738. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  739. ): # noqa: E501
  740. raise ApiValueError(
  741. "Invalid value for parameter `limit` when calling `list_uni_interest_records`, must be a value greater than or equal to `1`"
  742. ) # noqa: E501
  743. collection_formats = {}
  744. path_params = {}
  745. query_params = []
  746. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  747. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  748. if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
  749. query_params.append(('page', local_var_params['page'])) # noqa: E501
  750. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  751. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  752. header_params = {}
  753. form_params = []
  754. local_var_files = {}
  755. body_params = None
  756. # HTTP header `Accept`
  757. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  758. # Authentication setting
  759. auth_settings = ['apiv4'] # noqa: E501
  760. return self.api_client.call_api(
  761. '/earn/uni/interest_records',
  762. 'GET',
  763. path_params,
  764. query_params,
  765. header_params,
  766. body=body_params,
  767. post_params=form_params,
  768. files=local_var_files,
  769. response_type='list[UniInterestRecord]', # noqa: E501
  770. auth_settings=auth_settings,
  771. async_req=local_var_params.get('async_req'),
  772. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  773. _preload_content=local_var_params.get('_preload_content', True),
  774. _request_timeout=local_var_params.get('_request_timeout'),
  775. collection_formats=collection_formats,
  776. )