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

3628 lines
176 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 MarginApi(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_margin_currency_pairs(self, **kwargs): # noqa: E501
  24. """List all supported currency pairs supported in margin trading # 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_margin_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.MarginCurrencyPair]
  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_margin_currency_pairs_with_http_info(**kwargs) # noqa: E501
  43. def list_margin_currency_pairs_with_http_info(self, **kwargs): # noqa: E501
  44. """List all supported currency pairs supported in margin trading # 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_margin_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.MarginCurrencyPair], 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(
  69. "Got an unexpected keyword argument '%s'" " to method list_margin_currency_pairs" % k
  70. )
  71. local_var_params[k] = v
  72. del local_var_params['kwargs']
  73. collection_formats = {}
  74. path_params = {}
  75. query_params = []
  76. header_params = {}
  77. form_params = []
  78. local_var_files = {}
  79. body_params = None
  80. # HTTP header `Accept`
  81. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  82. # Authentication setting
  83. auth_settings = [] # noqa: E501
  84. return self.api_client.call_api(
  85. '/margin/currency_pairs',
  86. 'GET',
  87. path_params,
  88. query_params,
  89. header_params,
  90. body=body_params,
  91. post_params=form_params,
  92. files=local_var_files,
  93. response_type='list[MarginCurrencyPair]', # noqa: E501
  94. auth_settings=auth_settings,
  95. async_req=local_var_params.get('async_req'),
  96. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  97. _preload_content=local_var_params.get('_preload_content', True),
  98. _request_timeout=local_var_params.get('_request_timeout'),
  99. collection_formats=collection_formats,
  100. )
  101. def get_margin_currency_pair(self, currency_pair, **kwargs): # noqa: E501
  102. """Query one single margin currency pair # noqa: E501
  103. This method makes a synchronous HTTP request by default. To make an
  104. asynchronous HTTP request, please pass async_req=True
  105. >>> thread = api.get_margin_currency_pair(currency_pair, async_req=True)
  106. >>> result = thread.get()
  107. :param bool async_req: execute request asynchronously
  108. :param str currency_pair: Margin currency pair (required)
  109. :param _preload_content: if False, the urllib3.HTTPResponse object will
  110. be returned without reading/decoding response
  111. data. Default is True.
  112. :param _request_timeout: timeout setting for this request. If one
  113. number provided, it will be total request
  114. timeout. It can also be a pair (tuple) of
  115. (connection, read) timeouts.
  116. :rtype: gate_api.MarginCurrencyPair
  117. :return: If the method is called asynchronously,
  118. returns the request thread.
  119. """
  120. kwargs['_return_http_data_only'] = True
  121. return self.get_margin_currency_pair_with_http_info(currency_pair, **kwargs) # noqa: E501
  122. def get_margin_currency_pair_with_http_info(self, currency_pair, **kwargs): # noqa: E501
  123. """Query one single margin currency pair # noqa: E501
  124. This method makes a synchronous HTTP request by default. To make an
  125. asynchronous HTTP request, please pass async_req=True
  126. >>> thread = api.get_margin_currency_pair_with_http_info(currency_pair, async_req=True)
  127. >>> result = thread.get()
  128. :param bool async_req: execute request asynchronously
  129. :param str currency_pair: Margin currency pair (required)
  130. :param _return_http_data_only: response data without head status code
  131. and headers
  132. :param _preload_content: if False, the urllib3.HTTPResponse object will
  133. be returned without reading/decoding response
  134. data. Default is True.
  135. :param _request_timeout: timeout setting for this request. If one
  136. number provided, it will be total request
  137. timeout. It can also be a pair (tuple) of
  138. (connection, read) timeouts.
  139. :rtype: tuple(gate_api.MarginCurrencyPair, status_code(int), headers(HTTPHeaderDict))
  140. :return: If the method is called asynchronously,
  141. returns the request thread.
  142. """
  143. local_var_params = locals()
  144. all_params = ['currency_pair']
  145. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  146. for k, v in six.iteritems(local_var_params['kwargs']):
  147. if k not in all_params:
  148. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_margin_currency_pair" % k)
  149. local_var_params[k] = v
  150. del local_var_params['kwargs']
  151. # verify the required parameter 'currency_pair' is set
  152. if self.api_client.client_side_validation and (
  153. 'currency_pair' not in local_var_params or local_var_params['currency_pair'] is None # noqa: E501
  154. ): # noqa: E501
  155. raise ApiValueError(
  156. "Missing the required parameter `currency_pair` when calling `get_margin_currency_pair`"
  157. ) # noqa: E501
  158. collection_formats = {}
  159. path_params = {}
  160. if 'currency_pair' in local_var_params:
  161. path_params['currency_pair'] = local_var_params['currency_pair'] # noqa: E501
  162. query_params = []
  163. header_params = {}
  164. form_params = []
  165. local_var_files = {}
  166. body_params = None
  167. # HTTP header `Accept`
  168. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  169. # Authentication setting
  170. auth_settings = [] # noqa: E501
  171. return self.api_client.call_api(
  172. '/margin/currency_pairs/{currency_pair}',
  173. 'GET',
  174. path_params,
  175. query_params,
  176. header_params,
  177. body=body_params,
  178. post_params=form_params,
  179. files=local_var_files,
  180. response_type='MarginCurrencyPair', # noqa: E501
  181. auth_settings=auth_settings,
  182. async_req=local_var_params.get('async_req'),
  183. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  184. _preload_content=local_var_params.get('_preload_content', True),
  185. _request_timeout=local_var_params.get('_request_timeout'),
  186. collection_formats=collection_formats,
  187. )
  188. def list_funding_book(self, currency, **kwargs): # noqa: E501
  189. """Order book of lending loans # noqa: E501
  190. This method makes a synchronous HTTP request by default. To make an
  191. asynchronous HTTP request, please pass async_req=True
  192. >>> thread = api.list_funding_book(currency, async_req=True)
  193. >>> result = thread.get()
  194. :param bool async_req: execute request asynchronously
  195. :param str currency: Retrieve data of the specified currency (required)
  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.FundingBookItem]
  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_funding_book_with_http_info(currency, **kwargs) # noqa: E501
  209. def list_funding_book_with_http_info(self, currency, **kwargs): # noqa: E501
  210. """Order book of lending loans # 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_funding_book_with_http_info(currency, 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 (required)
  217. :param _return_http_data_only: response data without head status code
  218. and headers
  219. :param _preload_content: if False, the urllib3.HTTPResponse object will
  220. be returned without reading/decoding response
  221. data. Default is True.
  222. :param _request_timeout: timeout setting for this request. If one
  223. number provided, it will be total request
  224. timeout. It can also be a pair (tuple) of
  225. (connection, read) timeouts.
  226. :rtype: tuple(list[gate_api.FundingBookItem], status_code(int), headers(HTTPHeaderDict))
  227. :return: If the method is called asynchronously,
  228. returns the request thread.
  229. """
  230. local_var_params = locals()
  231. all_params = ['currency']
  232. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  233. for k, v in six.iteritems(local_var_params['kwargs']):
  234. if k not in all_params:
  235. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_funding_book" % k)
  236. local_var_params[k] = v
  237. del local_var_params['kwargs']
  238. # verify the required parameter 'currency' is set
  239. if self.api_client.client_side_validation and (
  240. 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501
  241. ): # noqa: E501
  242. raise ApiValueError(
  243. "Missing the required parameter `currency` when calling `list_funding_book`"
  244. ) # noqa: E501
  245. collection_formats = {}
  246. path_params = {}
  247. query_params = []
  248. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  249. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  250. header_params = {}
  251. form_params = []
  252. local_var_files = {}
  253. body_params = None
  254. # HTTP header `Accept`
  255. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  256. # Authentication setting
  257. auth_settings = [] # noqa: E501
  258. return self.api_client.call_api(
  259. '/margin/funding_book',
  260. 'GET',
  261. path_params,
  262. query_params,
  263. header_params,
  264. body=body_params,
  265. post_params=form_params,
  266. files=local_var_files,
  267. response_type='list[FundingBookItem]', # noqa: E501
  268. auth_settings=auth_settings,
  269. async_req=local_var_params.get('async_req'),
  270. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  271. _preload_content=local_var_params.get('_preload_content', True),
  272. _request_timeout=local_var_params.get('_request_timeout'),
  273. collection_formats=collection_formats,
  274. )
  275. def list_margin_accounts(self, **kwargs): # noqa: E501
  276. """Margin account list # noqa: E501
  277. This method makes a synchronous HTTP request by default. To make an
  278. asynchronous HTTP request, please pass async_req=True
  279. >>> thread = api.list_margin_accounts(async_req=True)
  280. >>> result = thread.get()
  281. :param bool async_req: execute request asynchronously
  282. :param str currency_pair: Currency pair
  283. :param _preload_content: if False, the urllib3.HTTPResponse object will
  284. be returned without reading/decoding response
  285. data. Default is True.
  286. :param _request_timeout: timeout setting for this request. If one
  287. number provided, it will be total request
  288. timeout. It can also be a pair (tuple) of
  289. (connection, read) timeouts.
  290. :rtype: list[gate_api.MarginAccount]
  291. :return: If the method is called asynchronously,
  292. returns the request thread.
  293. """
  294. kwargs['_return_http_data_only'] = True
  295. return self.list_margin_accounts_with_http_info(**kwargs) # noqa: E501
  296. def list_margin_accounts_with_http_info(self, **kwargs): # noqa: E501
  297. """Margin account list # 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.list_margin_accounts_with_http_info(async_req=True)
  301. >>> result = thread.get()
  302. :param bool async_req: execute request asynchronously
  303. :param str currency_pair: Currency pair
  304. :param _return_http_data_only: response data without head status code
  305. and headers
  306. :param _preload_content: if False, the urllib3.HTTPResponse object will
  307. be returned without reading/decoding response
  308. data. Default is True.
  309. :param _request_timeout: timeout setting for this request. If one
  310. number provided, it will be total request
  311. timeout. It can also be a pair (tuple) of
  312. (connection, read) timeouts.
  313. :rtype: tuple(list[gate_api.MarginAccount], status_code(int), headers(HTTPHeaderDict))
  314. :return: If the method is called asynchronously,
  315. returns the request thread.
  316. """
  317. local_var_params = locals()
  318. all_params = ['currency_pair']
  319. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  320. for k, v in six.iteritems(local_var_params['kwargs']):
  321. if k not in all_params:
  322. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_margin_accounts" % k)
  323. local_var_params[k] = v
  324. del local_var_params['kwargs']
  325. collection_formats = {}
  326. path_params = {}
  327. query_params = []
  328. if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501
  329. query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501
  330. header_params = {}
  331. form_params = []
  332. local_var_files = {}
  333. body_params = None
  334. # HTTP header `Accept`
  335. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  336. # Authentication setting
  337. auth_settings = ['apiv4'] # noqa: E501
  338. return self.api_client.call_api(
  339. '/margin/accounts',
  340. 'GET',
  341. path_params,
  342. query_params,
  343. header_params,
  344. body=body_params,
  345. post_params=form_params,
  346. files=local_var_files,
  347. response_type='list[MarginAccount]', # noqa: E501
  348. auth_settings=auth_settings,
  349. async_req=local_var_params.get('async_req'),
  350. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  351. _preload_content=local_var_params.get('_preload_content', True),
  352. _request_timeout=local_var_params.get('_request_timeout'),
  353. collection_formats=collection_formats,
  354. )
  355. def list_margin_account_book(self, **kwargs): # noqa: E501
  356. """List margin account balance change history # noqa: E501
  357. Only transferals from and to margin account are provided for now. Time range allows 30 days at most # noqa: E501
  358. This method makes a synchronous HTTP request by default. To make an
  359. asynchronous HTTP request, please pass async_req=True
  360. >>> thread = api.list_margin_account_book(async_req=True)
  361. >>> result = thread.get()
  362. :param bool async_req: execute request asynchronously
  363. :param str currency: List records related to specified currency only. If specified, `currency_pair` is also required.
  364. :param str currency_pair: List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided
  365. :param int _from: Start timestamp of the query
  366. :param int to: Time range ending, default to current time
  367. :param int page: Page number
  368. :param int limit: Maximum number of records to be returned in a single list
  369. :param _preload_content: if False, the urllib3.HTTPResponse object will
  370. be returned without reading/decoding response
  371. data. Default is True.
  372. :param _request_timeout: timeout setting for this request. If one
  373. number provided, it will be total request
  374. timeout. It can also be a pair (tuple) of
  375. (connection, read) timeouts.
  376. :rtype: list[gate_api.MarginAccountBook]
  377. :return: If the method is called asynchronously,
  378. returns the request thread.
  379. """
  380. kwargs['_return_http_data_only'] = True
  381. return self.list_margin_account_book_with_http_info(**kwargs) # noqa: E501
  382. def list_margin_account_book_with_http_info(self, **kwargs): # noqa: E501
  383. """List margin account balance change history # noqa: E501
  384. Only transferals from and to margin account are provided for now. Time range allows 30 days at most # noqa: E501
  385. This method makes a synchronous HTTP request by default. To make an
  386. asynchronous HTTP request, please pass async_req=True
  387. >>> thread = api.list_margin_account_book_with_http_info(async_req=True)
  388. >>> result = thread.get()
  389. :param bool async_req: execute request asynchronously
  390. :param str currency: List records related to specified currency only. If specified, `currency_pair` is also required.
  391. :param str currency_pair: List records related to specified currency pair. Used in combination with `currency`. Ignored if `currency` is not provided
  392. :param int _from: Start timestamp of the query
  393. :param int to: Time range ending, default to current time
  394. :param int page: Page number
  395. :param int limit: Maximum number of records to be returned in a single list
  396. :param _return_http_data_only: response data without head status code
  397. and headers
  398. :param _preload_content: if False, the urllib3.HTTPResponse object will
  399. be returned without reading/decoding response
  400. data. Default is True.
  401. :param _request_timeout: timeout setting for this request. If one
  402. number provided, it will be total request
  403. timeout. It can also be a pair (tuple) of
  404. (connection, read) timeouts.
  405. :rtype: tuple(list[gate_api.MarginAccountBook], status_code(int), headers(HTTPHeaderDict))
  406. :return: If the method is called asynchronously,
  407. returns the request thread.
  408. """
  409. local_var_params = locals()
  410. all_params = ['currency', 'currency_pair', '_from', 'to', 'page', 'limit']
  411. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  412. for k, v in six.iteritems(local_var_params['kwargs']):
  413. if k not in all_params:
  414. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_margin_account_book" % k)
  415. local_var_params[k] = v
  416. del local_var_params['kwargs']
  417. if (
  418. self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1
  419. ): # noqa: E501
  420. raise ApiValueError(
  421. "Invalid value for parameter `page` when calling `list_margin_account_book`, must be a value greater than or equal to `1`"
  422. ) # noqa: E501
  423. if (
  424. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 500
  425. ): # noqa: E501
  426. raise ApiValueError(
  427. "Invalid value for parameter `limit` when calling `list_margin_account_book`, must be a value less than or equal to `500`"
  428. ) # noqa: E501
  429. if (
  430. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  431. ): # noqa: E501
  432. raise ApiValueError(
  433. "Invalid value for parameter `limit` when calling `list_margin_account_book`, must be a value greater than or equal to `1`"
  434. ) # noqa: E501
  435. collection_formats = {}
  436. path_params = {}
  437. query_params = []
  438. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  439. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  440. if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501
  441. query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501
  442. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  443. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  444. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  445. query_params.append(('to', local_var_params['to'])) # noqa: E501
  446. if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
  447. query_params.append(('page', local_var_params['page'])) # noqa: E501
  448. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  449. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  450. header_params = {}
  451. form_params = []
  452. local_var_files = {}
  453. body_params = None
  454. # HTTP header `Accept`
  455. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  456. # Authentication setting
  457. auth_settings = ['apiv4'] # noqa: E501
  458. return self.api_client.call_api(
  459. '/margin/account_book',
  460. 'GET',
  461. path_params,
  462. query_params,
  463. header_params,
  464. body=body_params,
  465. post_params=form_params,
  466. files=local_var_files,
  467. response_type='list[MarginAccountBook]', # noqa: E501
  468. auth_settings=auth_settings,
  469. async_req=local_var_params.get('async_req'),
  470. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  471. _preload_content=local_var_params.get('_preload_content', True),
  472. _request_timeout=local_var_params.get('_request_timeout'),
  473. collection_formats=collection_formats,
  474. )
  475. def list_funding_accounts(self, **kwargs): # noqa: E501
  476. """Funding account list # noqa: E501
  477. This method makes a synchronous HTTP request by default. To make an
  478. asynchronous HTTP request, please pass async_req=True
  479. >>> thread = api.list_funding_accounts(async_req=True)
  480. >>> result = thread.get()
  481. :param bool async_req: execute request asynchronously
  482. :param str currency: Retrieve data of the specified currency
  483. :param _preload_content: if False, the urllib3.HTTPResponse object will
  484. be returned without reading/decoding response
  485. data. Default is True.
  486. :param _request_timeout: timeout setting for this request. If one
  487. number provided, it will be total request
  488. timeout. It can also be a pair (tuple) of
  489. (connection, read) timeouts.
  490. :rtype: list[gate_api.FundingAccount]
  491. :return: If the method is called asynchronously,
  492. returns the request thread.
  493. """
  494. kwargs['_return_http_data_only'] = True
  495. return self.list_funding_accounts_with_http_info(**kwargs) # noqa: E501
  496. def list_funding_accounts_with_http_info(self, **kwargs): # noqa: E501
  497. """Funding account list # noqa: E501
  498. This method makes a synchronous HTTP request by default. To make an
  499. asynchronous HTTP request, please pass async_req=True
  500. >>> thread = api.list_funding_accounts_with_http_info(async_req=True)
  501. >>> result = thread.get()
  502. :param bool async_req: execute request asynchronously
  503. :param str currency: Retrieve data of the specified currency
  504. :param _return_http_data_only: response data without head status code
  505. and headers
  506. :param _preload_content: if False, the urllib3.HTTPResponse object will
  507. be returned without reading/decoding response
  508. data. Default is True.
  509. :param _request_timeout: timeout setting for this request. If one
  510. number provided, it will be total request
  511. timeout. It can also be a pair (tuple) of
  512. (connection, read) timeouts.
  513. :rtype: tuple(list[gate_api.FundingAccount], status_code(int), headers(HTTPHeaderDict))
  514. :return: If the method is called asynchronously,
  515. returns the request thread.
  516. """
  517. local_var_params = locals()
  518. all_params = ['currency']
  519. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  520. for k, v in six.iteritems(local_var_params['kwargs']):
  521. if k not in all_params:
  522. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_funding_accounts" % k)
  523. local_var_params[k] = v
  524. del local_var_params['kwargs']
  525. collection_formats = {}
  526. path_params = {}
  527. query_params = []
  528. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  529. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  530. header_params = {}
  531. form_params = []
  532. local_var_files = {}
  533. body_params = None
  534. # HTTP header `Accept`
  535. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  536. # Authentication setting
  537. auth_settings = ['apiv4'] # noqa: E501
  538. return self.api_client.call_api(
  539. '/margin/funding_accounts',
  540. 'GET',
  541. path_params,
  542. query_params,
  543. header_params,
  544. body=body_params,
  545. post_params=form_params,
  546. files=local_var_files,
  547. response_type='list[FundingAccount]', # noqa: E501
  548. auth_settings=auth_settings,
  549. async_req=local_var_params.get('async_req'),
  550. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  551. _preload_content=local_var_params.get('_preload_content', True),
  552. _request_timeout=local_var_params.get('_request_timeout'),
  553. collection_formats=collection_formats,
  554. )
  555. def list_loans(self, status, side, **kwargs): # noqa: E501
  556. """List all loans # noqa: E501
  557. This method makes a synchronous HTTP request by default. To make an
  558. asynchronous HTTP request, please pass async_req=True
  559. >>> thread = api.list_loans(status, side, async_req=True)
  560. >>> result = thread.get()
  561. :param bool async_req: execute request asynchronously
  562. :param str status: Loan status (required)
  563. :param str side: Lend or borrow (required)
  564. :param str currency: Retrieve data of the specified currency
  565. :param str currency_pair: Currency pair
  566. :param str sort_by: Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time`
  567. :param bool reverse_sort: Whether to sort in descending order. Default to `true`
  568. :param int page: Page number
  569. :param int limit: Maximum number of records to be returned in a single list
  570. :param _preload_content: if False, the urllib3.HTTPResponse object will
  571. be returned without reading/decoding response
  572. data. Default is True.
  573. :param _request_timeout: timeout setting for this request. If one
  574. number provided, it will be total request
  575. timeout. It can also be a pair (tuple) of
  576. (connection, read) timeouts.
  577. :rtype: list[gate_api.Loan]
  578. :return: If the method is called asynchronously,
  579. returns the request thread.
  580. """
  581. kwargs['_return_http_data_only'] = True
  582. return self.list_loans_with_http_info(status, side, **kwargs) # noqa: E501
  583. def list_loans_with_http_info(self, status, side, **kwargs): # noqa: E501
  584. """List all loans # noqa: E501
  585. This method makes a synchronous HTTP request by default. To make an
  586. asynchronous HTTP request, please pass async_req=True
  587. >>> thread = api.list_loans_with_http_info(status, side, async_req=True)
  588. >>> result = thread.get()
  589. :param bool async_req: execute request asynchronously
  590. :param str status: Loan status (required)
  591. :param str side: Lend or borrow (required)
  592. :param str currency: Retrieve data of the specified currency
  593. :param str currency_pair: Currency pair
  594. :param str sort_by: Specify which field is used to sort. `create_time` or `rate` is supported. Default to `create_time`
  595. :param bool reverse_sort: Whether to sort in descending order. Default to `true`
  596. :param int page: Page number
  597. :param int limit: Maximum number of records to be returned in a single list
  598. :param _return_http_data_only: response data without head status code
  599. and headers
  600. :param _preload_content: if False, the urllib3.HTTPResponse object will
  601. be returned without reading/decoding response
  602. data. Default is True.
  603. :param _request_timeout: timeout setting for this request. If one
  604. number provided, it will be total request
  605. timeout. It can also be a pair (tuple) of
  606. (connection, read) timeouts.
  607. :rtype: tuple(list[gate_api.Loan], status_code(int), headers(HTTPHeaderDict))
  608. :return: If the method is called asynchronously,
  609. returns the request thread.
  610. """
  611. local_var_params = locals()
  612. all_params = ['status', 'side', 'currency', 'currency_pair', 'sort_by', 'reverse_sort', 'page', 'limit']
  613. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  614. for k, v in six.iteritems(local_var_params['kwargs']):
  615. if k not in all_params:
  616. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_loans" % k)
  617. local_var_params[k] = v
  618. del local_var_params['kwargs']
  619. # verify the required parameter 'status' is set
  620. if self.api_client.client_side_validation and (
  621. 'status' not in local_var_params or local_var_params['status'] is None # noqa: E501
  622. ): # noqa: E501
  623. raise ApiValueError("Missing the required parameter `status` when calling `list_loans`") # noqa: E501
  624. # verify the required parameter 'side' is set
  625. if self.api_client.client_side_validation and (
  626. 'side' not in local_var_params or local_var_params['side'] is None # noqa: E501
  627. ): # noqa: E501
  628. raise ApiValueError("Missing the required parameter `side` when calling `list_loans`") # noqa: E501
  629. if (
  630. self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1
  631. ): # noqa: E501
  632. raise ApiValueError(
  633. "Invalid value for parameter `page` when calling `list_loans`, must be a value greater than or equal to `1`"
  634. ) # noqa: E501
  635. if (
  636. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  637. ): # noqa: E501
  638. raise ApiValueError(
  639. "Invalid value for parameter `limit` when calling `list_loans`, must be a value less than or equal to `1000`"
  640. ) # noqa: E501
  641. if (
  642. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  643. ): # noqa: E501
  644. raise ApiValueError(
  645. "Invalid value for parameter `limit` when calling `list_loans`, must be a value greater than or equal to `1`"
  646. ) # noqa: E501
  647. collection_formats = {}
  648. path_params = {}
  649. query_params = []
  650. if 'status' in local_var_params and local_var_params['status'] is not None: # noqa: E501
  651. query_params.append(('status', local_var_params['status'])) # noqa: E501
  652. if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501
  653. query_params.append(('side', local_var_params['side'])) # noqa: E501
  654. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  655. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  656. if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501
  657. query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501
  658. if 'sort_by' in local_var_params and local_var_params['sort_by'] is not None: # noqa: E501
  659. query_params.append(('sort_by', local_var_params['sort_by'])) # noqa: E501
  660. if 'reverse_sort' in local_var_params and local_var_params['reverse_sort'] is not None: # noqa: E501
  661. query_params.append(('reverse_sort', local_var_params['reverse_sort'])) # noqa: E501
  662. if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
  663. query_params.append(('page', local_var_params['page'])) # noqa: E501
  664. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  665. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  666. header_params = {}
  667. form_params = []
  668. local_var_files = {}
  669. body_params = None
  670. # HTTP header `Accept`
  671. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  672. # Authentication setting
  673. auth_settings = ['apiv4'] # noqa: E501
  674. return self.api_client.call_api(
  675. '/margin/loans',
  676. 'GET',
  677. path_params,
  678. query_params,
  679. header_params,
  680. body=body_params,
  681. post_params=form_params,
  682. files=local_var_files,
  683. response_type='list[Loan]', # noqa: E501
  684. auth_settings=auth_settings,
  685. async_req=local_var_params.get('async_req'),
  686. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  687. _preload_content=local_var_params.get('_preload_content', True),
  688. _request_timeout=local_var_params.get('_request_timeout'),
  689. collection_formats=collection_formats,
  690. )
  691. def create_loan(self, loan, **kwargs): # noqa: E501
  692. """Lend or borrow # noqa: E501
  693. This method makes a synchronous HTTP request by default. To make an
  694. asynchronous HTTP request, please pass async_req=True
  695. >>> thread = api.create_loan(loan, async_req=True)
  696. >>> result = thread.get()
  697. :param bool async_req: execute request asynchronously
  698. :param Loan loan: (required)
  699. :param _preload_content: if False, the urllib3.HTTPResponse object will
  700. be returned without reading/decoding response
  701. data. Default is True.
  702. :param _request_timeout: timeout setting for this request. If one
  703. number provided, it will be total request
  704. timeout. It can also be a pair (tuple) of
  705. (connection, read) timeouts.
  706. :rtype: gate_api.Loan
  707. :return: If the method is called asynchronously,
  708. returns the request thread.
  709. """
  710. kwargs['_return_http_data_only'] = True
  711. return self.create_loan_with_http_info(loan, **kwargs) # noqa: E501
  712. def create_loan_with_http_info(self, loan, **kwargs): # noqa: E501
  713. """Lend or borrow # noqa: E501
  714. This method makes a synchronous HTTP request by default. To make an
  715. asynchronous HTTP request, please pass async_req=True
  716. >>> thread = api.create_loan_with_http_info(loan, async_req=True)
  717. >>> result = thread.get()
  718. :param bool async_req: execute request asynchronously
  719. :param Loan loan: (required)
  720. :param _return_http_data_only: response data without head status code
  721. and headers
  722. :param _preload_content: if False, the urllib3.HTTPResponse object will
  723. be returned without reading/decoding response
  724. data. Default is True.
  725. :param _request_timeout: timeout setting for this request. If one
  726. number provided, it will be total request
  727. timeout. It can also be a pair (tuple) of
  728. (connection, read) timeouts.
  729. :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict))
  730. :return: If the method is called asynchronously,
  731. returns the request thread.
  732. """
  733. local_var_params = locals()
  734. all_params = ['loan']
  735. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  736. for k, v in six.iteritems(local_var_params['kwargs']):
  737. if k not in all_params:
  738. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_loan" % k)
  739. local_var_params[k] = v
  740. del local_var_params['kwargs']
  741. # verify the required parameter 'loan' is set
  742. if self.api_client.client_side_validation and (
  743. 'loan' not in local_var_params or local_var_params['loan'] is None # noqa: E501
  744. ): # noqa: E501
  745. raise ApiValueError("Missing the required parameter `loan` when calling `create_loan`") # noqa: E501
  746. collection_formats = {}
  747. path_params = {}
  748. query_params = []
  749. header_params = {}
  750. form_params = []
  751. local_var_files = {}
  752. body_params = None
  753. if 'loan' in local_var_params:
  754. body_params = local_var_params['loan']
  755. # HTTP header `Accept`
  756. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  757. # HTTP header `Content-Type`
  758. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  759. ['application/json']
  760. ) # noqa: E501
  761. # Authentication setting
  762. auth_settings = ['apiv4'] # noqa: E501
  763. return self.api_client.call_api(
  764. '/margin/loans',
  765. 'POST',
  766. path_params,
  767. query_params,
  768. header_params,
  769. body=body_params,
  770. post_params=form_params,
  771. files=local_var_files,
  772. response_type='Loan', # noqa: E501
  773. auth_settings=auth_settings,
  774. async_req=local_var_params.get('async_req'),
  775. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  776. _preload_content=local_var_params.get('_preload_content', True),
  777. _request_timeout=local_var_params.get('_request_timeout'),
  778. collection_formats=collection_formats,
  779. )
  780. def merge_loans(self, currency, ids, **kwargs): # noqa: E501
  781. """Merge multiple lending loans # noqa: E501
  782. This method makes a synchronous HTTP request by default. To make an
  783. asynchronous HTTP request, please pass async_req=True
  784. >>> thread = api.merge_loans(currency, ids, async_req=True)
  785. >>> result = thread.get()
  786. :param bool async_req: execute request asynchronously
  787. :param str currency: Retrieve data of the specified currency (required)
  788. :param str ids: A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request (required)
  789. :param _preload_content: if False, the urllib3.HTTPResponse object will
  790. be returned without reading/decoding response
  791. data. Default is True.
  792. :param _request_timeout: timeout setting for this request. If one
  793. number provided, it will be total request
  794. timeout. It can also be a pair (tuple) of
  795. (connection, read) timeouts.
  796. :rtype: gate_api.Loan
  797. :return: If the method is called asynchronously,
  798. returns the request thread.
  799. """
  800. kwargs['_return_http_data_only'] = True
  801. return self.merge_loans_with_http_info(currency, ids, **kwargs) # noqa: E501
  802. def merge_loans_with_http_info(self, currency, ids, **kwargs): # noqa: E501
  803. """Merge multiple lending loans # noqa: E501
  804. This method makes a synchronous HTTP request by default. To make an
  805. asynchronous HTTP request, please pass async_req=True
  806. >>> thread = api.merge_loans_with_http_info(currency, ids, async_req=True)
  807. >>> result = thread.get()
  808. :param bool async_req: execute request asynchronously
  809. :param str currency: Retrieve data of the specified currency (required)
  810. :param str ids: A comma-separated (,) list of IDs of the loans lent. Maximum of 20 IDs are allowed in a request (required)
  811. :param _return_http_data_only: response data without head status code
  812. and headers
  813. :param _preload_content: if False, the urllib3.HTTPResponse object will
  814. be returned without reading/decoding response
  815. data. Default is True.
  816. :param _request_timeout: timeout setting for this request. If one
  817. number provided, it will be total request
  818. timeout. It can also be a pair (tuple) of
  819. (connection, read) timeouts.
  820. :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict))
  821. :return: If the method is called asynchronously,
  822. returns the request thread.
  823. """
  824. local_var_params = locals()
  825. all_params = ['currency', 'ids']
  826. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  827. for k, v in six.iteritems(local_var_params['kwargs']):
  828. if k not in all_params:
  829. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method merge_loans" % k)
  830. local_var_params[k] = v
  831. del local_var_params['kwargs']
  832. # verify the required parameter 'currency' is set
  833. if self.api_client.client_side_validation and (
  834. 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501
  835. ): # noqa: E501
  836. raise ApiValueError("Missing the required parameter `currency` when calling `merge_loans`") # noqa: E501
  837. # verify the required parameter 'ids' is set
  838. if self.api_client.client_side_validation and (
  839. 'ids' not in local_var_params or local_var_params['ids'] is None # noqa: E501
  840. ): # noqa: E501
  841. raise ApiValueError("Missing the required parameter `ids` when calling `merge_loans`") # noqa: E501
  842. collection_formats = {}
  843. path_params = {}
  844. query_params = []
  845. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  846. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  847. if 'ids' in local_var_params and local_var_params['ids'] is not None: # noqa: E501
  848. query_params.append(('ids', local_var_params['ids'])) # noqa: E501
  849. header_params = {}
  850. form_params = []
  851. local_var_files = {}
  852. body_params = None
  853. # HTTP header `Accept`
  854. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  855. # Authentication setting
  856. auth_settings = ['apiv4'] # noqa: E501
  857. return self.api_client.call_api(
  858. '/margin/merged_loans',
  859. 'POST',
  860. path_params,
  861. query_params,
  862. header_params,
  863. body=body_params,
  864. post_params=form_params,
  865. files=local_var_files,
  866. response_type='Loan', # noqa: E501
  867. auth_settings=auth_settings,
  868. async_req=local_var_params.get('async_req'),
  869. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  870. _preload_content=local_var_params.get('_preload_content', True),
  871. _request_timeout=local_var_params.get('_request_timeout'),
  872. collection_formats=collection_formats,
  873. )
  874. def get_loan(self, loan_id, side, **kwargs): # noqa: E501
  875. """Retrieve one single loan detail # noqa: E501
  876. This method makes a synchronous HTTP request by default. To make an
  877. asynchronous HTTP request, please pass async_req=True
  878. >>> thread = api.get_loan(loan_id, side, async_req=True)
  879. >>> result = thread.get()
  880. :param bool async_req: execute request asynchronously
  881. :param str loan_id: Loan ID (required)
  882. :param str side: Lend or borrow (required)
  883. :param _preload_content: if False, the urllib3.HTTPResponse object will
  884. be returned without reading/decoding response
  885. data. Default is True.
  886. :param _request_timeout: timeout setting for this request. If one
  887. number provided, it will be total request
  888. timeout. It can also be a pair (tuple) of
  889. (connection, read) timeouts.
  890. :rtype: gate_api.Loan
  891. :return: If the method is called asynchronously,
  892. returns the request thread.
  893. """
  894. kwargs['_return_http_data_only'] = True
  895. return self.get_loan_with_http_info(loan_id, side, **kwargs) # noqa: E501
  896. def get_loan_with_http_info(self, loan_id, side, **kwargs): # noqa: E501
  897. """Retrieve one single loan detail # noqa: E501
  898. This method makes a synchronous HTTP request by default. To make an
  899. asynchronous HTTP request, please pass async_req=True
  900. >>> thread = api.get_loan_with_http_info(loan_id, side, async_req=True)
  901. >>> result = thread.get()
  902. :param bool async_req: execute request asynchronously
  903. :param str loan_id: Loan ID (required)
  904. :param str side: Lend or borrow (required)
  905. :param _return_http_data_only: response data without head status code
  906. and headers
  907. :param _preload_content: if False, the urllib3.HTTPResponse object will
  908. be returned without reading/decoding response
  909. data. Default is True.
  910. :param _request_timeout: timeout setting for this request. If one
  911. number provided, it will be total request
  912. timeout. It can also be a pair (tuple) of
  913. (connection, read) timeouts.
  914. :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict))
  915. :return: If the method is called asynchronously,
  916. returns the request thread.
  917. """
  918. local_var_params = locals()
  919. all_params = ['loan_id', 'side']
  920. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  921. for k, v in six.iteritems(local_var_params['kwargs']):
  922. if k not in all_params:
  923. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_loan" % k)
  924. local_var_params[k] = v
  925. del local_var_params['kwargs']
  926. # verify the required parameter 'loan_id' is set
  927. if self.api_client.client_side_validation and (
  928. 'loan_id' not in local_var_params or local_var_params['loan_id'] is None # noqa: E501
  929. ): # noqa: E501
  930. raise ApiValueError("Missing the required parameter `loan_id` when calling `get_loan`") # noqa: E501
  931. # verify the required parameter 'side' is set
  932. if self.api_client.client_side_validation and (
  933. 'side' not in local_var_params or local_var_params['side'] is None # noqa: E501
  934. ): # noqa: E501
  935. raise ApiValueError("Missing the required parameter `side` when calling `get_loan`") # noqa: E501
  936. collection_formats = {}
  937. path_params = {}
  938. if 'loan_id' in local_var_params:
  939. path_params['loan_id'] = local_var_params['loan_id'] # noqa: E501
  940. query_params = []
  941. if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501
  942. query_params.append(('side', local_var_params['side'])) # noqa: E501
  943. header_params = {}
  944. form_params = []
  945. local_var_files = {}
  946. body_params = None
  947. # HTTP header `Accept`
  948. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  949. # Authentication setting
  950. auth_settings = ['apiv4'] # noqa: E501
  951. return self.api_client.call_api(
  952. '/margin/loans/{loan_id}',
  953. 'GET',
  954. path_params,
  955. query_params,
  956. header_params,
  957. body=body_params,
  958. post_params=form_params,
  959. files=local_var_files,
  960. response_type='Loan', # noqa: E501
  961. auth_settings=auth_settings,
  962. async_req=local_var_params.get('async_req'),
  963. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  964. _preload_content=local_var_params.get('_preload_content', True),
  965. _request_timeout=local_var_params.get('_request_timeout'),
  966. collection_formats=collection_formats,
  967. )
  968. def cancel_loan(self, loan_id, currency, **kwargs): # noqa: E501
  969. """Cancel lending loan # noqa: E501
  970. Only lent loans can be cancelled # noqa: E501
  971. This method makes a synchronous HTTP request by default. To make an
  972. asynchronous HTTP request, please pass async_req=True
  973. >>> thread = api.cancel_loan(loan_id, currency, async_req=True)
  974. >>> result = thread.get()
  975. :param bool async_req: execute request asynchronously
  976. :param str loan_id: Loan ID (required)
  977. :param str currency: Retrieve data of the specified currency (required)
  978. :param _preload_content: if False, the urllib3.HTTPResponse object will
  979. be returned without reading/decoding response
  980. data. Default is True.
  981. :param _request_timeout: timeout setting for this request. If one
  982. number provided, it will be total request
  983. timeout. It can also be a pair (tuple) of
  984. (connection, read) timeouts.
  985. :rtype: gate_api.Loan
  986. :return: If the method is called asynchronously,
  987. returns the request thread.
  988. """
  989. kwargs['_return_http_data_only'] = True
  990. return self.cancel_loan_with_http_info(loan_id, currency, **kwargs) # noqa: E501
  991. def cancel_loan_with_http_info(self, loan_id, currency, **kwargs): # noqa: E501
  992. """Cancel lending loan # noqa: E501
  993. Only lent loans can be cancelled # noqa: E501
  994. This method makes a synchronous HTTP request by default. To make an
  995. asynchronous HTTP request, please pass async_req=True
  996. >>> thread = api.cancel_loan_with_http_info(loan_id, currency, async_req=True)
  997. >>> result = thread.get()
  998. :param bool async_req: execute request asynchronously
  999. :param str loan_id: Loan ID (required)
  1000. :param str currency: Retrieve data of the specified currency (required)
  1001. :param _return_http_data_only: response data without head status code
  1002. and headers
  1003. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1004. be returned without reading/decoding response
  1005. data. Default is True.
  1006. :param _request_timeout: timeout setting for this request. If one
  1007. number provided, it will be total request
  1008. timeout. It can also be a pair (tuple) of
  1009. (connection, read) timeouts.
  1010. :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict))
  1011. :return: If the method is called asynchronously,
  1012. returns the request thread.
  1013. """
  1014. local_var_params = locals()
  1015. all_params = ['loan_id', 'currency']
  1016. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1017. for k, v in six.iteritems(local_var_params['kwargs']):
  1018. if k not in all_params:
  1019. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_loan" % k)
  1020. local_var_params[k] = v
  1021. del local_var_params['kwargs']
  1022. # verify the required parameter 'loan_id' is set
  1023. if self.api_client.client_side_validation and (
  1024. 'loan_id' not in local_var_params or local_var_params['loan_id'] is None # noqa: E501
  1025. ): # noqa: E501
  1026. raise ApiValueError("Missing the required parameter `loan_id` when calling `cancel_loan`") # noqa: E501
  1027. # verify the required parameter 'currency' is set
  1028. if self.api_client.client_side_validation and (
  1029. 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501
  1030. ): # noqa: E501
  1031. raise ApiValueError("Missing the required parameter `currency` when calling `cancel_loan`") # noqa: E501
  1032. collection_formats = {}
  1033. path_params = {}
  1034. if 'loan_id' in local_var_params:
  1035. path_params['loan_id'] = local_var_params['loan_id'] # noqa: E501
  1036. query_params = []
  1037. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  1038. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  1039. header_params = {}
  1040. form_params = []
  1041. local_var_files = {}
  1042. body_params = None
  1043. # HTTP header `Accept`
  1044. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1045. # Authentication setting
  1046. auth_settings = ['apiv4'] # noqa: E501
  1047. return self.api_client.call_api(
  1048. '/margin/loans/{loan_id}',
  1049. 'DELETE',
  1050. path_params,
  1051. query_params,
  1052. header_params,
  1053. body=body_params,
  1054. post_params=form_params,
  1055. files=local_var_files,
  1056. response_type='Loan', # noqa: E501
  1057. auth_settings=auth_settings,
  1058. async_req=local_var_params.get('async_req'),
  1059. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1060. _preload_content=local_var_params.get('_preload_content', True),
  1061. _request_timeout=local_var_params.get('_request_timeout'),
  1062. collection_formats=collection_formats,
  1063. )
  1064. def update_loan(self, loan_id, loan_patch, **kwargs): # noqa: E501
  1065. """Modify a loan # noqa: E501
  1066. Only `auto_renew` modification is supported currently # noqa: E501
  1067. This method makes a synchronous HTTP request by default. To make an
  1068. asynchronous HTTP request, please pass async_req=True
  1069. >>> thread = api.update_loan(loan_id, loan_patch, async_req=True)
  1070. >>> result = thread.get()
  1071. :param bool async_req: execute request asynchronously
  1072. :param str loan_id: Loan ID (required)
  1073. :param LoanPatch loan_patch: (required)
  1074. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1075. be returned without reading/decoding response
  1076. data. Default is True.
  1077. :param _request_timeout: timeout setting for this request. If one
  1078. number provided, it will be total request
  1079. timeout. It can also be a pair (tuple) of
  1080. (connection, read) timeouts.
  1081. :rtype: gate_api.Loan
  1082. :return: If the method is called asynchronously,
  1083. returns the request thread.
  1084. """
  1085. kwargs['_return_http_data_only'] = True
  1086. return self.update_loan_with_http_info(loan_id, loan_patch, **kwargs) # noqa: E501
  1087. def update_loan_with_http_info(self, loan_id, loan_patch, **kwargs): # noqa: E501
  1088. """Modify a loan # noqa: E501
  1089. Only `auto_renew` modification is supported currently # noqa: E501
  1090. This method makes a synchronous HTTP request by default. To make an
  1091. asynchronous HTTP request, please pass async_req=True
  1092. >>> thread = api.update_loan_with_http_info(loan_id, loan_patch, async_req=True)
  1093. >>> result = thread.get()
  1094. :param bool async_req: execute request asynchronously
  1095. :param str loan_id: Loan ID (required)
  1096. :param LoanPatch loan_patch: (required)
  1097. :param _return_http_data_only: response data without head status code
  1098. and headers
  1099. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1100. be returned without reading/decoding response
  1101. data. Default is True.
  1102. :param _request_timeout: timeout setting for this request. If one
  1103. number provided, it will be total request
  1104. timeout. It can also be a pair (tuple) of
  1105. (connection, read) timeouts.
  1106. :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict))
  1107. :return: If the method is called asynchronously,
  1108. returns the request thread.
  1109. """
  1110. local_var_params = locals()
  1111. all_params = ['loan_id', 'loan_patch']
  1112. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1113. for k, v in six.iteritems(local_var_params['kwargs']):
  1114. if k not in all_params:
  1115. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method update_loan" % k)
  1116. local_var_params[k] = v
  1117. del local_var_params['kwargs']
  1118. # verify the required parameter 'loan_id' is set
  1119. if self.api_client.client_side_validation and (
  1120. 'loan_id' not in local_var_params or local_var_params['loan_id'] is None # noqa: E501
  1121. ): # noqa: E501
  1122. raise ApiValueError("Missing the required parameter `loan_id` when calling `update_loan`") # noqa: E501
  1123. # verify the required parameter 'loan_patch' is set
  1124. if self.api_client.client_side_validation and (
  1125. 'loan_patch' not in local_var_params or local_var_params['loan_patch'] is None # noqa: E501
  1126. ): # noqa: E501
  1127. raise ApiValueError("Missing the required parameter `loan_patch` when calling `update_loan`") # noqa: E501
  1128. collection_formats = {}
  1129. path_params = {}
  1130. if 'loan_id' in local_var_params:
  1131. path_params['loan_id'] = local_var_params['loan_id'] # noqa: E501
  1132. query_params = []
  1133. header_params = {}
  1134. form_params = []
  1135. local_var_files = {}
  1136. body_params = None
  1137. if 'loan_patch' in local_var_params:
  1138. body_params = local_var_params['loan_patch']
  1139. # HTTP header `Accept`
  1140. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1141. # HTTP header `Content-Type`
  1142. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  1143. ['application/json']
  1144. ) # noqa: E501
  1145. # Authentication setting
  1146. auth_settings = ['apiv4'] # noqa: E501
  1147. return self.api_client.call_api(
  1148. '/margin/loans/{loan_id}',
  1149. 'PATCH',
  1150. path_params,
  1151. query_params,
  1152. header_params,
  1153. body=body_params,
  1154. post_params=form_params,
  1155. files=local_var_files,
  1156. response_type='Loan', # noqa: E501
  1157. auth_settings=auth_settings,
  1158. async_req=local_var_params.get('async_req'),
  1159. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1160. _preload_content=local_var_params.get('_preload_content', True),
  1161. _request_timeout=local_var_params.get('_request_timeout'),
  1162. collection_formats=collection_formats,
  1163. )
  1164. def list_loan_repayments(self, loan_id, **kwargs): # noqa: E501
  1165. """List loan repayment records # noqa: E501
  1166. This method makes a synchronous HTTP request by default. To make an
  1167. asynchronous HTTP request, please pass async_req=True
  1168. >>> thread = api.list_loan_repayments(loan_id, async_req=True)
  1169. >>> result = thread.get()
  1170. :param bool async_req: execute request asynchronously
  1171. :param str loan_id: Loan ID (required)
  1172. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1173. be returned without reading/decoding response
  1174. data. Default is True.
  1175. :param _request_timeout: timeout setting for this request. If one
  1176. number provided, it will be total request
  1177. timeout. It can also be a pair (tuple) of
  1178. (connection, read) timeouts.
  1179. :rtype: list[gate_api.Repayment]
  1180. :return: If the method is called asynchronously,
  1181. returns the request thread.
  1182. """
  1183. kwargs['_return_http_data_only'] = True
  1184. return self.list_loan_repayments_with_http_info(loan_id, **kwargs) # noqa: E501
  1185. def list_loan_repayments_with_http_info(self, loan_id, **kwargs): # noqa: E501
  1186. """List loan repayment records # noqa: E501
  1187. This method makes a synchronous HTTP request by default. To make an
  1188. asynchronous HTTP request, please pass async_req=True
  1189. >>> thread = api.list_loan_repayments_with_http_info(loan_id, async_req=True)
  1190. >>> result = thread.get()
  1191. :param bool async_req: execute request asynchronously
  1192. :param str loan_id: Loan ID (required)
  1193. :param _return_http_data_only: response data without head status code
  1194. and headers
  1195. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1196. be returned without reading/decoding response
  1197. data. Default is True.
  1198. :param _request_timeout: timeout setting for this request. If one
  1199. number provided, it will be total request
  1200. timeout. It can also be a pair (tuple) of
  1201. (connection, read) timeouts.
  1202. :rtype: tuple(list[gate_api.Repayment], status_code(int), headers(HTTPHeaderDict))
  1203. :return: If the method is called asynchronously,
  1204. returns the request thread.
  1205. """
  1206. local_var_params = locals()
  1207. all_params = ['loan_id']
  1208. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1209. for k, v in six.iteritems(local_var_params['kwargs']):
  1210. if k not in all_params:
  1211. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_loan_repayments" % k)
  1212. local_var_params[k] = v
  1213. del local_var_params['kwargs']
  1214. # verify the required parameter 'loan_id' is set
  1215. if self.api_client.client_side_validation and (
  1216. 'loan_id' not in local_var_params or local_var_params['loan_id'] is None # noqa: E501
  1217. ): # noqa: E501
  1218. raise ApiValueError(
  1219. "Missing the required parameter `loan_id` when calling `list_loan_repayments`"
  1220. ) # noqa: E501
  1221. collection_formats = {}
  1222. path_params = {}
  1223. if 'loan_id' in local_var_params:
  1224. path_params['loan_id'] = local_var_params['loan_id'] # noqa: E501
  1225. query_params = []
  1226. header_params = {}
  1227. form_params = []
  1228. local_var_files = {}
  1229. body_params = None
  1230. # HTTP header `Accept`
  1231. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1232. # Authentication setting
  1233. auth_settings = ['apiv4'] # noqa: E501
  1234. return self.api_client.call_api(
  1235. '/margin/loans/{loan_id}/repayment',
  1236. 'GET',
  1237. path_params,
  1238. query_params,
  1239. header_params,
  1240. body=body_params,
  1241. post_params=form_params,
  1242. files=local_var_files,
  1243. response_type='list[Repayment]', # noqa: E501
  1244. auth_settings=auth_settings,
  1245. async_req=local_var_params.get('async_req'),
  1246. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1247. _preload_content=local_var_params.get('_preload_content', True),
  1248. _request_timeout=local_var_params.get('_request_timeout'),
  1249. collection_formats=collection_formats,
  1250. )
  1251. def repay_loan(self, loan_id, repay_request, **kwargs): # noqa: E501
  1252. """Repay a loan # noqa: E501
  1253. This method makes a synchronous HTTP request by default. To make an
  1254. asynchronous HTTP request, please pass async_req=True
  1255. >>> thread = api.repay_loan(loan_id, repay_request, async_req=True)
  1256. >>> result = thread.get()
  1257. :param bool async_req: execute request asynchronously
  1258. :param str loan_id: Loan ID (required)
  1259. :param RepayRequest repay_request: (required)
  1260. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1261. be returned without reading/decoding response
  1262. data. Default is True.
  1263. :param _request_timeout: timeout setting for this request. If one
  1264. number provided, it will be total request
  1265. timeout. It can also be a pair (tuple) of
  1266. (connection, read) timeouts.
  1267. :rtype: gate_api.Loan
  1268. :return: If the method is called asynchronously,
  1269. returns the request thread.
  1270. """
  1271. kwargs['_return_http_data_only'] = True
  1272. return self.repay_loan_with_http_info(loan_id, repay_request, **kwargs) # noqa: E501
  1273. def repay_loan_with_http_info(self, loan_id, repay_request, **kwargs): # noqa: E501
  1274. """Repay a loan # noqa: E501
  1275. This method makes a synchronous HTTP request by default. To make an
  1276. asynchronous HTTP request, please pass async_req=True
  1277. >>> thread = api.repay_loan_with_http_info(loan_id, repay_request, async_req=True)
  1278. >>> result = thread.get()
  1279. :param bool async_req: execute request asynchronously
  1280. :param str loan_id: Loan ID (required)
  1281. :param RepayRequest repay_request: (required)
  1282. :param _return_http_data_only: response data without head status code
  1283. and headers
  1284. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1285. be returned without reading/decoding response
  1286. data. Default is True.
  1287. :param _request_timeout: timeout setting for this request. If one
  1288. number provided, it will be total request
  1289. timeout. It can also be a pair (tuple) of
  1290. (connection, read) timeouts.
  1291. :rtype: tuple(gate_api.Loan, status_code(int), headers(HTTPHeaderDict))
  1292. :return: If the method is called asynchronously,
  1293. returns the request thread.
  1294. """
  1295. local_var_params = locals()
  1296. all_params = ['loan_id', 'repay_request']
  1297. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1298. for k, v in six.iteritems(local_var_params['kwargs']):
  1299. if k not in all_params:
  1300. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method repay_loan" % k)
  1301. local_var_params[k] = v
  1302. del local_var_params['kwargs']
  1303. # verify the required parameter 'loan_id' is set
  1304. if self.api_client.client_side_validation and (
  1305. 'loan_id' not in local_var_params or local_var_params['loan_id'] is None # noqa: E501
  1306. ): # noqa: E501
  1307. raise ApiValueError("Missing the required parameter `loan_id` when calling `repay_loan`") # noqa: E501
  1308. # verify the required parameter 'repay_request' is set
  1309. if self.api_client.client_side_validation and (
  1310. 'repay_request' not in local_var_params or local_var_params['repay_request'] is None # noqa: E501
  1311. ): # noqa: E501
  1312. raise ApiValueError(
  1313. "Missing the required parameter `repay_request` when calling `repay_loan`"
  1314. ) # noqa: E501
  1315. collection_formats = {}
  1316. path_params = {}
  1317. if 'loan_id' in local_var_params:
  1318. path_params['loan_id'] = local_var_params['loan_id'] # noqa: E501
  1319. query_params = []
  1320. header_params = {}
  1321. form_params = []
  1322. local_var_files = {}
  1323. body_params = None
  1324. if 'repay_request' in local_var_params:
  1325. body_params = local_var_params['repay_request']
  1326. # HTTP header `Accept`
  1327. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1328. # HTTP header `Content-Type`
  1329. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  1330. ['application/json']
  1331. ) # noqa: E501
  1332. # Authentication setting
  1333. auth_settings = ['apiv4'] # noqa: E501
  1334. return self.api_client.call_api(
  1335. '/margin/loans/{loan_id}/repayment',
  1336. 'POST',
  1337. path_params,
  1338. query_params,
  1339. header_params,
  1340. body=body_params,
  1341. post_params=form_params,
  1342. files=local_var_files,
  1343. response_type='Loan', # noqa: E501
  1344. auth_settings=auth_settings,
  1345. async_req=local_var_params.get('async_req'),
  1346. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1347. _preload_content=local_var_params.get('_preload_content', True),
  1348. _request_timeout=local_var_params.get('_request_timeout'),
  1349. collection_formats=collection_formats,
  1350. )
  1351. def list_loan_records(self, loan_id, **kwargs): # noqa: E501
  1352. """List repayment records of a specific loan # noqa: E501
  1353. This method makes a synchronous HTTP request by default. To make an
  1354. asynchronous HTTP request, please pass async_req=True
  1355. >>> thread = api.list_loan_records(loan_id, async_req=True)
  1356. >>> result = thread.get()
  1357. :param bool async_req: execute request asynchronously
  1358. :param str loan_id: Loan ID (required)
  1359. :param str status: Loan record status
  1360. :param int page: Page number
  1361. :param int limit: Maximum number of records to be returned in a single list
  1362. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1363. be returned without reading/decoding response
  1364. data. Default is True.
  1365. :param _request_timeout: timeout setting for this request. If one
  1366. number provided, it will be total request
  1367. timeout. It can also be a pair (tuple) of
  1368. (connection, read) timeouts.
  1369. :rtype: list[gate_api.LoanRecord]
  1370. :return: If the method is called asynchronously,
  1371. returns the request thread.
  1372. """
  1373. kwargs['_return_http_data_only'] = True
  1374. return self.list_loan_records_with_http_info(loan_id, **kwargs) # noqa: E501
  1375. def list_loan_records_with_http_info(self, loan_id, **kwargs): # noqa: E501
  1376. """List repayment records of a specific loan # noqa: E501
  1377. This method makes a synchronous HTTP request by default. To make an
  1378. asynchronous HTTP request, please pass async_req=True
  1379. >>> thread = api.list_loan_records_with_http_info(loan_id, async_req=True)
  1380. >>> result = thread.get()
  1381. :param bool async_req: execute request asynchronously
  1382. :param str loan_id: Loan ID (required)
  1383. :param str status: Loan record status
  1384. :param int page: Page number
  1385. :param int limit: Maximum number of records to be returned in a single list
  1386. :param _return_http_data_only: response data without head status code
  1387. and headers
  1388. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1389. be returned without reading/decoding response
  1390. data. Default is True.
  1391. :param _request_timeout: timeout setting for this request. If one
  1392. number provided, it will be total request
  1393. timeout. It can also be a pair (tuple) of
  1394. (connection, read) timeouts.
  1395. :rtype: tuple(list[gate_api.LoanRecord], status_code(int), headers(HTTPHeaderDict))
  1396. :return: If the method is called asynchronously,
  1397. returns the request thread.
  1398. """
  1399. local_var_params = locals()
  1400. all_params = ['loan_id', 'status', 'page', 'limit']
  1401. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1402. for k, v in six.iteritems(local_var_params['kwargs']):
  1403. if k not in all_params:
  1404. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_loan_records" % k)
  1405. local_var_params[k] = v
  1406. del local_var_params['kwargs']
  1407. # verify the required parameter 'loan_id' is set
  1408. if self.api_client.client_side_validation and (
  1409. 'loan_id' not in local_var_params or local_var_params['loan_id'] is None # noqa: E501
  1410. ): # noqa: E501
  1411. raise ApiValueError(
  1412. "Missing the required parameter `loan_id` when calling `list_loan_records`"
  1413. ) # noqa: E501
  1414. if (
  1415. self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1
  1416. ): # noqa: E501
  1417. raise ApiValueError(
  1418. "Invalid value for parameter `page` when calling `list_loan_records`, must be a value greater than or equal to `1`"
  1419. ) # noqa: E501
  1420. if (
  1421. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  1422. ): # noqa: E501
  1423. raise ApiValueError(
  1424. "Invalid value for parameter `limit` when calling `list_loan_records`, must be a value less than or equal to `1000`"
  1425. ) # noqa: E501
  1426. if (
  1427. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  1428. ): # noqa: E501
  1429. raise ApiValueError(
  1430. "Invalid value for parameter `limit` when calling `list_loan_records`, must be a value greater than or equal to `1`"
  1431. ) # noqa: E501
  1432. collection_formats = {}
  1433. path_params = {}
  1434. query_params = []
  1435. if 'loan_id' in local_var_params and local_var_params['loan_id'] is not None: # noqa: E501
  1436. query_params.append(('loan_id', local_var_params['loan_id'])) # noqa: E501
  1437. if 'status' in local_var_params and local_var_params['status'] is not None: # noqa: E501
  1438. query_params.append(('status', local_var_params['status'])) # noqa: E501
  1439. if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
  1440. query_params.append(('page', local_var_params['page'])) # noqa: E501
  1441. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  1442. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  1443. header_params = {}
  1444. form_params = []
  1445. local_var_files = {}
  1446. body_params = None
  1447. # HTTP header `Accept`
  1448. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1449. # Authentication setting
  1450. auth_settings = ['apiv4'] # noqa: E501
  1451. return self.api_client.call_api(
  1452. '/margin/loan_records',
  1453. 'GET',
  1454. path_params,
  1455. query_params,
  1456. header_params,
  1457. body=body_params,
  1458. post_params=form_params,
  1459. files=local_var_files,
  1460. response_type='list[LoanRecord]', # noqa: E501
  1461. auth_settings=auth_settings,
  1462. async_req=local_var_params.get('async_req'),
  1463. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1464. _preload_content=local_var_params.get('_preload_content', True),
  1465. _request_timeout=local_var_params.get('_request_timeout'),
  1466. collection_formats=collection_formats,
  1467. )
  1468. def get_loan_record(self, loan_record_id, loan_id, **kwargs): # noqa: E501
  1469. """Get one single loan record # noqa: E501
  1470. This method makes a synchronous HTTP request by default. To make an
  1471. asynchronous HTTP request, please pass async_req=True
  1472. >>> thread = api.get_loan_record(loan_record_id, loan_id, async_req=True)
  1473. >>> result = thread.get()
  1474. :param bool async_req: execute request asynchronously
  1475. :param str loan_record_id: Loan record ID (required)
  1476. :param str loan_id: Loan ID (required)
  1477. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1478. be returned without reading/decoding response
  1479. data. Default is True.
  1480. :param _request_timeout: timeout setting for this request. If one
  1481. number provided, it will be total request
  1482. timeout. It can also be a pair (tuple) of
  1483. (connection, read) timeouts.
  1484. :rtype: gate_api.LoanRecord
  1485. :return: If the method is called asynchronously,
  1486. returns the request thread.
  1487. """
  1488. kwargs['_return_http_data_only'] = True
  1489. return self.get_loan_record_with_http_info(loan_record_id, loan_id, **kwargs) # noqa: E501
  1490. def get_loan_record_with_http_info(self, loan_record_id, loan_id, **kwargs): # noqa: E501
  1491. """Get one single loan record # noqa: E501
  1492. This method makes a synchronous HTTP request by default. To make an
  1493. asynchronous HTTP request, please pass async_req=True
  1494. >>> thread = api.get_loan_record_with_http_info(loan_record_id, loan_id, async_req=True)
  1495. >>> result = thread.get()
  1496. :param bool async_req: execute request asynchronously
  1497. :param str loan_record_id: Loan record ID (required)
  1498. :param str loan_id: Loan ID (required)
  1499. :param _return_http_data_only: response data without head status code
  1500. and headers
  1501. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1502. be returned without reading/decoding response
  1503. data. Default is True.
  1504. :param _request_timeout: timeout setting for this request. If one
  1505. number provided, it will be total request
  1506. timeout. It can also be a pair (tuple) of
  1507. (connection, read) timeouts.
  1508. :rtype: tuple(gate_api.LoanRecord, status_code(int), headers(HTTPHeaderDict))
  1509. :return: If the method is called asynchronously,
  1510. returns the request thread.
  1511. """
  1512. local_var_params = locals()
  1513. all_params = ['loan_record_id', 'loan_id']
  1514. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1515. for k, v in six.iteritems(local_var_params['kwargs']):
  1516. if k not in all_params:
  1517. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_loan_record" % k)
  1518. local_var_params[k] = v
  1519. del local_var_params['kwargs']
  1520. # verify the required parameter 'loan_record_id' is set
  1521. if self.api_client.client_side_validation and (
  1522. 'loan_record_id' not in local_var_params or local_var_params['loan_record_id'] is None # noqa: E501
  1523. ): # noqa: E501
  1524. raise ApiValueError(
  1525. "Missing the required parameter `loan_record_id` when calling `get_loan_record`"
  1526. ) # noqa: E501
  1527. # verify the required parameter 'loan_id' is set
  1528. if self.api_client.client_side_validation and (
  1529. 'loan_id' not in local_var_params or local_var_params['loan_id'] is None # noqa: E501
  1530. ): # noqa: E501
  1531. raise ApiValueError("Missing the required parameter `loan_id` when calling `get_loan_record`") # noqa: E501
  1532. collection_formats = {}
  1533. path_params = {}
  1534. if 'loan_record_id' in local_var_params:
  1535. path_params['loan_record_id'] = local_var_params['loan_record_id'] # noqa: E501
  1536. query_params = []
  1537. if 'loan_id' in local_var_params and local_var_params['loan_id'] is not None: # noqa: E501
  1538. query_params.append(('loan_id', local_var_params['loan_id'])) # noqa: E501
  1539. header_params = {}
  1540. form_params = []
  1541. local_var_files = {}
  1542. body_params = None
  1543. # HTTP header `Accept`
  1544. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1545. # Authentication setting
  1546. auth_settings = ['apiv4'] # noqa: E501
  1547. return self.api_client.call_api(
  1548. '/margin/loan_records/{loan_record_id}',
  1549. 'GET',
  1550. path_params,
  1551. query_params,
  1552. header_params,
  1553. body=body_params,
  1554. post_params=form_params,
  1555. files=local_var_files,
  1556. response_type='LoanRecord', # noqa: E501
  1557. auth_settings=auth_settings,
  1558. async_req=local_var_params.get('async_req'),
  1559. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1560. _preload_content=local_var_params.get('_preload_content', True),
  1561. _request_timeout=local_var_params.get('_request_timeout'),
  1562. collection_formats=collection_formats,
  1563. )
  1564. def update_loan_record(self, loan_record_id, loan_patch, **kwargs): # noqa: E501
  1565. """Modify a loan record # noqa: E501
  1566. Only `auto_renew` modification is supported currently # noqa: E501
  1567. This method makes a synchronous HTTP request by default. To make an
  1568. asynchronous HTTP request, please pass async_req=True
  1569. >>> thread = api.update_loan_record(loan_record_id, loan_patch, async_req=True)
  1570. >>> result = thread.get()
  1571. :param bool async_req: execute request asynchronously
  1572. :param str loan_record_id: Loan record ID (required)
  1573. :param LoanPatch loan_patch: (required)
  1574. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1575. be returned without reading/decoding response
  1576. data. Default is True.
  1577. :param _request_timeout: timeout setting for this request. If one
  1578. number provided, it will be total request
  1579. timeout. It can also be a pair (tuple) of
  1580. (connection, read) timeouts.
  1581. :rtype: gate_api.LoanRecord
  1582. :return: If the method is called asynchronously,
  1583. returns the request thread.
  1584. """
  1585. kwargs['_return_http_data_only'] = True
  1586. return self.update_loan_record_with_http_info(loan_record_id, loan_patch, **kwargs) # noqa: E501
  1587. def update_loan_record_with_http_info(self, loan_record_id, loan_patch, **kwargs): # noqa: E501
  1588. """Modify a loan record # noqa: E501
  1589. Only `auto_renew` modification is supported currently # noqa: E501
  1590. This method makes a synchronous HTTP request by default. To make an
  1591. asynchronous HTTP request, please pass async_req=True
  1592. >>> thread = api.update_loan_record_with_http_info(loan_record_id, loan_patch, async_req=True)
  1593. >>> result = thread.get()
  1594. :param bool async_req: execute request asynchronously
  1595. :param str loan_record_id: Loan record ID (required)
  1596. :param LoanPatch loan_patch: (required)
  1597. :param _return_http_data_only: response data without head status code
  1598. and headers
  1599. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1600. be returned without reading/decoding response
  1601. data. Default is True.
  1602. :param _request_timeout: timeout setting for this request. If one
  1603. number provided, it will be total request
  1604. timeout. It can also be a pair (tuple) of
  1605. (connection, read) timeouts.
  1606. :rtype: tuple(gate_api.LoanRecord, status_code(int), headers(HTTPHeaderDict))
  1607. :return: If the method is called asynchronously,
  1608. returns the request thread.
  1609. """
  1610. local_var_params = locals()
  1611. all_params = ['loan_record_id', 'loan_patch']
  1612. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1613. for k, v in six.iteritems(local_var_params['kwargs']):
  1614. if k not in all_params:
  1615. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method update_loan_record" % k)
  1616. local_var_params[k] = v
  1617. del local_var_params['kwargs']
  1618. # verify the required parameter 'loan_record_id' is set
  1619. if self.api_client.client_side_validation and (
  1620. 'loan_record_id' not in local_var_params or local_var_params['loan_record_id'] is None # noqa: E501
  1621. ): # noqa: E501
  1622. raise ApiValueError(
  1623. "Missing the required parameter `loan_record_id` when calling `update_loan_record`"
  1624. ) # noqa: E501
  1625. # verify the required parameter 'loan_patch' is set
  1626. if self.api_client.client_side_validation and (
  1627. 'loan_patch' not in local_var_params or local_var_params['loan_patch'] is None # noqa: E501
  1628. ): # noqa: E501
  1629. raise ApiValueError(
  1630. "Missing the required parameter `loan_patch` when calling `update_loan_record`"
  1631. ) # noqa: E501
  1632. collection_formats = {}
  1633. path_params = {}
  1634. if 'loan_record_id' in local_var_params:
  1635. path_params['loan_record_id'] = local_var_params['loan_record_id'] # noqa: E501
  1636. query_params = []
  1637. header_params = {}
  1638. form_params = []
  1639. local_var_files = {}
  1640. body_params = None
  1641. if 'loan_patch' in local_var_params:
  1642. body_params = local_var_params['loan_patch']
  1643. # HTTP header `Accept`
  1644. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1645. # HTTP header `Content-Type`
  1646. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  1647. ['application/json']
  1648. ) # noqa: E501
  1649. # Authentication setting
  1650. auth_settings = ['apiv4'] # noqa: E501
  1651. return self.api_client.call_api(
  1652. '/margin/loan_records/{loan_record_id}',
  1653. 'PATCH',
  1654. path_params,
  1655. query_params,
  1656. header_params,
  1657. body=body_params,
  1658. post_params=form_params,
  1659. files=local_var_files,
  1660. response_type='LoanRecord', # noqa: E501
  1661. auth_settings=auth_settings,
  1662. async_req=local_var_params.get('async_req'),
  1663. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1664. _preload_content=local_var_params.get('_preload_content', True),
  1665. _request_timeout=local_var_params.get('_request_timeout'),
  1666. collection_formats=collection_formats,
  1667. )
  1668. def get_auto_repay_status(self, **kwargs): # noqa: E501
  1669. """Retrieve user auto repayment setting # noqa: E501
  1670. This method makes a synchronous HTTP request by default. To make an
  1671. asynchronous HTTP request, please pass async_req=True
  1672. >>> thread = api.get_auto_repay_status(async_req=True)
  1673. >>> result = thread.get()
  1674. :param bool async_req: execute request asynchronously
  1675. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1676. be returned without reading/decoding response
  1677. data. Default is True.
  1678. :param _request_timeout: timeout setting for this request. If one
  1679. number provided, it will be total request
  1680. timeout. It can also be a pair (tuple) of
  1681. (connection, read) timeouts.
  1682. :rtype: gate_api.AutoRepaySetting
  1683. :return: If the method is called asynchronously,
  1684. returns the request thread.
  1685. """
  1686. kwargs['_return_http_data_only'] = True
  1687. return self.get_auto_repay_status_with_http_info(**kwargs) # noqa: E501
  1688. def get_auto_repay_status_with_http_info(self, **kwargs): # noqa: E501
  1689. """Retrieve user auto repayment setting # noqa: E501
  1690. This method makes a synchronous HTTP request by default. To make an
  1691. asynchronous HTTP request, please pass async_req=True
  1692. >>> thread = api.get_auto_repay_status_with_http_info(async_req=True)
  1693. >>> result = thread.get()
  1694. :param bool async_req: execute request asynchronously
  1695. :param _return_http_data_only: response data without head status code
  1696. and headers
  1697. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1698. be returned without reading/decoding response
  1699. data. Default is True.
  1700. :param _request_timeout: timeout setting for this request. If one
  1701. number provided, it will be total request
  1702. timeout. It can also be a pair (tuple) of
  1703. (connection, read) timeouts.
  1704. :rtype: tuple(gate_api.AutoRepaySetting, status_code(int), headers(HTTPHeaderDict))
  1705. :return: If the method is called asynchronously,
  1706. returns the request thread.
  1707. """
  1708. local_var_params = locals()
  1709. all_params = []
  1710. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1711. for k, v in six.iteritems(local_var_params['kwargs']):
  1712. if k not in all_params:
  1713. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_auto_repay_status" % k)
  1714. local_var_params[k] = v
  1715. del local_var_params['kwargs']
  1716. collection_formats = {}
  1717. path_params = {}
  1718. query_params = []
  1719. header_params = {}
  1720. form_params = []
  1721. local_var_files = {}
  1722. body_params = None
  1723. # HTTP header `Accept`
  1724. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1725. # Authentication setting
  1726. auth_settings = ['apiv4'] # noqa: E501
  1727. return self.api_client.call_api(
  1728. '/margin/auto_repay',
  1729. 'GET',
  1730. path_params,
  1731. query_params,
  1732. header_params,
  1733. body=body_params,
  1734. post_params=form_params,
  1735. files=local_var_files,
  1736. response_type='AutoRepaySetting', # noqa: E501
  1737. auth_settings=auth_settings,
  1738. async_req=local_var_params.get('async_req'),
  1739. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1740. _preload_content=local_var_params.get('_preload_content', True),
  1741. _request_timeout=local_var_params.get('_request_timeout'),
  1742. collection_formats=collection_formats,
  1743. )
  1744. def set_auto_repay(self, status, **kwargs): # noqa: E501
  1745. """Update user's auto repayment setting # noqa: E501
  1746. This method makes a synchronous HTTP request by default. To make an
  1747. asynchronous HTTP request, please pass async_req=True
  1748. >>> thread = api.set_auto_repay(status, async_req=True)
  1749. >>> result = thread.get()
  1750. :param bool async_req: execute request asynchronously
  1751. :param str status: New auto repayment status. `on` - enabled, `off` - disabled (required)
  1752. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1753. be returned without reading/decoding response
  1754. data. Default is True.
  1755. :param _request_timeout: timeout setting for this request. If one
  1756. number provided, it will be total request
  1757. timeout. It can also be a pair (tuple) of
  1758. (connection, read) timeouts.
  1759. :rtype: gate_api.AutoRepaySetting
  1760. :return: If the method is called asynchronously,
  1761. returns the request thread.
  1762. """
  1763. kwargs['_return_http_data_only'] = True
  1764. return self.set_auto_repay_with_http_info(status, **kwargs) # noqa: E501
  1765. def set_auto_repay_with_http_info(self, status, **kwargs): # noqa: E501
  1766. """Update user's auto repayment setting # noqa: E501
  1767. This method makes a synchronous HTTP request by default. To make an
  1768. asynchronous HTTP request, please pass async_req=True
  1769. >>> thread = api.set_auto_repay_with_http_info(status, async_req=True)
  1770. >>> result = thread.get()
  1771. :param bool async_req: execute request asynchronously
  1772. :param str status: New auto repayment status. `on` - enabled, `off` - disabled (required)
  1773. :param _return_http_data_only: response data without head status code
  1774. and headers
  1775. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1776. be returned without reading/decoding response
  1777. data. Default is True.
  1778. :param _request_timeout: timeout setting for this request. If one
  1779. number provided, it will be total request
  1780. timeout. It can also be a pair (tuple) of
  1781. (connection, read) timeouts.
  1782. :rtype: tuple(gate_api.AutoRepaySetting, status_code(int), headers(HTTPHeaderDict))
  1783. :return: If the method is called asynchronously,
  1784. returns the request thread.
  1785. """
  1786. local_var_params = locals()
  1787. all_params = ['status']
  1788. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1789. for k, v in six.iteritems(local_var_params['kwargs']):
  1790. if k not in all_params:
  1791. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method set_auto_repay" % k)
  1792. local_var_params[k] = v
  1793. del local_var_params['kwargs']
  1794. # verify the required parameter 'status' is set
  1795. if self.api_client.client_side_validation and (
  1796. 'status' not in local_var_params or local_var_params['status'] is None # noqa: E501
  1797. ): # noqa: E501
  1798. raise ApiValueError("Missing the required parameter `status` when calling `set_auto_repay`") # noqa: E501
  1799. collection_formats = {}
  1800. path_params = {}
  1801. query_params = []
  1802. if 'status' in local_var_params and local_var_params['status'] is not None: # noqa: E501
  1803. query_params.append(('status', local_var_params['status'])) # noqa: E501
  1804. header_params = {}
  1805. form_params = []
  1806. local_var_files = {}
  1807. body_params = None
  1808. # HTTP header `Accept`
  1809. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1810. # Authentication setting
  1811. auth_settings = ['apiv4'] # noqa: E501
  1812. return self.api_client.call_api(
  1813. '/margin/auto_repay',
  1814. 'POST',
  1815. path_params,
  1816. query_params,
  1817. header_params,
  1818. body=body_params,
  1819. post_params=form_params,
  1820. files=local_var_files,
  1821. response_type='AutoRepaySetting', # noqa: E501
  1822. auth_settings=auth_settings,
  1823. async_req=local_var_params.get('async_req'),
  1824. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1825. _preload_content=local_var_params.get('_preload_content', True),
  1826. _request_timeout=local_var_params.get('_request_timeout'),
  1827. collection_formats=collection_formats,
  1828. )
  1829. def get_margin_transferable(self, currency, **kwargs): # noqa: E501
  1830. """Get the max transferable amount for a specific margin currency # noqa: E501
  1831. This method makes a synchronous HTTP request by default. To make an
  1832. asynchronous HTTP request, please pass async_req=True
  1833. >>> thread = api.get_margin_transferable(currency, async_req=True)
  1834. >>> result = thread.get()
  1835. :param bool async_req: execute request asynchronously
  1836. :param str currency: Retrieve data of the specified currency (required)
  1837. :param str currency_pair: Currency pair
  1838. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1839. be returned without reading/decoding response
  1840. data. Default is True.
  1841. :param _request_timeout: timeout setting for this request. If one
  1842. number provided, it will be total request
  1843. timeout. It can also be a pair (tuple) of
  1844. (connection, read) timeouts.
  1845. :rtype: gate_api.MarginTransferable
  1846. :return: If the method is called asynchronously,
  1847. returns the request thread.
  1848. """
  1849. kwargs['_return_http_data_only'] = True
  1850. return self.get_margin_transferable_with_http_info(currency, **kwargs) # noqa: E501
  1851. def get_margin_transferable_with_http_info(self, currency, **kwargs): # noqa: E501
  1852. """Get the max transferable amount for a specific margin currency # noqa: E501
  1853. This method makes a synchronous HTTP request by default. To make an
  1854. asynchronous HTTP request, please pass async_req=True
  1855. >>> thread = api.get_margin_transferable_with_http_info(currency, async_req=True)
  1856. >>> result = thread.get()
  1857. :param bool async_req: execute request asynchronously
  1858. :param str currency: Retrieve data of the specified currency (required)
  1859. :param str currency_pair: Currency pair
  1860. :param _return_http_data_only: response data without head status code
  1861. and headers
  1862. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1863. be returned without reading/decoding response
  1864. data. Default is True.
  1865. :param _request_timeout: timeout setting for this request. If one
  1866. number provided, it will be total request
  1867. timeout. It can also be a pair (tuple) of
  1868. (connection, read) timeouts.
  1869. :rtype: tuple(gate_api.MarginTransferable, status_code(int), headers(HTTPHeaderDict))
  1870. :return: If the method is called asynchronously,
  1871. returns the request thread.
  1872. """
  1873. local_var_params = locals()
  1874. all_params = ['currency', 'currency_pair']
  1875. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1876. for k, v in six.iteritems(local_var_params['kwargs']):
  1877. if k not in all_params:
  1878. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_margin_transferable" % k)
  1879. local_var_params[k] = v
  1880. del local_var_params['kwargs']
  1881. # verify the required parameter 'currency' is set
  1882. if self.api_client.client_side_validation and (
  1883. 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501
  1884. ): # noqa: E501
  1885. raise ApiValueError(
  1886. "Missing the required parameter `currency` when calling `get_margin_transferable`"
  1887. ) # noqa: E501
  1888. collection_formats = {}
  1889. path_params = {}
  1890. query_params = []
  1891. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  1892. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  1893. if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501
  1894. query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501
  1895. header_params = {}
  1896. form_params = []
  1897. local_var_files = {}
  1898. body_params = None
  1899. # HTTP header `Accept`
  1900. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1901. # Authentication setting
  1902. auth_settings = ['apiv4'] # noqa: E501
  1903. return self.api_client.call_api(
  1904. '/margin/transferable',
  1905. 'GET',
  1906. path_params,
  1907. query_params,
  1908. header_params,
  1909. body=body_params,
  1910. post_params=form_params,
  1911. files=local_var_files,
  1912. response_type='MarginTransferable', # noqa: E501
  1913. auth_settings=auth_settings,
  1914. async_req=local_var_params.get('async_req'),
  1915. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1916. _preload_content=local_var_params.get('_preload_content', True),
  1917. _request_timeout=local_var_params.get('_request_timeout'),
  1918. collection_formats=collection_formats,
  1919. )
  1920. def get_margin_borrowable(self, currency, **kwargs): # noqa: E501
  1921. """Get the max borrowable amount for a specific margin currency # noqa: E501
  1922. This method makes a synchronous HTTP request by default. To make an
  1923. asynchronous HTTP request, please pass async_req=True
  1924. >>> thread = api.get_margin_borrowable(currency, async_req=True)
  1925. >>> result = thread.get()
  1926. :param bool async_req: execute request asynchronously
  1927. :param str currency: Retrieve data of the specified currency (required)
  1928. :param str currency_pair: Currency pair
  1929. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1930. be returned without reading/decoding response
  1931. data. Default is True.
  1932. :param _request_timeout: timeout setting for this request. If one
  1933. number provided, it will be total request
  1934. timeout. It can also be a pair (tuple) of
  1935. (connection, read) timeouts.
  1936. :rtype: gate_api.MarginBorrowable
  1937. :return: If the method is called asynchronously,
  1938. returns the request thread.
  1939. """
  1940. kwargs['_return_http_data_only'] = True
  1941. return self.get_margin_borrowable_with_http_info(currency, **kwargs) # noqa: E501
  1942. def get_margin_borrowable_with_http_info(self, currency, **kwargs): # noqa: E501
  1943. """Get the max borrowable amount for a specific margin currency # noqa: E501
  1944. This method makes a synchronous HTTP request by default. To make an
  1945. asynchronous HTTP request, please pass async_req=True
  1946. >>> thread = api.get_margin_borrowable_with_http_info(currency, async_req=True)
  1947. >>> result = thread.get()
  1948. :param bool async_req: execute request asynchronously
  1949. :param str currency: Retrieve data of the specified currency (required)
  1950. :param str currency_pair: Currency pair
  1951. :param _return_http_data_only: response data without head status code
  1952. and headers
  1953. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1954. be returned without reading/decoding response
  1955. data. Default is True.
  1956. :param _request_timeout: timeout setting for this request. If one
  1957. number provided, it will be total request
  1958. timeout. It can also be a pair (tuple) of
  1959. (connection, read) timeouts.
  1960. :rtype: tuple(gate_api.MarginBorrowable, status_code(int), headers(HTTPHeaderDict))
  1961. :return: If the method is called asynchronously,
  1962. returns the request thread.
  1963. """
  1964. local_var_params = locals()
  1965. all_params = ['currency', 'currency_pair']
  1966. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1967. for k, v in six.iteritems(local_var_params['kwargs']):
  1968. if k not in all_params:
  1969. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_margin_borrowable" % k)
  1970. local_var_params[k] = v
  1971. del local_var_params['kwargs']
  1972. # verify the required parameter 'currency' is set
  1973. if self.api_client.client_side_validation and (
  1974. 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501
  1975. ): # noqa: E501
  1976. raise ApiValueError(
  1977. "Missing the required parameter `currency` when calling `get_margin_borrowable`"
  1978. ) # noqa: E501
  1979. collection_formats = {}
  1980. path_params = {}
  1981. query_params = []
  1982. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  1983. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  1984. if 'currency_pair' in local_var_params and local_var_params['currency_pair'] is not None: # noqa: E501
  1985. query_params.append(('currency_pair', local_var_params['currency_pair'])) # noqa: E501
  1986. header_params = {}
  1987. form_params = []
  1988. local_var_files = {}
  1989. body_params = None
  1990. # HTTP header `Accept`
  1991. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1992. # Authentication setting
  1993. auth_settings = ['apiv4'] # noqa: E501
  1994. return self.api_client.call_api(
  1995. '/margin/borrowable',
  1996. 'GET',
  1997. path_params,
  1998. query_params,
  1999. header_params,
  2000. body=body_params,
  2001. post_params=form_params,
  2002. files=local_var_files,
  2003. response_type='MarginBorrowable', # noqa: E501
  2004. auth_settings=auth_settings,
  2005. async_req=local_var_params.get('async_req'),
  2006. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2007. _preload_content=local_var_params.get('_preload_content', True),
  2008. _request_timeout=local_var_params.get('_request_timeout'),
  2009. collection_formats=collection_formats,
  2010. )
  2011. def list_cross_margin_currencies(self, **kwargs): # noqa: E501
  2012. """Currencies supported by cross margin. # noqa: E501
  2013. This method makes a synchronous HTTP request by default. To make an
  2014. asynchronous HTTP request, please pass async_req=True
  2015. >>> thread = api.list_cross_margin_currencies(async_req=True)
  2016. >>> result = thread.get()
  2017. :param bool async_req: execute request asynchronously
  2018. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2019. be returned without reading/decoding response
  2020. data. Default is True.
  2021. :param _request_timeout: timeout setting for this request. If one
  2022. number provided, it will be total request
  2023. timeout. It can also be a pair (tuple) of
  2024. (connection, read) timeouts.
  2025. :rtype: list[gate_api.CrossMarginCurrency]
  2026. :return: If the method is called asynchronously,
  2027. returns the request thread.
  2028. """
  2029. kwargs['_return_http_data_only'] = True
  2030. return self.list_cross_margin_currencies_with_http_info(**kwargs) # noqa: E501
  2031. def list_cross_margin_currencies_with_http_info(self, **kwargs): # noqa: E501
  2032. """Currencies supported by cross margin. # noqa: E501
  2033. This method makes a synchronous HTTP request by default. To make an
  2034. asynchronous HTTP request, please pass async_req=True
  2035. >>> thread = api.list_cross_margin_currencies_with_http_info(async_req=True)
  2036. >>> result = thread.get()
  2037. :param bool async_req: execute request asynchronously
  2038. :param _return_http_data_only: response data without head status code
  2039. and headers
  2040. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2041. be returned without reading/decoding response
  2042. data. Default is True.
  2043. :param _request_timeout: timeout setting for this request. If one
  2044. number provided, it will be total request
  2045. timeout. It can also be a pair (tuple) of
  2046. (connection, read) timeouts.
  2047. :rtype: tuple(list[gate_api.CrossMarginCurrency], status_code(int), headers(HTTPHeaderDict))
  2048. :return: If the method is called asynchronously,
  2049. returns the request thread.
  2050. """
  2051. local_var_params = locals()
  2052. all_params = []
  2053. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2054. for k, v in six.iteritems(local_var_params['kwargs']):
  2055. if k not in all_params:
  2056. raise ApiTypeError(
  2057. "Got an unexpected keyword argument '%s'" " to method list_cross_margin_currencies" % k
  2058. )
  2059. local_var_params[k] = v
  2060. del local_var_params['kwargs']
  2061. collection_formats = {}
  2062. path_params = {}
  2063. query_params = []
  2064. header_params = {}
  2065. form_params = []
  2066. local_var_files = {}
  2067. body_params = None
  2068. # HTTP header `Accept`
  2069. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2070. # Authentication setting
  2071. auth_settings = [] # noqa: E501
  2072. return self.api_client.call_api(
  2073. '/margin/cross/currencies',
  2074. 'GET',
  2075. path_params,
  2076. query_params,
  2077. header_params,
  2078. body=body_params,
  2079. post_params=form_params,
  2080. files=local_var_files,
  2081. response_type='list[CrossMarginCurrency]', # noqa: E501
  2082. auth_settings=auth_settings,
  2083. async_req=local_var_params.get('async_req'),
  2084. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2085. _preload_content=local_var_params.get('_preload_content', True),
  2086. _request_timeout=local_var_params.get('_request_timeout'),
  2087. collection_formats=collection_formats,
  2088. )
  2089. def get_cross_margin_currency(self, currency, **kwargs): # noqa: E501
  2090. """Retrieve detail of one single currency supported by cross margin # noqa: E501
  2091. This method makes a synchronous HTTP request by default. To make an
  2092. asynchronous HTTP request, please pass async_req=True
  2093. >>> thread = api.get_cross_margin_currency(currency, async_req=True)
  2094. >>> result = thread.get()
  2095. :param bool async_req: execute request asynchronously
  2096. :param str currency: Currency name (required)
  2097. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2098. be returned without reading/decoding response
  2099. data. Default is True.
  2100. :param _request_timeout: timeout setting for this request. If one
  2101. number provided, it will be total request
  2102. timeout. It can also be a pair (tuple) of
  2103. (connection, read) timeouts.
  2104. :rtype: gate_api.CrossMarginCurrency
  2105. :return: If the method is called asynchronously,
  2106. returns the request thread.
  2107. """
  2108. kwargs['_return_http_data_only'] = True
  2109. return self.get_cross_margin_currency_with_http_info(currency, **kwargs) # noqa: E501
  2110. def get_cross_margin_currency_with_http_info(self, currency, **kwargs): # noqa: E501
  2111. """Retrieve detail of one single currency supported by cross margin # noqa: E501
  2112. This method makes a synchronous HTTP request by default. To make an
  2113. asynchronous HTTP request, please pass async_req=True
  2114. >>> thread = api.get_cross_margin_currency_with_http_info(currency, async_req=True)
  2115. >>> result = thread.get()
  2116. :param bool async_req: execute request asynchronously
  2117. :param str currency: Currency name (required)
  2118. :param _return_http_data_only: response data without head status code
  2119. and headers
  2120. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2121. be returned without reading/decoding response
  2122. data. Default is True.
  2123. :param _request_timeout: timeout setting for this request. If one
  2124. number provided, it will be total request
  2125. timeout. It can also be a pair (tuple) of
  2126. (connection, read) timeouts.
  2127. :rtype: tuple(gate_api.CrossMarginCurrency, status_code(int), headers(HTTPHeaderDict))
  2128. :return: If the method is called asynchronously,
  2129. returns the request thread.
  2130. """
  2131. local_var_params = locals()
  2132. all_params = ['currency']
  2133. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2134. for k, v in six.iteritems(local_var_params['kwargs']):
  2135. if k not in all_params:
  2136. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_cross_margin_currency" % k)
  2137. local_var_params[k] = v
  2138. del local_var_params['kwargs']
  2139. # verify the required parameter 'currency' is set
  2140. if self.api_client.client_side_validation and (
  2141. 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501
  2142. ): # noqa: E501
  2143. raise ApiValueError(
  2144. "Missing the required parameter `currency` when calling `get_cross_margin_currency`"
  2145. ) # noqa: E501
  2146. collection_formats = {}
  2147. path_params = {}
  2148. if 'currency' in local_var_params:
  2149. path_params['currency'] = local_var_params['currency'] # noqa: E501
  2150. query_params = []
  2151. header_params = {}
  2152. form_params = []
  2153. local_var_files = {}
  2154. body_params = None
  2155. # HTTP header `Accept`
  2156. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2157. # Authentication setting
  2158. auth_settings = [] # noqa: E501
  2159. return self.api_client.call_api(
  2160. '/margin/cross/currencies/{currency}',
  2161. 'GET',
  2162. path_params,
  2163. query_params,
  2164. header_params,
  2165. body=body_params,
  2166. post_params=form_params,
  2167. files=local_var_files,
  2168. response_type='CrossMarginCurrency', # noqa: E501
  2169. auth_settings=auth_settings,
  2170. async_req=local_var_params.get('async_req'),
  2171. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2172. _preload_content=local_var_params.get('_preload_content', True),
  2173. _request_timeout=local_var_params.get('_request_timeout'),
  2174. collection_formats=collection_formats,
  2175. )
  2176. def get_cross_margin_account(self, **kwargs): # noqa: E501
  2177. """Retrieve cross margin account # noqa: E501
  2178. This method makes a synchronous HTTP request by default. To make an
  2179. asynchronous HTTP request, please pass async_req=True
  2180. >>> thread = api.get_cross_margin_account(async_req=True)
  2181. >>> result = thread.get()
  2182. :param bool async_req: execute request asynchronously
  2183. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2184. be returned without reading/decoding response
  2185. data. Default is True.
  2186. :param _request_timeout: timeout setting for this request. If one
  2187. number provided, it will be total request
  2188. timeout. It can also be a pair (tuple) of
  2189. (connection, read) timeouts.
  2190. :rtype: gate_api.CrossMarginAccount
  2191. :return: If the method is called asynchronously,
  2192. returns the request thread.
  2193. """
  2194. kwargs['_return_http_data_only'] = True
  2195. return self.get_cross_margin_account_with_http_info(**kwargs) # noqa: E501
  2196. def get_cross_margin_account_with_http_info(self, **kwargs): # noqa: E501
  2197. """Retrieve cross margin account # noqa: E501
  2198. This method makes a synchronous HTTP request by default. To make an
  2199. asynchronous HTTP request, please pass async_req=True
  2200. >>> thread = api.get_cross_margin_account_with_http_info(async_req=True)
  2201. >>> result = thread.get()
  2202. :param bool async_req: execute request asynchronously
  2203. :param _return_http_data_only: response data without head status code
  2204. and headers
  2205. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2206. be returned without reading/decoding response
  2207. data. Default is True.
  2208. :param _request_timeout: timeout setting for this request. If one
  2209. number provided, it will be total request
  2210. timeout. It can also be a pair (tuple) of
  2211. (connection, read) timeouts.
  2212. :rtype: tuple(gate_api.CrossMarginAccount, status_code(int), headers(HTTPHeaderDict))
  2213. :return: If the method is called asynchronously,
  2214. returns the request thread.
  2215. """
  2216. local_var_params = locals()
  2217. all_params = []
  2218. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2219. for k, v in six.iteritems(local_var_params['kwargs']):
  2220. if k not in all_params:
  2221. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_cross_margin_account" % k)
  2222. local_var_params[k] = v
  2223. del local_var_params['kwargs']
  2224. collection_formats = {}
  2225. path_params = {}
  2226. query_params = []
  2227. header_params = {}
  2228. form_params = []
  2229. local_var_files = {}
  2230. body_params = None
  2231. # HTTP header `Accept`
  2232. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2233. # Authentication setting
  2234. auth_settings = ['apiv4'] # noqa: E501
  2235. return self.api_client.call_api(
  2236. '/margin/cross/accounts',
  2237. 'GET',
  2238. path_params,
  2239. query_params,
  2240. header_params,
  2241. body=body_params,
  2242. post_params=form_params,
  2243. files=local_var_files,
  2244. response_type='CrossMarginAccount', # noqa: E501
  2245. auth_settings=auth_settings,
  2246. async_req=local_var_params.get('async_req'),
  2247. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2248. _preload_content=local_var_params.get('_preload_content', True),
  2249. _request_timeout=local_var_params.get('_request_timeout'),
  2250. collection_formats=collection_formats,
  2251. )
  2252. def list_cross_margin_account_book(self, **kwargs): # noqa: E501
  2253. """Retrieve cross margin account change history # noqa: E501
  2254. Record time range cannot exceed 30 days # noqa: E501
  2255. This method makes a synchronous HTTP request by default. To make an
  2256. asynchronous HTTP request, please pass async_req=True
  2257. >>> thread = api.list_cross_margin_account_book(async_req=True)
  2258. >>> result = thread.get()
  2259. :param bool async_req: execute request asynchronously
  2260. :param str currency: Filter by currency
  2261. :param int _from: Start timestamp of the query
  2262. :param int to: Time range ending, default to current time
  2263. :param int page: Page number
  2264. :param int limit: Maximum number of records to be returned in a single list
  2265. :param str type: Only retrieve changes of the specified type. All types will be returned if not specified.
  2266. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2267. be returned without reading/decoding response
  2268. data. Default is True.
  2269. :param _request_timeout: timeout setting for this request. If one
  2270. number provided, it will be total request
  2271. timeout. It can also be a pair (tuple) of
  2272. (connection, read) timeouts.
  2273. :rtype: list[gate_api.CrossMarginAccountBook]
  2274. :return: If the method is called asynchronously,
  2275. returns the request thread.
  2276. """
  2277. kwargs['_return_http_data_only'] = True
  2278. return self.list_cross_margin_account_book_with_http_info(**kwargs) # noqa: E501
  2279. def list_cross_margin_account_book_with_http_info(self, **kwargs): # noqa: E501
  2280. """Retrieve cross margin account change history # noqa: E501
  2281. Record time range cannot exceed 30 days # noqa: E501
  2282. This method makes a synchronous HTTP request by default. To make an
  2283. asynchronous HTTP request, please pass async_req=True
  2284. >>> thread = api.list_cross_margin_account_book_with_http_info(async_req=True)
  2285. >>> result = thread.get()
  2286. :param bool async_req: execute request asynchronously
  2287. :param str currency: Filter by currency
  2288. :param int _from: Start timestamp of the query
  2289. :param int to: Time range ending, default to current time
  2290. :param int page: Page number
  2291. :param int limit: Maximum number of records to be returned in a single list
  2292. :param str type: Only retrieve changes of the specified type. All types will be returned if not specified.
  2293. :param _return_http_data_only: response data without head status code
  2294. and headers
  2295. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2296. be returned without reading/decoding response
  2297. data. Default is True.
  2298. :param _request_timeout: timeout setting for this request. If one
  2299. number provided, it will be total request
  2300. timeout. It can also be a pair (tuple) of
  2301. (connection, read) timeouts.
  2302. :rtype: tuple(list[gate_api.CrossMarginAccountBook], status_code(int), headers(HTTPHeaderDict))
  2303. :return: If the method is called asynchronously,
  2304. returns the request thread.
  2305. """
  2306. local_var_params = locals()
  2307. all_params = ['currency', '_from', 'to', 'page', 'limit', 'type']
  2308. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2309. for k, v in six.iteritems(local_var_params['kwargs']):
  2310. if k not in all_params:
  2311. raise ApiTypeError(
  2312. "Got an unexpected keyword argument '%s'" " to method list_cross_margin_account_book" % k
  2313. )
  2314. local_var_params[k] = v
  2315. del local_var_params['kwargs']
  2316. if (
  2317. self.api_client.client_side_validation and 'page' in local_var_params and local_var_params['page'] < 1
  2318. ): # noqa: E501
  2319. raise ApiValueError(
  2320. "Invalid value for parameter `page` when calling `list_cross_margin_account_book`, must be a value greater than or equal to `1`"
  2321. ) # noqa: E501
  2322. if (
  2323. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  2324. ): # noqa: E501
  2325. raise ApiValueError(
  2326. "Invalid value for parameter `limit` when calling `list_cross_margin_account_book`, must be a value less than or equal to `1000`"
  2327. ) # noqa: E501
  2328. if (
  2329. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  2330. ): # noqa: E501
  2331. raise ApiValueError(
  2332. "Invalid value for parameter `limit` when calling `list_cross_margin_account_book`, must be a value greater than or equal to `1`"
  2333. ) # noqa: E501
  2334. collection_formats = {}
  2335. path_params = {}
  2336. query_params = []
  2337. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  2338. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  2339. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  2340. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  2341. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  2342. query_params.append(('to', local_var_params['to'])) # noqa: E501
  2343. if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
  2344. query_params.append(('page', local_var_params['page'])) # noqa: E501
  2345. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  2346. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  2347. if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501
  2348. query_params.append(('type', local_var_params['type'])) # noqa: E501
  2349. header_params = {}
  2350. form_params = []
  2351. local_var_files = {}
  2352. body_params = None
  2353. # HTTP header `Accept`
  2354. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2355. # Authentication setting
  2356. auth_settings = ['apiv4'] # noqa: E501
  2357. return self.api_client.call_api(
  2358. '/margin/cross/account_book',
  2359. 'GET',
  2360. path_params,
  2361. query_params,
  2362. header_params,
  2363. body=body_params,
  2364. post_params=form_params,
  2365. files=local_var_files,
  2366. response_type='list[CrossMarginAccountBook]', # noqa: E501
  2367. auth_settings=auth_settings,
  2368. async_req=local_var_params.get('async_req'),
  2369. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2370. _preload_content=local_var_params.get('_preload_content', True),
  2371. _request_timeout=local_var_params.get('_request_timeout'),
  2372. collection_formats=collection_formats,
  2373. )
  2374. def list_cross_margin_loans(self, status, **kwargs): # noqa: E501
  2375. """List cross margin borrow history # noqa: E501
  2376. Sort by creation time in descending order by default. Set `reverse=false` to return ascending results. # noqa: E501
  2377. This method makes a synchronous HTTP request by default. To make an
  2378. asynchronous HTTP request, please pass async_req=True
  2379. >>> thread = api.list_cross_margin_loans(status, async_req=True)
  2380. >>> result = thread.get()
  2381. :param bool async_req: execute request asynchronously
  2382. :param int status: Filter by status. Supported values are 2 and 3. (required)
  2383. :param str currency: Filter by currency
  2384. :param int limit: Maximum number of records to be returned in a single list
  2385. :param int offset: List offset, starting from 0
  2386. :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results
  2387. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2388. be returned without reading/decoding response
  2389. data. Default is True.
  2390. :param _request_timeout: timeout setting for this request. If one
  2391. number provided, it will be total request
  2392. timeout. It can also be a pair (tuple) of
  2393. (connection, read) timeouts.
  2394. :rtype: list[gate_api.CrossMarginLoan]
  2395. :return: If the method is called asynchronously,
  2396. returns the request thread.
  2397. """
  2398. kwargs['_return_http_data_only'] = True
  2399. return self.list_cross_margin_loans_with_http_info(status, **kwargs) # noqa: E501
  2400. def list_cross_margin_loans_with_http_info(self, status, **kwargs): # noqa: E501
  2401. """List cross margin borrow history # noqa: E501
  2402. Sort by creation time in descending order by default. Set `reverse=false` to return ascending results. # noqa: E501
  2403. This method makes a synchronous HTTP request by default. To make an
  2404. asynchronous HTTP request, please pass async_req=True
  2405. >>> thread = api.list_cross_margin_loans_with_http_info(status, async_req=True)
  2406. >>> result = thread.get()
  2407. :param bool async_req: execute request asynchronously
  2408. :param int status: Filter by status. Supported values are 2 and 3. (required)
  2409. :param str currency: Filter by currency
  2410. :param int limit: Maximum number of records to be returned in a single list
  2411. :param int offset: List offset, starting from 0
  2412. :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results
  2413. :param _return_http_data_only: response data without head status code
  2414. and headers
  2415. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2416. be returned without reading/decoding response
  2417. data. Default is True.
  2418. :param _request_timeout: timeout setting for this request. If one
  2419. number provided, it will be total request
  2420. timeout. It can also be a pair (tuple) of
  2421. (connection, read) timeouts.
  2422. :rtype: tuple(list[gate_api.CrossMarginLoan], status_code(int), headers(HTTPHeaderDict))
  2423. :return: If the method is called asynchronously,
  2424. returns the request thread.
  2425. """
  2426. local_var_params = locals()
  2427. all_params = ['status', 'currency', 'limit', 'offset', 'reverse']
  2428. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2429. for k, v in six.iteritems(local_var_params['kwargs']):
  2430. if k not in all_params:
  2431. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_cross_margin_loans" % k)
  2432. local_var_params[k] = v
  2433. del local_var_params['kwargs']
  2434. # verify the required parameter 'status' is set
  2435. if self.api_client.client_side_validation and (
  2436. 'status' not in local_var_params or local_var_params['status'] is None # noqa: E501
  2437. ): # noqa: E501
  2438. raise ApiValueError(
  2439. "Missing the required parameter `status` when calling `list_cross_margin_loans`"
  2440. ) # noqa: E501
  2441. if (
  2442. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  2443. ): # noqa: E501
  2444. raise ApiValueError(
  2445. "Invalid value for parameter `limit` when calling `list_cross_margin_loans`, must be a value less than or equal to `1000`"
  2446. ) # noqa: E501
  2447. if (
  2448. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  2449. ): # noqa: E501
  2450. raise ApiValueError(
  2451. "Invalid value for parameter `limit` when calling `list_cross_margin_loans`, must be a value greater than or equal to `1`"
  2452. ) # noqa: E501
  2453. if (
  2454. self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0
  2455. ): # noqa: E501
  2456. raise ApiValueError(
  2457. "Invalid value for parameter `offset` when calling `list_cross_margin_loans`, must be a value greater than or equal to `0`"
  2458. ) # noqa: E501
  2459. collection_formats = {}
  2460. path_params = {}
  2461. query_params = []
  2462. if 'status' in local_var_params and local_var_params['status'] is not None: # noqa: E501
  2463. query_params.append(('status', local_var_params['status'])) # noqa: E501
  2464. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  2465. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  2466. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  2467. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  2468. if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501
  2469. query_params.append(('offset', local_var_params['offset'])) # noqa: E501
  2470. if 'reverse' in local_var_params and local_var_params['reverse'] is not None: # noqa: E501
  2471. query_params.append(('reverse', local_var_params['reverse'])) # noqa: E501
  2472. header_params = {}
  2473. form_params = []
  2474. local_var_files = {}
  2475. body_params = None
  2476. # HTTP header `Accept`
  2477. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2478. # Authentication setting
  2479. auth_settings = ['apiv4'] # noqa: E501
  2480. return self.api_client.call_api(
  2481. '/margin/cross/loans',
  2482. 'GET',
  2483. path_params,
  2484. query_params,
  2485. header_params,
  2486. body=body_params,
  2487. post_params=form_params,
  2488. files=local_var_files,
  2489. response_type='list[CrossMarginLoan]', # noqa: E501
  2490. auth_settings=auth_settings,
  2491. async_req=local_var_params.get('async_req'),
  2492. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2493. _preload_content=local_var_params.get('_preload_content', True),
  2494. _request_timeout=local_var_params.get('_request_timeout'),
  2495. collection_formats=collection_formats,
  2496. )
  2497. def create_cross_margin_loan(self, cross_margin_loan, **kwargs): # noqa: E501
  2498. """Create a cross margin borrow loan # noqa: E501
  2499. Borrow amount cannot be less than currency minimum borrow amount # noqa: E501
  2500. This method makes a synchronous HTTP request by default. To make an
  2501. asynchronous HTTP request, please pass async_req=True
  2502. >>> thread = api.create_cross_margin_loan(cross_margin_loan, async_req=True)
  2503. >>> result = thread.get()
  2504. :param bool async_req: execute request asynchronously
  2505. :param CrossMarginLoan cross_margin_loan: (required)
  2506. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2507. be returned without reading/decoding response
  2508. data. Default is True.
  2509. :param _request_timeout: timeout setting for this request. If one
  2510. number provided, it will be total request
  2511. timeout. It can also be a pair (tuple) of
  2512. (connection, read) timeouts.
  2513. :rtype: gate_api.CrossMarginLoan
  2514. :return: If the method is called asynchronously,
  2515. returns the request thread.
  2516. """
  2517. kwargs['_return_http_data_only'] = True
  2518. return self.create_cross_margin_loan_with_http_info(cross_margin_loan, **kwargs) # noqa: E501
  2519. def create_cross_margin_loan_with_http_info(self, cross_margin_loan, **kwargs): # noqa: E501
  2520. """Create a cross margin borrow loan # noqa: E501
  2521. Borrow amount cannot be less than currency minimum borrow amount # noqa: E501
  2522. This method makes a synchronous HTTP request by default. To make an
  2523. asynchronous HTTP request, please pass async_req=True
  2524. >>> thread = api.create_cross_margin_loan_with_http_info(cross_margin_loan, async_req=True)
  2525. >>> result = thread.get()
  2526. :param bool async_req: execute request asynchronously
  2527. :param CrossMarginLoan cross_margin_loan: (required)
  2528. :param _return_http_data_only: response data without head status code
  2529. and headers
  2530. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2531. be returned without reading/decoding response
  2532. data. Default is True.
  2533. :param _request_timeout: timeout setting for this request. If one
  2534. number provided, it will be total request
  2535. timeout. It can also be a pair (tuple) of
  2536. (connection, read) timeouts.
  2537. :rtype: tuple(gate_api.CrossMarginLoan, status_code(int), headers(HTTPHeaderDict))
  2538. :return: If the method is called asynchronously,
  2539. returns the request thread.
  2540. """
  2541. local_var_params = locals()
  2542. all_params = ['cross_margin_loan']
  2543. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2544. for k, v in six.iteritems(local_var_params['kwargs']):
  2545. if k not in all_params:
  2546. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_cross_margin_loan" % k)
  2547. local_var_params[k] = v
  2548. del local_var_params['kwargs']
  2549. # verify the required parameter 'cross_margin_loan' is set
  2550. if self.api_client.client_side_validation and (
  2551. 'cross_margin_loan' not in local_var_params or local_var_params['cross_margin_loan'] is None # noqa: E501
  2552. ): # noqa: E501
  2553. raise ApiValueError(
  2554. "Missing the required parameter `cross_margin_loan` when calling `create_cross_margin_loan`"
  2555. ) # noqa: E501
  2556. collection_formats = {}
  2557. path_params = {}
  2558. query_params = []
  2559. header_params = {}
  2560. form_params = []
  2561. local_var_files = {}
  2562. body_params = None
  2563. if 'cross_margin_loan' in local_var_params:
  2564. body_params = local_var_params['cross_margin_loan']
  2565. # HTTP header `Accept`
  2566. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2567. # HTTP header `Content-Type`
  2568. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  2569. ['application/json']
  2570. ) # noqa: E501
  2571. # Authentication setting
  2572. auth_settings = ['apiv4'] # noqa: E501
  2573. return self.api_client.call_api(
  2574. '/margin/cross/loans',
  2575. 'POST',
  2576. path_params,
  2577. query_params,
  2578. header_params,
  2579. body=body_params,
  2580. post_params=form_params,
  2581. files=local_var_files,
  2582. response_type='CrossMarginLoan', # noqa: E501
  2583. auth_settings=auth_settings,
  2584. async_req=local_var_params.get('async_req'),
  2585. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2586. _preload_content=local_var_params.get('_preload_content', True),
  2587. _request_timeout=local_var_params.get('_request_timeout'),
  2588. collection_formats=collection_formats,
  2589. )
  2590. def get_cross_margin_loan(self, loan_id, **kwargs): # noqa: E501
  2591. """Retrieve single borrow loan detail # noqa: E501
  2592. This method makes a synchronous HTTP request by default. To make an
  2593. asynchronous HTTP request, please pass async_req=True
  2594. >>> thread = api.get_cross_margin_loan(loan_id, async_req=True)
  2595. >>> result = thread.get()
  2596. :param bool async_req: execute request asynchronously
  2597. :param str loan_id: Borrow loan ID (required)
  2598. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2599. be returned without reading/decoding response
  2600. data. Default is True.
  2601. :param _request_timeout: timeout setting for this request. If one
  2602. number provided, it will be total request
  2603. timeout. It can also be a pair (tuple) of
  2604. (connection, read) timeouts.
  2605. :rtype: gate_api.CrossMarginLoan
  2606. :return: If the method is called asynchronously,
  2607. returns the request thread.
  2608. """
  2609. kwargs['_return_http_data_only'] = True
  2610. return self.get_cross_margin_loan_with_http_info(loan_id, **kwargs) # noqa: E501
  2611. def get_cross_margin_loan_with_http_info(self, loan_id, **kwargs): # noqa: E501
  2612. """Retrieve single borrow loan detail # noqa: E501
  2613. This method makes a synchronous HTTP request by default. To make an
  2614. asynchronous HTTP request, please pass async_req=True
  2615. >>> thread = api.get_cross_margin_loan_with_http_info(loan_id, async_req=True)
  2616. >>> result = thread.get()
  2617. :param bool async_req: execute request asynchronously
  2618. :param str loan_id: Borrow loan ID (required)
  2619. :param _return_http_data_only: response data without head status code
  2620. and headers
  2621. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2622. be returned without reading/decoding response
  2623. data. Default is True.
  2624. :param _request_timeout: timeout setting for this request. If one
  2625. number provided, it will be total request
  2626. timeout. It can also be a pair (tuple) of
  2627. (connection, read) timeouts.
  2628. :rtype: tuple(gate_api.CrossMarginLoan, status_code(int), headers(HTTPHeaderDict))
  2629. :return: If the method is called asynchronously,
  2630. returns the request thread.
  2631. """
  2632. local_var_params = locals()
  2633. all_params = ['loan_id']
  2634. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2635. for k, v in six.iteritems(local_var_params['kwargs']):
  2636. if k not in all_params:
  2637. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_cross_margin_loan" % k)
  2638. local_var_params[k] = v
  2639. del local_var_params['kwargs']
  2640. # verify the required parameter 'loan_id' is set
  2641. if self.api_client.client_side_validation and (
  2642. 'loan_id' not in local_var_params or local_var_params['loan_id'] is None # noqa: E501
  2643. ): # noqa: E501
  2644. raise ApiValueError(
  2645. "Missing the required parameter `loan_id` when calling `get_cross_margin_loan`"
  2646. ) # noqa: E501
  2647. collection_formats = {}
  2648. path_params = {}
  2649. if 'loan_id' in local_var_params:
  2650. path_params['loan_id'] = local_var_params['loan_id'] # noqa: E501
  2651. query_params = []
  2652. header_params = {}
  2653. form_params = []
  2654. local_var_files = {}
  2655. body_params = None
  2656. # HTTP header `Accept`
  2657. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2658. # Authentication setting
  2659. auth_settings = ['apiv4'] # noqa: E501
  2660. return self.api_client.call_api(
  2661. '/margin/cross/loans/{loan_id}',
  2662. 'GET',
  2663. path_params,
  2664. query_params,
  2665. header_params,
  2666. body=body_params,
  2667. post_params=form_params,
  2668. files=local_var_files,
  2669. response_type='CrossMarginLoan', # noqa: E501
  2670. auth_settings=auth_settings,
  2671. async_req=local_var_params.get('async_req'),
  2672. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2673. _preload_content=local_var_params.get('_preload_content', True),
  2674. _request_timeout=local_var_params.get('_request_timeout'),
  2675. collection_formats=collection_formats,
  2676. )
  2677. def list_cross_margin_repayments(self, **kwargs): # noqa: E501
  2678. """Retrieve cross margin repayments # noqa: E501
  2679. Sort by creation time in descending order by default. Set `reverse=false` to return ascending results. # noqa: E501
  2680. This method makes a synchronous HTTP request by default. To make an
  2681. asynchronous HTTP request, please pass async_req=True
  2682. >>> thread = api.list_cross_margin_repayments(async_req=True)
  2683. >>> result = thread.get()
  2684. :param bool async_req: execute request asynchronously
  2685. :param str currency:
  2686. :param str loan_id:
  2687. :param int limit: Maximum number of records to be returned in a single list
  2688. :param int offset: List offset, starting from 0
  2689. :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results
  2690. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2691. be returned without reading/decoding response
  2692. data. Default is True.
  2693. :param _request_timeout: timeout setting for this request. If one
  2694. number provided, it will be total request
  2695. timeout. It can also be a pair (tuple) of
  2696. (connection, read) timeouts.
  2697. :rtype: list[gate_api.CrossMarginRepayment]
  2698. :return: If the method is called asynchronously,
  2699. returns the request thread.
  2700. """
  2701. kwargs['_return_http_data_only'] = True
  2702. return self.list_cross_margin_repayments_with_http_info(**kwargs) # noqa: E501
  2703. def list_cross_margin_repayments_with_http_info(self, **kwargs): # noqa: E501
  2704. """Retrieve cross margin repayments # noqa: E501
  2705. Sort by creation time in descending order by default. Set `reverse=false` to return ascending results. # noqa: E501
  2706. This method makes a synchronous HTTP request by default. To make an
  2707. asynchronous HTTP request, please pass async_req=True
  2708. >>> thread = api.list_cross_margin_repayments_with_http_info(async_req=True)
  2709. >>> result = thread.get()
  2710. :param bool async_req: execute request asynchronously
  2711. :param str currency:
  2712. :param str loan_id:
  2713. :param int limit: Maximum number of records to be returned in a single list
  2714. :param int offset: List offset, starting from 0
  2715. :param bool reverse: Whether to sort in descending order, which is the default. Set `reverse=false` to return ascending results
  2716. :param _return_http_data_only: response data without head status code
  2717. and headers
  2718. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2719. be returned without reading/decoding response
  2720. data. Default is True.
  2721. :param _request_timeout: timeout setting for this request. If one
  2722. number provided, it will be total request
  2723. timeout. It can also be a pair (tuple) of
  2724. (connection, read) timeouts.
  2725. :rtype: tuple(list[gate_api.CrossMarginRepayment], status_code(int), headers(HTTPHeaderDict))
  2726. :return: If the method is called asynchronously,
  2727. returns the request thread.
  2728. """
  2729. local_var_params = locals()
  2730. all_params = ['currency', 'loan_id', 'limit', 'offset', 'reverse']
  2731. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2732. for k, v in six.iteritems(local_var_params['kwargs']):
  2733. if k not in all_params:
  2734. raise ApiTypeError(
  2735. "Got an unexpected keyword argument '%s'" " to method list_cross_margin_repayments" % k
  2736. )
  2737. local_var_params[k] = v
  2738. del local_var_params['kwargs']
  2739. if (
  2740. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  2741. ): # noqa: E501
  2742. raise ApiValueError(
  2743. "Invalid value for parameter `limit` when calling `list_cross_margin_repayments`, must be a value less than or equal to `1000`"
  2744. ) # noqa: E501
  2745. if (
  2746. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  2747. ): # noqa: E501
  2748. raise ApiValueError(
  2749. "Invalid value for parameter `limit` when calling `list_cross_margin_repayments`, must be a value greater than or equal to `1`"
  2750. ) # noqa: E501
  2751. if (
  2752. self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0
  2753. ): # noqa: E501
  2754. raise ApiValueError(
  2755. "Invalid value for parameter `offset` when calling `list_cross_margin_repayments`, must be a value greater than or equal to `0`"
  2756. ) # noqa: E501
  2757. collection_formats = {}
  2758. path_params = {}
  2759. query_params = []
  2760. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  2761. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  2762. if 'loan_id' in local_var_params and local_var_params['loan_id'] is not None: # noqa: E501
  2763. query_params.append(('loan_id', local_var_params['loan_id'])) # noqa: E501
  2764. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  2765. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  2766. if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501
  2767. query_params.append(('offset', local_var_params['offset'])) # noqa: E501
  2768. if 'reverse' in local_var_params and local_var_params['reverse'] is not None: # noqa: E501
  2769. query_params.append(('reverse', local_var_params['reverse'])) # noqa: E501
  2770. header_params = {}
  2771. form_params = []
  2772. local_var_files = {}
  2773. body_params = None
  2774. # HTTP header `Accept`
  2775. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2776. # Authentication setting
  2777. auth_settings = ['apiv4'] # noqa: E501
  2778. return self.api_client.call_api(
  2779. '/margin/cross/repayments',
  2780. 'GET',
  2781. path_params,
  2782. query_params,
  2783. header_params,
  2784. body=body_params,
  2785. post_params=form_params,
  2786. files=local_var_files,
  2787. response_type='list[CrossMarginRepayment]', # noqa: E501
  2788. auth_settings=auth_settings,
  2789. async_req=local_var_params.get('async_req'),
  2790. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2791. _preload_content=local_var_params.get('_preload_content', True),
  2792. _request_timeout=local_var_params.get('_request_timeout'),
  2793. collection_formats=collection_formats,
  2794. )
  2795. def repay_cross_margin_loan(self, cross_margin_repay_request, **kwargs): # noqa: E501
  2796. """Cross margin repayments # noqa: E501
  2797. When the liquidity of the currency is insufficient and the transaction risk is high, the currency will be disabled, and funds cannot be transferred.When the available balance of cross-margin is insufficient, the balance of the spot account can be used for repayment. Please ensure that the balance of the spot account is sufficient, and system uses cross-margin account for repayment first # noqa: E501
  2798. This method makes a synchronous HTTP request by default. To make an
  2799. asynchronous HTTP request, please pass async_req=True
  2800. >>> thread = api.repay_cross_margin_loan(cross_margin_repay_request, async_req=True)
  2801. >>> result = thread.get()
  2802. :param bool async_req: execute request asynchronously
  2803. :param CrossMarginRepayRequest cross_margin_repay_request: (required)
  2804. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2805. be returned without reading/decoding response
  2806. data. Default is True.
  2807. :param _request_timeout: timeout setting for this request. If one
  2808. number provided, it will be total request
  2809. timeout. It can also be a pair (tuple) of
  2810. (connection, read) timeouts.
  2811. :rtype: list[gate_api.CrossMarginLoan]
  2812. :return: If the method is called asynchronously,
  2813. returns the request thread.
  2814. """
  2815. kwargs['_return_http_data_only'] = True
  2816. return self.repay_cross_margin_loan_with_http_info(cross_margin_repay_request, **kwargs) # noqa: E501
  2817. def repay_cross_margin_loan_with_http_info(self, cross_margin_repay_request, **kwargs): # noqa: E501
  2818. """Cross margin repayments # noqa: E501
  2819. When the liquidity of the currency is insufficient and the transaction risk is high, the currency will be disabled, and funds cannot be transferred.When the available balance of cross-margin is insufficient, the balance of the spot account can be used for repayment. Please ensure that the balance of the spot account is sufficient, and system uses cross-margin account for repayment first # noqa: E501
  2820. This method makes a synchronous HTTP request by default. To make an
  2821. asynchronous HTTP request, please pass async_req=True
  2822. >>> thread = api.repay_cross_margin_loan_with_http_info(cross_margin_repay_request, async_req=True)
  2823. >>> result = thread.get()
  2824. :param bool async_req: execute request asynchronously
  2825. :param CrossMarginRepayRequest cross_margin_repay_request: (required)
  2826. :param _return_http_data_only: response data without head status code
  2827. and headers
  2828. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2829. be returned without reading/decoding response
  2830. data. Default is True.
  2831. :param _request_timeout: timeout setting for this request. If one
  2832. number provided, it will be total request
  2833. timeout. It can also be a pair (tuple) of
  2834. (connection, read) timeouts.
  2835. :rtype: tuple(list[gate_api.CrossMarginLoan], status_code(int), headers(HTTPHeaderDict))
  2836. :return: If the method is called asynchronously,
  2837. returns the request thread.
  2838. """
  2839. local_var_params = locals()
  2840. all_params = ['cross_margin_repay_request']
  2841. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2842. for k, v in six.iteritems(local_var_params['kwargs']):
  2843. if k not in all_params:
  2844. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method repay_cross_margin_loan" % k)
  2845. local_var_params[k] = v
  2846. del local_var_params['kwargs']
  2847. # verify the required parameter 'cross_margin_repay_request' is set
  2848. if self.api_client.client_side_validation and (
  2849. 'cross_margin_repay_request' not in local_var_params
  2850. or local_var_params['cross_margin_repay_request'] is None # noqa: E501
  2851. ): # noqa: E501
  2852. raise ApiValueError(
  2853. "Missing the required parameter `cross_margin_repay_request` when calling `repay_cross_margin_loan`"
  2854. ) # noqa: E501
  2855. collection_formats = {}
  2856. path_params = {}
  2857. query_params = []
  2858. header_params = {}
  2859. form_params = []
  2860. local_var_files = {}
  2861. body_params = None
  2862. if 'cross_margin_repay_request' in local_var_params:
  2863. body_params = local_var_params['cross_margin_repay_request']
  2864. # HTTP header `Accept`
  2865. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2866. # HTTP header `Content-Type`
  2867. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  2868. ['application/json']
  2869. ) # noqa: E501
  2870. # Authentication setting
  2871. auth_settings = ['apiv4'] # noqa: E501
  2872. return self.api_client.call_api(
  2873. '/margin/cross/repayments',
  2874. 'POST',
  2875. path_params,
  2876. query_params,
  2877. header_params,
  2878. body=body_params,
  2879. post_params=form_params,
  2880. files=local_var_files,
  2881. response_type='list[CrossMarginLoan]', # noqa: E501
  2882. auth_settings=auth_settings,
  2883. async_req=local_var_params.get('async_req'),
  2884. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2885. _preload_content=local_var_params.get('_preload_content', True),
  2886. _request_timeout=local_var_params.get('_request_timeout'),
  2887. collection_formats=collection_formats,
  2888. )
  2889. def get_cross_margin_transferable(self, currency, **kwargs): # noqa: E501
  2890. """Get the max transferable amount for a specific cross margin currency # noqa: E501
  2891. This method makes a synchronous HTTP request by default. To make an
  2892. asynchronous HTTP request, please pass async_req=True
  2893. >>> thread = api.get_cross_margin_transferable(currency, async_req=True)
  2894. >>> result = thread.get()
  2895. :param bool async_req: execute request asynchronously
  2896. :param str currency: Retrieve data of the specified currency (required)
  2897. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2898. be returned without reading/decoding response
  2899. data. Default is True.
  2900. :param _request_timeout: timeout setting for this request. If one
  2901. number provided, it will be total request
  2902. timeout. It can also be a pair (tuple) of
  2903. (connection, read) timeouts.
  2904. :rtype: gate_api.CrossMarginTransferable
  2905. :return: If the method is called asynchronously,
  2906. returns the request thread.
  2907. """
  2908. kwargs['_return_http_data_only'] = True
  2909. return self.get_cross_margin_transferable_with_http_info(currency, **kwargs) # noqa: E501
  2910. def get_cross_margin_transferable_with_http_info(self, currency, **kwargs): # noqa: E501
  2911. """Get the max transferable amount for a specific cross margin currency # noqa: E501
  2912. This method makes a synchronous HTTP request by default. To make an
  2913. asynchronous HTTP request, please pass async_req=True
  2914. >>> thread = api.get_cross_margin_transferable_with_http_info(currency, async_req=True)
  2915. >>> result = thread.get()
  2916. :param bool async_req: execute request asynchronously
  2917. :param str currency: Retrieve data of the specified currency (required)
  2918. :param _return_http_data_only: response data without head status code
  2919. and headers
  2920. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2921. be returned without reading/decoding response
  2922. data. Default is True.
  2923. :param _request_timeout: timeout setting for this request. If one
  2924. number provided, it will be total request
  2925. timeout. It can also be a pair (tuple) of
  2926. (connection, read) timeouts.
  2927. :rtype: tuple(gate_api.CrossMarginTransferable, status_code(int), headers(HTTPHeaderDict))
  2928. :return: If the method is called asynchronously,
  2929. returns the request thread.
  2930. """
  2931. local_var_params = locals()
  2932. all_params = ['currency']
  2933. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2934. for k, v in six.iteritems(local_var_params['kwargs']):
  2935. if k not in all_params:
  2936. raise ApiTypeError(
  2937. "Got an unexpected keyword argument '%s'" " to method get_cross_margin_transferable" % k
  2938. )
  2939. local_var_params[k] = v
  2940. del local_var_params['kwargs']
  2941. # verify the required parameter 'currency' is set
  2942. if self.api_client.client_side_validation and (
  2943. 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501
  2944. ): # noqa: E501
  2945. raise ApiValueError(
  2946. "Missing the required parameter `currency` when calling `get_cross_margin_transferable`"
  2947. ) # noqa: E501
  2948. collection_formats = {}
  2949. path_params = {}
  2950. query_params = []
  2951. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  2952. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  2953. header_params = {}
  2954. form_params = []
  2955. local_var_files = {}
  2956. body_params = None
  2957. # HTTP header `Accept`
  2958. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2959. # Authentication setting
  2960. auth_settings = ['apiv4'] # noqa: E501
  2961. return self.api_client.call_api(
  2962. '/margin/cross/transferable',
  2963. 'GET',
  2964. path_params,
  2965. query_params,
  2966. header_params,
  2967. body=body_params,
  2968. post_params=form_params,
  2969. files=local_var_files,
  2970. response_type='CrossMarginTransferable', # noqa: E501
  2971. auth_settings=auth_settings,
  2972. async_req=local_var_params.get('async_req'),
  2973. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2974. _preload_content=local_var_params.get('_preload_content', True),
  2975. _request_timeout=local_var_params.get('_request_timeout'),
  2976. collection_formats=collection_formats,
  2977. )
  2978. def get_cross_margin_borrowable(self, currency, **kwargs): # noqa: E501
  2979. """Get the max borrowable amount for a specific cross margin currency # noqa: E501
  2980. This method makes a synchronous HTTP request by default. To make an
  2981. asynchronous HTTP request, please pass async_req=True
  2982. >>> thread = api.get_cross_margin_borrowable(currency, async_req=True)
  2983. >>> result = thread.get()
  2984. :param bool async_req: execute request asynchronously
  2985. :param str currency: Retrieve data of the specified currency (required)
  2986. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2987. be returned without reading/decoding response
  2988. data. Default is True.
  2989. :param _request_timeout: timeout setting for this request. If one
  2990. number provided, it will be total request
  2991. timeout. It can also be a pair (tuple) of
  2992. (connection, read) timeouts.
  2993. :rtype: gate_api.CrossMarginBorrowable
  2994. :return: If the method is called asynchronously,
  2995. returns the request thread.
  2996. """
  2997. kwargs['_return_http_data_only'] = True
  2998. return self.get_cross_margin_borrowable_with_http_info(currency, **kwargs) # noqa: E501
  2999. def get_cross_margin_borrowable_with_http_info(self, currency, **kwargs): # noqa: E501
  3000. """Get the max borrowable amount for a specific cross margin currency # noqa: E501
  3001. This method makes a synchronous HTTP request by default. To make an
  3002. asynchronous HTTP request, please pass async_req=True
  3003. >>> thread = api.get_cross_margin_borrowable_with_http_info(currency, async_req=True)
  3004. >>> result = thread.get()
  3005. :param bool async_req: execute request asynchronously
  3006. :param str currency: Retrieve data of the specified currency (required)
  3007. :param _return_http_data_only: response data without head status code
  3008. and headers
  3009. :param _preload_content: if False, the urllib3.HTTPResponse object will
  3010. be returned without reading/decoding response
  3011. data. Default is True.
  3012. :param _request_timeout: timeout setting for this request. If one
  3013. number provided, it will be total request
  3014. timeout. It can also be a pair (tuple) of
  3015. (connection, read) timeouts.
  3016. :rtype: tuple(gate_api.CrossMarginBorrowable, status_code(int), headers(HTTPHeaderDict))
  3017. :return: If the method is called asynchronously,
  3018. returns the request thread.
  3019. """
  3020. local_var_params = locals()
  3021. all_params = ['currency']
  3022. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  3023. for k, v in six.iteritems(local_var_params['kwargs']):
  3024. if k not in all_params:
  3025. raise ApiTypeError(
  3026. "Got an unexpected keyword argument '%s'" " to method get_cross_margin_borrowable" % k
  3027. )
  3028. local_var_params[k] = v
  3029. del local_var_params['kwargs']
  3030. # verify the required parameter 'currency' is set
  3031. if self.api_client.client_side_validation and (
  3032. 'currency' not in local_var_params or local_var_params['currency'] is None # noqa: E501
  3033. ): # noqa: E501
  3034. raise ApiValueError(
  3035. "Missing the required parameter `currency` when calling `get_cross_margin_borrowable`"
  3036. ) # noqa: E501
  3037. collection_formats = {}
  3038. path_params = {}
  3039. query_params = []
  3040. if 'currency' in local_var_params and local_var_params['currency'] is not None: # noqa: E501
  3041. query_params.append(('currency', local_var_params['currency'])) # noqa: E501
  3042. header_params = {}
  3043. form_params = []
  3044. local_var_files = {}
  3045. body_params = None
  3046. # HTTP header `Accept`
  3047. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  3048. # Authentication setting
  3049. auth_settings = ['apiv4'] # noqa: E501
  3050. return self.api_client.call_api(
  3051. '/margin/cross/borrowable',
  3052. 'GET',
  3053. path_params,
  3054. query_params,
  3055. header_params,
  3056. body=body_params,
  3057. post_params=form_params,
  3058. files=local_var_files,
  3059. response_type='CrossMarginBorrowable', # noqa: E501
  3060. auth_settings=auth_settings,
  3061. async_req=local_var_params.get('async_req'),
  3062. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  3063. _preload_content=local_var_params.get('_preload_content', True),
  3064. _request_timeout=local_var_params.get('_request_timeout'),
  3065. collection_formats=collection_formats,
  3066. )