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

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