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

2837 lines
139 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 OptionsApi(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_options_underlyings(self, **kwargs): # noqa: E501
  24. """List all underlyings # 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_options_underlyings(async_req=True)
  28. >>> result = thread.get()
  29. :param bool async_req: execute request asynchronously
  30. :param _preload_content: if False, the urllib3.HTTPResponse object will
  31. be returned without reading/decoding response
  32. data. Default is True.
  33. :param _request_timeout: timeout setting for this request. If one
  34. number provided, it will be total request
  35. timeout. It can also be a pair (tuple) of
  36. (connection, read) timeouts.
  37. :rtype: list[gate_api.OptionsUnderlying]
  38. :return: If the method is called asynchronously,
  39. returns the request thread.
  40. """
  41. kwargs['_return_http_data_only'] = True
  42. return self.list_options_underlyings_with_http_info(**kwargs) # noqa: E501
  43. def list_options_underlyings_with_http_info(self, **kwargs): # noqa: E501
  44. """List all underlyings # noqa: E501
  45. This method makes a synchronous HTTP request by default. To make an
  46. asynchronous HTTP request, please pass async_req=True
  47. >>> thread = api.list_options_underlyings_with_http_info(async_req=True)
  48. >>> result = thread.get()
  49. :param bool async_req: execute request asynchronously
  50. :param _return_http_data_only: response data without head status code
  51. and headers
  52. :param _preload_content: if False, the urllib3.HTTPResponse object will
  53. be returned without reading/decoding response
  54. data. Default is True.
  55. :param _request_timeout: timeout setting for this request. If one
  56. number provided, it will be total request
  57. timeout. It can also be a pair (tuple) of
  58. (connection, read) timeouts.
  59. :rtype: tuple(list[gate_api.OptionsUnderlying], status_code(int), headers(HTTPHeaderDict))
  60. :return: If the method is called asynchronously,
  61. returns the request thread.
  62. """
  63. local_var_params = locals()
  64. all_params = []
  65. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  66. for k, v in six.iteritems(local_var_params['kwargs']):
  67. if k not in all_params:
  68. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_underlyings" % k)
  69. local_var_params[k] = v
  70. del local_var_params['kwargs']
  71. collection_formats = {}
  72. path_params = {}
  73. query_params = []
  74. header_params = {}
  75. form_params = []
  76. local_var_files = {}
  77. body_params = None
  78. # HTTP header `Accept`
  79. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  80. # Authentication setting
  81. auth_settings = [] # noqa: E501
  82. return self.api_client.call_api(
  83. '/options/underlyings',
  84. 'GET',
  85. path_params,
  86. query_params,
  87. header_params,
  88. body=body_params,
  89. post_params=form_params,
  90. files=local_var_files,
  91. response_type='list[OptionsUnderlying]', # noqa: E501
  92. auth_settings=auth_settings,
  93. async_req=local_var_params.get('async_req'),
  94. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  95. _preload_content=local_var_params.get('_preload_content', True),
  96. _request_timeout=local_var_params.get('_request_timeout'),
  97. collection_formats=collection_formats,
  98. )
  99. def list_options_expirations(self, underlying, **kwargs): # noqa: E501
  100. """List all expiration times # noqa: E501
  101. This method makes a synchronous HTTP request by default. To make an
  102. asynchronous HTTP request, please pass async_req=True
  103. >>> thread = api.list_options_expirations(underlying, async_req=True)
  104. >>> result = thread.get()
  105. :param bool async_req: execute request asynchronously
  106. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  107. :param _preload_content: if False, the urllib3.HTTPResponse object will
  108. be returned without reading/decoding response
  109. data. Default is True.
  110. :param _request_timeout: timeout setting for this request. If one
  111. number provided, it will be total request
  112. timeout. It can also be a pair (tuple) of
  113. (connection, read) timeouts.
  114. :rtype: list[int]
  115. :return: If the method is called asynchronously,
  116. returns the request thread.
  117. """
  118. kwargs['_return_http_data_only'] = True
  119. return self.list_options_expirations_with_http_info(underlying, **kwargs) # noqa: E501
  120. def list_options_expirations_with_http_info(self, underlying, **kwargs): # noqa: E501
  121. """List all expiration times # noqa: E501
  122. This method makes a synchronous HTTP request by default. To make an
  123. asynchronous HTTP request, please pass async_req=True
  124. >>> thread = api.list_options_expirations_with_http_info(underlying, async_req=True)
  125. >>> result = thread.get()
  126. :param bool async_req: execute request asynchronously
  127. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  128. :param _return_http_data_only: response data without head status code
  129. and headers
  130. :param _preload_content: if False, the urllib3.HTTPResponse object will
  131. be returned without reading/decoding response
  132. data. Default is True.
  133. :param _request_timeout: timeout setting for this request. If one
  134. number provided, it will be total request
  135. timeout. It can also be a pair (tuple) of
  136. (connection, read) timeouts.
  137. :rtype: tuple(list[int], status_code(int), headers(HTTPHeaderDict))
  138. :return: If the method is called asynchronously,
  139. returns the request thread.
  140. """
  141. local_var_params = locals()
  142. all_params = ['underlying']
  143. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  144. for k, v in six.iteritems(local_var_params['kwargs']):
  145. if k not in all_params:
  146. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_expirations" % k)
  147. local_var_params[k] = v
  148. del local_var_params['kwargs']
  149. # verify the required parameter 'underlying' is set
  150. if self.api_client.client_side_validation and (
  151. 'underlying' not in local_var_params or local_var_params['underlying'] is None # noqa: E501
  152. ): # noqa: E501
  153. raise ApiValueError(
  154. "Missing the required parameter `underlying` when calling `list_options_expirations`"
  155. ) # noqa: E501
  156. collection_formats = {}
  157. path_params = {}
  158. query_params = []
  159. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  160. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  161. header_params = {}
  162. form_params = []
  163. local_var_files = {}
  164. body_params = None
  165. # HTTP header `Accept`
  166. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  167. # Authentication setting
  168. auth_settings = [] # noqa: E501
  169. return self.api_client.call_api(
  170. '/options/expirations',
  171. 'GET',
  172. path_params,
  173. query_params,
  174. header_params,
  175. body=body_params,
  176. post_params=form_params,
  177. files=local_var_files,
  178. response_type='list[int]', # noqa: E501
  179. auth_settings=auth_settings,
  180. async_req=local_var_params.get('async_req'),
  181. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  182. _preload_content=local_var_params.get('_preload_content', True),
  183. _request_timeout=local_var_params.get('_request_timeout'),
  184. collection_formats=collection_formats,
  185. )
  186. def list_options_contracts(self, underlying, **kwargs): # noqa: E501
  187. """List all the contracts with specified underlying and expiration time # noqa: E501
  188. This method makes a synchronous HTTP request by default. To make an
  189. asynchronous HTTP request, please pass async_req=True
  190. >>> thread = api.list_options_contracts(underlying, async_req=True)
  191. >>> result = thread.get()
  192. :param bool async_req: execute request asynchronously
  193. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  194. :param int expiration: Unix timestamp of the expiration time
  195. :param _preload_content: if False, the urllib3.HTTPResponse object will
  196. be returned without reading/decoding response
  197. data. Default is True.
  198. :param _request_timeout: timeout setting for this request. If one
  199. number provided, it will be total request
  200. timeout. It can also be a pair (tuple) of
  201. (connection, read) timeouts.
  202. :rtype: list[gate_api.OptionsContract]
  203. :return: If the method is called asynchronously,
  204. returns the request thread.
  205. """
  206. kwargs['_return_http_data_only'] = True
  207. return self.list_options_contracts_with_http_info(underlying, **kwargs) # noqa: E501
  208. def list_options_contracts_with_http_info(self, underlying, **kwargs): # noqa: E501
  209. """List all the contracts with specified underlying and expiration time # noqa: E501
  210. This method makes a synchronous HTTP request by default. To make an
  211. asynchronous HTTP request, please pass async_req=True
  212. >>> thread = api.list_options_contracts_with_http_info(underlying, async_req=True)
  213. >>> result = thread.get()
  214. :param bool async_req: execute request asynchronously
  215. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  216. :param int expiration: Unix timestamp of the expiration time
  217. :param _return_http_data_only: response data without head status code
  218. and headers
  219. :param _preload_content: if False, the urllib3.HTTPResponse object will
  220. be returned without reading/decoding response
  221. data. Default is True.
  222. :param _request_timeout: timeout setting for this request. If one
  223. number provided, it will be total request
  224. timeout. It can also be a pair (tuple) of
  225. (connection, read) timeouts.
  226. :rtype: tuple(list[gate_api.OptionsContract], status_code(int), headers(HTTPHeaderDict))
  227. :return: If the method is called asynchronously,
  228. returns the request thread.
  229. """
  230. local_var_params = locals()
  231. all_params = ['underlying', 'expiration']
  232. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  233. for k, v in six.iteritems(local_var_params['kwargs']):
  234. if k not in all_params:
  235. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_contracts" % k)
  236. local_var_params[k] = v
  237. del local_var_params['kwargs']
  238. # verify the required parameter 'underlying' is set
  239. if self.api_client.client_side_validation and (
  240. 'underlying' not in local_var_params or local_var_params['underlying'] is None # noqa: E501
  241. ): # noqa: E501
  242. raise ApiValueError(
  243. "Missing the required parameter `underlying` when calling `list_options_contracts`"
  244. ) # noqa: E501
  245. collection_formats = {}
  246. path_params = {}
  247. query_params = []
  248. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  249. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  250. if 'expiration' in local_var_params and local_var_params['expiration'] is not None: # noqa: E501
  251. query_params.append(('expiration', local_var_params['expiration'])) # noqa: E501
  252. header_params = {}
  253. form_params = []
  254. local_var_files = {}
  255. body_params = None
  256. # HTTP header `Accept`
  257. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  258. # Authentication setting
  259. auth_settings = [] # noqa: E501
  260. return self.api_client.call_api(
  261. '/options/contracts',
  262. 'GET',
  263. path_params,
  264. query_params,
  265. header_params,
  266. body=body_params,
  267. post_params=form_params,
  268. files=local_var_files,
  269. response_type='list[OptionsContract]', # noqa: E501
  270. auth_settings=auth_settings,
  271. async_req=local_var_params.get('async_req'),
  272. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  273. _preload_content=local_var_params.get('_preload_content', True),
  274. _request_timeout=local_var_params.get('_request_timeout'),
  275. collection_formats=collection_formats,
  276. )
  277. def get_options_contract(self, contract, **kwargs): # noqa: E501
  278. """Query specified contract detail # noqa: E501
  279. This method makes a synchronous HTTP request by default. To make an
  280. asynchronous HTTP request, please pass async_req=True
  281. >>> thread = api.get_options_contract(contract, async_req=True)
  282. >>> result = thread.get()
  283. :param bool async_req: execute request asynchronously
  284. :param str contract: (required)
  285. :param _preload_content: if False, the urllib3.HTTPResponse object will
  286. be returned without reading/decoding response
  287. data. Default is True.
  288. :param _request_timeout: timeout setting for this request. If one
  289. number provided, it will be total request
  290. timeout. It can also be a pair (tuple) of
  291. (connection, read) timeouts.
  292. :rtype: gate_api.OptionsContract
  293. :return: If the method is called asynchronously,
  294. returns the request thread.
  295. """
  296. kwargs['_return_http_data_only'] = True
  297. return self.get_options_contract_with_http_info(contract, **kwargs) # noqa: E501
  298. def get_options_contract_with_http_info(self, contract, **kwargs): # noqa: E501
  299. """Query specified contract detail # noqa: E501
  300. This method makes a synchronous HTTP request by default. To make an
  301. asynchronous HTTP request, please pass async_req=True
  302. >>> thread = api.get_options_contract_with_http_info(contract, async_req=True)
  303. >>> result = thread.get()
  304. :param bool async_req: execute request asynchronously
  305. :param str contract: (required)
  306. :param _return_http_data_only: response data without head status code
  307. and headers
  308. :param _preload_content: if False, the urllib3.HTTPResponse object will
  309. be returned without reading/decoding response
  310. data. Default is True.
  311. :param _request_timeout: timeout setting for this request. If one
  312. number provided, it will be total request
  313. timeout. It can also be a pair (tuple) of
  314. (connection, read) timeouts.
  315. :rtype: tuple(gate_api.OptionsContract, status_code(int), headers(HTTPHeaderDict))
  316. :return: If the method is called asynchronously,
  317. returns the request thread.
  318. """
  319. local_var_params = locals()
  320. all_params = ['contract']
  321. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  322. for k, v in six.iteritems(local_var_params['kwargs']):
  323. if k not in all_params:
  324. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_options_contract" % k)
  325. local_var_params[k] = v
  326. del local_var_params['kwargs']
  327. # verify the required parameter 'contract' is set
  328. if self.api_client.client_side_validation and (
  329. 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501
  330. ): # noqa: E501
  331. raise ApiValueError(
  332. "Missing the required parameter `contract` when calling `get_options_contract`"
  333. ) # noqa: E501
  334. collection_formats = {}
  335. path_params = {}
  336. if 'contract' in local_var_params:
  337. path_params['contract'] = local_var_params['contract'] # noqa: E501
  338. query_params = []
  339. header_params = {}
  340. form_params = []
  341. local_var_files = {}
  342. body_params = None
  343. # HTTP header `Accept`
  344. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  345. # Authentication setting
  346. auth_settings = [] # noqa: E501
  347. return self.api_client.call_api(
  348. '/options/contracts/{contract}',
  349. 'GET',
  350. path_params,
  351. query_params,
  352. header_params,
  353. body=body_params,
  354. post_params=form_params,
  355. files=local_var_files,
  356. response_type='OptionsContract', # noqa: E501
  357. auth_settings=auth_settings,
  358. async_req=local_var_params.get('async_req'),
  359. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  360. _preload_content=local_var_params.get('_preload_content', True),
  361. _request_timeout=local_var_params.get('_request_timeout'),
  362. collection_formats=collection_formats,
  363. )
  364. def list_options_settlements(self, underlying, **kwargs): # noqa: E501
  365. """List settlement history # noqa: E501
  366. This method makes a synchronous HTTP request by default. To make an
  367. asynchronous HTTP request, please pass async_req=True
  368. >>> thread = api.list_options_settlements(underlying, async_req=True)
  369. >>> result = thread.get()
  370. :param bool async_req: execute request asynchronously
  371. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  372. :param int limit: Maximum number of records to be returned in a single list
  373. :param int offset: List offset, starting from 0
  374. :param int _from: Start timestamp
  375. :param int to: End timestamp
  376. :param _preload_content: if False, the urllib3.HTTPResponse object will
  377. be returned without reading/decoding response
  378. data. Default is True.
  379. :param _request_timeout: timeout setting for this request. If one
  380. number provided, it will be total request
  381. timeout. It can also be a pair (tuple) of
  382. (connection, read) timeouts.
  383. :rtype: list[gate_api.OptionsSettlement]
  384. :return: If the method is called asynchronously,
  385. returns the request thread.
  386. """
  387. kwargs['_return_http_data_only'] = True
  388. return self.list_options_settlements_with_http_info(underlying, **kwargs) # noqa: E501
  389. def list_options_settlements_with_http_info(self, underlying, **kwargs): # noqa: E501
  390. """List settlement history # noqa: E501
  391. This method makes a synchronous HTTP request by default. To make an
  392. asynchronous HTTP request, please pass async_req=True
  393. >>> thread = api.list_options_settlements_with_http_info(underlying, async_req=True)
  394. >>> result = thread.get()
  395. :param bool async_req: execute request asynchronously
  396. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  397. :param int limit: Maximum number of records to be returned in a single list
  398. :param int offset: List offset, starting from 0
  399. :param int _from: Start timestamp
  400. :param int to: End timestamp
  401. :param _return_http_data_only: response data without head status code
  402. and headers
  403. :param _preload_content: if False, the urllib3.HTTPResponse object will
  404. be returned without reading/decoding response
  405. data. Default is True.
  406. :param _request_timeout: timeout setting for this request. If one
  407. number provided, it will be total request
  408. timeout. It can also be a pair (tuple) of
  409. (connection, read) timeouts.
  410. :rtype: tuple(list[gate_api.OptionsSettlement], status_code(int), headers(HTTPHeaderDict))
  411. :return: If the method is called asynchronously,
  412. returns the request thread.
  413. """
  414. local_var_params = locals()
  415. all_params = ['underlying', 'limit', 'offset', '_from', 'to']
  416. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  417. for k, v in six.iteritems(local_var_params['kwargs']):
  418. if k not in all_params:
  419. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_settlements" % k)
  420. local_var_params[k] = v
  421. del local_var_params['kwargs']
  422. # verify the required parameter 'underlying' is set
  423. if self.api_client.client_side_validation and (
  424. 'underlying' not in local_var_params or local_var_params['underlying'] is None # noqa: E501
  425. ): # noqa: E501
  426. raise ApiValueError(
  427. "Missing the required parameter `underlying` when calling `list_options_settlements`"
  428. ) # noqa: E501
  429. if (
  430. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  431. ): # noqa: E501
  432. raise ApiValueError(
  433. "Invalid value for parameter `limit` when calling `list_options_settlements`, must be a value less than or equal to `1000`"
  434. ) # noqa: E501
  435. if (
  436. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  437. ): # noqa: E501
  438. raise ApiValueError(
  439. "Invalid value for parameter `limit` when calling `list_options_settlements`, must be a value greater than or equal to `1`"
  440. ) # noqa: E501
  441. if (
  442. self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0
  443. ): # noqa: E501
  444. raise ApiValueError(
  445. "Invalid value for parameter `offset` when calling `list_options_settlements`, must be a value greater than or equal to `0`"
  446. ) # noqa: E501
  447. collection_formats = {}
  448. path_params = {}
  449. query_params = []
  450. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  451. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  452. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  453. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  454. if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501
  455. query_params.append(('offset', local_var_params['offset'])) # noqa: E501
  456. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  457. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  458. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  459. query_params.append(('to', local_var_params['to'])) # noqa: E501
  460. header_params = {}
  461. form_params = []
  462. local_var_files = {}
  463. body_params = None
  464. # HTTP header `Accept`
  465. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  466. # Authentication setting
  467. auth_settings = [] # noqa: E501
  468. return self.api_client.call_api(
  469. '/options/settlements',
  470. 'GET',
  471. path_params,
  472. query_params,
  473. header_params,
  474. body=body_params,
  475. post_params=form_params,
  476. files=local_var_files,
  477. response_type='list[OptionsSettlement]', # noqa: E501
  478. auth_settings=auth_settings,
  479. async_req=local_var_params.get('async_req'),
  480. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  481. _preload_content=local_var_params.get('_preload_content', True),
  482. _request_timeout=local_var_params.get('_request_timeout'),
  483. collection_formats=collection_formats,
  484. )
  485. def get_options_settlement(self, contract, underlying, at, **kwargs): # noqa: E501
  486. """Get specified contract's settlement # noqa: E501
  487. This method makes a synchronous HTTP request by default. To make an
  488. asynchronous HTTP request, please pass async_req=True
  489. >>> thread = api.get_options_settlement(contract, underlying, at, async_req=True)
  490. >>> result = thread.get()
  491. :param bool async_req: execute request asynchronously
  492. :param str contract: (required)
  493. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  494. :param int at: (required)
  495. :param _preload_content: if False, the urllib3.HTTPResponse object will
  496. be returned without reading/decoding response
  497. data. Default is True.
  498. :param _request_timeout: timeout setting for this request. If one
  499. number provided, it will be total request
  500. timeout. It can also be a pair (tuple) of
  501. (connection, read) timeouts.
  502. :rtype: gate_api.OptionsSettlement
  503. :return: If the method is called asynchronously,
  504. returns the request thread.
  505. """
  506. kwargs['_return_http_data_only'] = True
  507. return self.get_options_settlement_with_http_info(contract, underlying, at, **kwargs) # noqa: E501
  508. def get_options_settlement_with_http_info(self, contract, underlying, at, **kwargs): # noqa: E501
  509. """Get specified contract's settlement # noqa: E501
  510. This method makes a synchronous HTTP request by default. To make an
  511. asynchronous HTTP request, please pass async_req=True
  512. >>> thread = api.get_options_settlement_with_http_info(contract, underlying, at, async_req=True)
  513. >>> result = thread.get()
  514. :param bool async_req: execute request asynchronously
  515. :param str contract: (required)
  516. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  517. :param int at: (required)
  518. :param _return_http_data_only: response data without head status code
  519. and headers
  520. :param _preload_content: if False, the urllib3.HTTPResponse object will
  521. be returned without reading/decoding response
  522. data. Default is True.
  523. :param _request_timeout: timeout setting for this request. If one
  524. number provided, it will be total request
  525. timeout. It can also be a pair (tuple) of
  526. (connection, read) timeouts.
  527. :rtype: tuple(gate_api.OptionsSettlement, status_code(int), headers(HTTPHeaderDict))
  528. :return: If the method is called asynchronously,
  529. returns the request thread.
  530. """
  531. local_var_params = locals()
  532. all_params = ['contract', 'underlying', 'at']
  533. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  534. for k, v in six.iteritems(local_var_params['kwargs']):
  535. if k not in all_params:
  536. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_options_settlement" % k)
  537. local_var_params[k] = v
  538. del local_var_params['kwargs']
  539. # verify the required parameter 'contract' is set
  540. if self.api_client.client_side_validation and (
  541. 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501
  542. ): # noqa: E501
  543. raise ApiValueError(
  544. "Missing the required parameter `contract` when calling `get_options_settlement`"
  545. ) # noqa: E501
  546. # verify the required parameter 'underlying' is set
  547. if self.api_client.client_side_validation and (
  548. 'underlying' not in local_var_params or local_var_params['underlying'] is None # noqa: E501
  549. ): # noqa: E501
  550. raise ApiValueError(
  551. "Missing the required parameter `underlying` when calling `get_options_settlement`"
  552. ) # noqa: E501
  553. # verify the required parameter 'at' is set
  554. if self.api_client.client_side_validation and (
  555. 'at' not in local_var_params or local_var_params['at'] is None # noqa: E501
  556. ): # noqa: E501
  557. raise ApiValueError(
  558. "Missing the required parameter `at` when calling `get_options_settlement`"
  559. ) # noqa: E501
  560. collection_formats = {}
  561. path_params = {}
  562. if 'contract' in local_var_params:
  563. path_params['contract'] = local_var_params['contract'] # noqa: E501
  564. query_params = []
  565. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  566. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  567. if 'at' in local_var_params and local_var_params['at'] is not None: # noqa: E501
  568. query_params.append(('at', local_var_params['at'])) # noqa: E501
  569. header_params = {}
  570. form_params = []
  571. local_var_files = {}
  572. body_params = None
  573. # HTTP header `Accept`
  574. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  575. # Authentication setting
  576. auth_settings = [] # noqa: E501
  577. return self.api_client.call_api(
  578. '/options/settlements/{contract}',
  579. 'GET',
  580. path_params,
  581. query_params,
  582. header_params,
  583. body=body_params,
  584. post_params=form_params,
  585. files=local_var_files,
  586. response_type='OptionsSettlement', # noqa: E501
  587. auth_settings=auth_settings,
  588. async_req=local_var_params.get('async_req'),
  589. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  590. _preload_content=local_var_params.get('_preload_content', True),
  591. _request_timeout=local_var_params.get('_request_timeout'),
  592. collection_formats=collection_formats,
  593. )
  594. def list_my_options_settlements(self, underlying, **kwargs): # noqa: E501
  595. """List my options settlements # noqa: E501
  596. This method makes a synchronous HTTP request by default. To make an
  597. asynchronous HTTP request, please pass async_req=True
  598. >>> thread = api.list_my_options_settlements(underlying, async_req=True)
  599. >>> result = thread.get()
  600. :param bool async_req: execute request asynchronously
  601. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  602. :param str contract: Options contract name
  603. :param int limit: Maximum number of records to be returned in a single list
  604. :param int offset: List offset, starting from 0
  605. :param int _from: Start timestamp
  606. :param int to: End timestamp
  607. :param _preload_content: if False, the urllib3.HTTPResponse object will
  608. be returned without reading/decoding response
  609. data. Default is True.
  610. :param _request_timeout: timeout setting for this request. If one
  611. number provided, it will be total request
  612. timeout. It can also be a pair (tuple) of
  613. (connection, read) timeouts.
  614. :rtype: list[gate_api.OptionsMySettlements]
  615. :return: If the method is called asynchronously,
  616. returns the request thread.
  617. """
  618. kwargs['_return_http_data_only'] = True
  619. return self.list_my_options_settlements_with_http_info(underlying, **kwargs) # noqa: E501
  620. def list_my_options_settlements_with_http_info(self, underlying, **kwargs): # noqa: E501
  621. """List my options settlements # noqa: E501
  622. This method makes a synchronous HTTP request by default. To make an
  623. asynchronous HTTP request, please pass async_req=True
  624. >>> thread = api.list_my_options_settlements_with_http_info(underlying, async_req=True)
  625. >>> result = thread.get()
  626. :param bool async_req: execute request asynchronously
  627. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  628. :param str contract: Options contract name
  629. :param int limit: Maximum number of records to be returned in a single list
  630. :param int offset: List offset, starting from 0
  631. :param int _from: Start timestamp
  632. :param int to: End timestamp
  633. :param _return_http_data_only: response data without head status code
  634. and headers
  635. :param _preload_content: if False, the urllib3.HTTPResponse object will
  636. be returned without reading/decoding response
  637. data. Default is True.
  638. :param _request_timeout: timeout setting for this request. If one
  639. number provided, it will be total request
  640. timeout. It can also be a pair (tuple) of
  641. (connection, read) timeouts.
  642. :rtype: tuple(list[gate_api.OptionsMySettlements], status_code(int), headers(HTTPHeaderDict))
  643. :return: If the method is called asynchronously,
  644. returns the request thread.
  645. """
  646. local_var_params = locals()
  647. all_params = ['underlying', 'contract', 'limit', 'offset', '_from', 'to']
  648. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  649. for k, v in six.iteritems(local_var_params['kwargs']):
  650. if k not in all_params:
  651. raise ApiTypeError(
  652. "Got an unexpected keyword argument '%s'" " to method list_my_options_settlements" % k
  653. )
  654. local_var_params[k] = v
  655. del local_var_params['kwargs']
  656. # verify the required parameter 'underlying' is set
  657. if self.api_client.client_side_validation and (
  658. 'underlying' not in local_var_params or local_var_params['underlying'] is None # noqa: E501
  659. ): # noqa: E501
  660. raise ApiValueError(
  661. "Missing the required parameter `underlying` when calling `list_my_options_settlements`"
  662. ) # noqa: E501
  663. if (
  664. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  665. ): # noqa: E501
  666. raise ApiValueError(
  667. "Invalid value for parameter `limit` when calling `list_my_options_settlements`, must be a value less than or equal to `1000`"
  668. ) # noqa: E501
  669. if (
  670. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  671. ): # noqa: E501
  672. raise ApiValueError(
  673. "Invalid value for parameter `limit` when calling `list_my_options_settlements`, must be a value greater than or equal to `1`"
  674. ) # noqa: E501
  675. if (
  676. self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0
  677. ): # noqa: E501
  678. raise ApiValueError(
  679. "Invalid value for parameter `offset` when calling `list_my_options_settlements`, must be a value greater than or equal to `0`"
  680. ) # noqa: E501
  681. collection_formats = {}
  682. path_params = {}
  683. query_params = []
  684. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  685. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  686. if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501
  687. query_params.append(('contract', local_var_params['contract'])) # noqa: E501
  688. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  689. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  690. if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501
  691. query_params.append(('offset', local_var_params['offset'])) # noqa: E501
  692. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  693. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  694. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  695. query_params.append(('to', local_var_params['to'])) # noqa: E501
  696. header_params = {}
  697. form_params = []
  698. local_var_files = {}
  699. body_params = None
  700. # HTTP header `Accept`
  701. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  702. # Authentication setting
  703. auth_settings = ['apiv4'] # noqa: E501
  704. return self.api_client.call_api(
  705. '/options/my_settlements',
  706. 'GET',
  707. path_params,
  708. query_params,
  709. header_params,
  710. body=body_params,
  711. post_params=form_params,
  712. files=local_var_files,
  713. response_type='list[OptionsMySettlements]', # noqa: E501
  714. auth_settings=auth_settings,
  715. async_req=local_var_params.get('async_req'),
  716. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  717. _preload_content=local_var_params.get('_preload_content', True),
  718. _request_timeout=local_var_params.get('_request_timeout'),
  719. collection_formats=collection_formats,
  720. )
  721. def list_options_order_book(self, contract, **kwargs): # noqa: E501
  722. """Options order book # noqa: E501
  723. Bids will be sorted by price from high to low, while asks sorted reversely # noqa: E501
  724. This method makes a synchronous HTTP request by default. To make an
  725. asynchronous HTTP request, please pass async_req=True
  726. >>> thread = api.list_options_order_book(contract, async_req=True)
  727. >>> result = thread.get()
  728. :param bool async_req: execute request asynchronously
  729. :param str contract: Options contract name (required)
  730. :param str interval: Order depth. 0 means no aggregation is applied. default to 0
  731. :param int limit: Maximum number of order depth data in asks or bids
  732. :param bool with_id: Whether the order book update ID will be returned. This ID increases by 1 on every order book update
  733. :param _preload_content: if False, the urllib3.HTTPResponse object will
  734. be returned without reading/decoding response
  735. data. Default is True.
  736. :param _request_timeout: timeout setting for this request. If one
  737. number provided, it will be total request
  738. timeout. It can also be a pair (tuple) of
  739. (connection, read) timeouts.
  740. :rtype: gate_api.FuturesOrderBook
  741. :return: If the method is called asynchronously,
  742. returns the request thread.
  743. """
  744. kwargs['_return_http_data_only'] = True
  745. return self.list_options_order_book_with_http_info(contract, **kwargs) # noqa: E501
  746. def list_options_order_book_with_http_info(self, contract, **kwargs): # noqa: E501
  747. """Options order book # noqa: E501
  748. Bids will be sorted by price from high to low, while asks sorted reversely # noqa: E501
  749. This method makes a synchronous HTTP request by default. To make an
  750. asynchronous HTTP request, please pass async_req=True
  751. >>> thread = api.list_options_order_book_with_http_info(contract, async_req=True)
  752. >>> result = thread.get()
  753. :param bool async_req: execute request asynchronously
  754. :param str contract: Options contract name (required)
  755. :param str interval: Order depth. 0 means no aggregation is applied. default to 0
  756. :param int limit: Maximum number of order depth data in asks or bids
  757. :param bool with_id: Whether the order book update ID will be returned. This ID increases by 1 on every order book update
  758. :param _return_http_data_only: response data without head status code
  759. and headers
  760. :param _preload_content: if False, the urllib3.HTTPResponse object will
  761. be returned without reading/decoding response
  762. data. Default is True.
  763. :param _request_timeout: timeout setting for this request. If one
  764. number provided, it will be total request
  765. timeout. It can also be a pair (tuple) of
  766. (connection, read) timeouts.
  767. :rtype: tuple(gate_api.FuturesOrderBook, status_code(int), headers(HTTPHeaderDict))
  768. :return: If the method is called asynchronously,
  769. returns the request thread.
  770. """
  771. local_var_params = locals()
  772. all_params = ['contract', 'interval', 'limit', 'with_id']
  773. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  774. for k, v in six.iteritems(local_var_params['kwargs']):
  775. if k not in all_params:
  776. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_order_book" % k)
  777. local_var_params[k] = v
  778. del local_var_params['kwargs']
  779. # verify the required parameter 'contract' is set
  780. if self.api_client.client_side_validation and (
  781. 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501
  782. ): # noqa: E501
  783. raise ApiValueError(
  784. "Missing the required parameter `contract` when calling `list_options_order_book`"
  785. ) # noqa: E501
  786. if (
  787. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 50
  788. ): # noqa: E501
  789. raise ApiValueError(
  790. "Invalid value for parameter `limit` when calling `list_options_order_book`, must be a value less than or equal to `50`"
  791. ) # noqa: E501
  792. if (
  793. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  794. ): # noqa: E501
  795. raise ApiValueError(
  796. "Invalid value for parameter `limit` when calling `list_options_order_book`, must be a value greater than or equal to `1`"
  797. ) # noqa: E501
  798. collection_formats = {}
  799. path_params = {}
  800. query_params = []
  801. if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501
  802. query_params.append(('contract', local_var_params['contract'])) # noqa: E501
  803. if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501
  804. query_params.append(('interval', local_var_params['interval'])) # noqa: E501
  805. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  806. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  807. if 'with_id' in local_var_params and local_var_params['with_id'] is not None: # noqa: E501
  808. query_params.append(('with_id', local_var_params['with_id'])) # noqa: E501
  809. header_params = {}
  810. form_params = []
  811. local_var_files = {}
  812. body_params = None
  813. # HTTP header `Accept`
  814. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  815. # Authentication setting
  816. auth_settings = [] # noqa: E501
  817. return self.api_client.call_api(
  818. '/options/order_book',
  819. 'GET',
  820. path_params,
  821. query_params,
  822. header_params,
  823. body=body_params,
  824. post_params=form_params,
  825. files=local_var_files,
  826. response_type='FuturesOrderBook', # noqa: E501
  827. auth_settings=auth_settings,
  828. async_req=local_var_params.get('async_req'),
  829. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  830. _preload_content=local_var_params.get('_preload_content', True),
  831. _request_timeout=local_var_params.get('_request_timeout'),
  832. collection_formats=collection_formats,
  833. )
  834. def list_options_tickers(self, underlying, **kwargs): # noqa: E501
  835. """List tickers of options contracts # noqa: E501
  836. This method makes a synchronous HTTP request by default. To make an
  837. asynchronous HTTP request, please pass async_req=True
  838. >>> thread = api.list_options_tickers(underlying, async_req=True)
  839. >>> result = thread.get()
  840. :param bool async_req: execute request asynchronously
  841. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  842. :param _preload_content: if False, the urllib3.HTTPResponse object will
  843. be returned without reading/decoding response
  844. data. Default is True.
  845. :param _request_timeout: timeout setting for this request. If one
  846. number provided, it will be total request
  847. timeout. It can also be a pair (tuple) of
  848. (connection, read) timeouts.
  849. :rtype: list[gate_api.OptionsTicker]
  850. :return: If the method is called asynchronously,
  851. returns the request thread.
  852. """
  853. kwargs['_return_http_data_only'] = True
  854. return self.list_options_tickers_with_http_info(underlying, **kwargs) # noqa: E501
  855. def list_options_tickers_with_http_info(self, underlying, **kwargs): # noqa: E501
  856. """List tickers of options contracts # noqa: E501
  857. This method makes a synchronous HTTP request by default. To make an
  858. asynchronous HTTP request, please pass async_req=True
  859. >>> thread = api.list_options_tickers_with_http_info(underlying, async_req=True)
  860. >>> result = thread.get()
  861. :param bool async_req: execute request asynchronously
  862. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  863. :param _return_http_data_only: response data without head status code
  864. and headers
  865. :param _preload_content: if False, the urllib3.HTTPResponse object will
  866. be returned without reading/decoding response
  867. data. Default is True.
  868. :param _request_timeout: timeout setting for this request. If one
  869. number provided, it will be total request
  870. timeout. It can also be a pair (tuple) of
  871. (connection, read) timeouts.
  872. :rtype: tuple(list[gate_api.OptionsTicker], status_code(int), headers(HTTPHeaderDict))
  873. :return: If the method is called asynchronously,
  874. returns the request thread.
  875. """
  876. local_var_params = locals()
  877. all_params = ['underlying']
  878. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  879. for k, v in six.iteritems(local_var_params['kwargs']):
  880. if k not in all_params:
  881. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_tickers" % k)
  882. local_var_params[k] = v
  883. del local_var_params['kwargs']
  884. # verify the required parameter 'underlying' is set
  885. if self.api_client.client_side_validation and (
  886. 'underlying' not in local_var_params or local_var_params['underlying'] is None # noqa: E501
  887. ): # noqa: E501
  888. raise ApiValueError(
  889. "Missing the required parameter `underlying` when calling `list_options_tickers`"
  890. ) # noqa: E501
  891. collection_formats = {}
  892. path_params = {}
  893. query_params = []
  894. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  895. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  896. header_params = {}
  897. form_params = []
  898. local_var_files = {}
  899. body_params = None
  900. # HTTP header `Accept`
  901. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  902. # Authentication setting
  903. auth_settings = [] # noqa: E501
  904. return self.api_client.call_api(
  905. '/options/tickers',
  906. 'GET',
  907. path_params,
  908. query_params,
  909. header_params,
  910. body=body_params,
  911. post_params=form_params,
  912. files=local_var_files,
  913. response_type='list[OptionsTicker]', # noqa: E501
  914. auth_settings=auth_settings,
  915. async_req=local_var_params.get('async_req'),
  916. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  917. _preload_content=local_var_params.get('_preload_content', True),
  918. _request_timeout=local_var_params.get('_request_timeout'),
  919. collection_formats=collection_formats,
  920. )
  921. def list_options_underlying_tickers(self, underlying, **kwargs): # noqa: E501
  922. """Get underlying ticker # noqa: E501
  923. This method makes a synchronous HTTP request by default. To make an
  924. asynchronous HTTP request, please pass async_req=True
  925. >>> thread = api.list_options_underlying_tickers(underlying, async_req=True)
  926. >>> result = thread.get()
  927. :param bool async_req: execute request asynchronously
  928. :param str underlying: Underlying (required)
  929. :param _preload_content: if False, the urllib3.HTTPResponse object will
  930. be returned without reading/decoding response
  931. data. Default is True.
  932. :param _request_timeout: timeout setting for this request. If one
  933. number provided, it will be total request
  934. timeout. It can also be a pair (tuple) of
  935. (connection, read) timeouts.
  936. :rtype: gate_api.OptionsUnderlyingTicker
  937. :return: If the method is called asynchronously,
  938. returns the request thread.
  939. """
  940. kwargs['_return_http_data_only'] = True
  941. return self.list_options_underlying_tickers_with_http_info(underlying, **kwargs) # noqa: E501
  942. def list_options_underlying_tickers_with_http_info(self, underlying, **kwargs): # noqa: E501
  943. """Get underlying ticker # noqa: E501
  944. This method makes a synchronous HTTP request by default. To make an
  945. asynchronous HTTP request, please pass async_req=True
  946. >>> thread = api.list_options_underlying_tickers_with_http_info(underlying, async_req=True)
  947. >>> result = thread.get()
  948. :param bool async_req: execute request asynchronously
  949. :param str underlying: Underlying (required)
  950. :param _return_http_data_only: response data without head status code
  951. and headers
  952. :param _preload_content: if False, the urllib3.HTTPResponse object will
  953. be returned without reading/decoding response
  954. data. Default is True.
  955. :param _request_timeout: timeout setting for this request. If one
  956. number provided, it will be total request
  957. timeout. It can also be a pair (tuple) of
  958. (connection, read) timeouts.
  959. :rtype: tuple(gate_api.OptionsUnderlyingTicker, status_code(int), headers(HTTPHeaderDict))
  960. :return: If the method is called asynchronously,
  961. returns the request thread.
  962. """
  963. local_var_params = locals()
  964. all_params = ['underlying']
  965. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  966. for k, v in six.iteritems(local_var_params['kwargs']):
  967. if k not in all_params:
  968. raise ApiTypeError(
  969. "Got an unexpected keyword argument '%s'" " to method list_options_underlying_tickers" % k
  970. )
  971. local_var_params[k] = v
  972. del local_var_params['kwargs']
  973. # verify the required parameter 'underlying' is set
  974. if self.api_client.client_side_validation and (
  975. 'underlying' not in local_var_params or local_var_params['underlying'] is None # noqa: E501
  976. ): # noqa: E501
  977. raise ApiValueError(
  978. "Missing the required parameter `underlying` when calling `list_options_underlying_tickers`"
  979. ) # noqa: E501
  980. collection_formats = {}
  981. path_params = {}
  982. if 'underlying' in local_var_params:
  983. path_params['underlying'] = local_var_params['underlying'] # noqa: E501
  984. query_params = []
  985. header_params = {}
  986. form_params = []
  987. local_var_files = {}
  988. body_params = None
  989. # HTTP header `Accept`
  990. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  991. # Authentication setting
  992. auth_settings = [] # noqa: E501
  993. return self.api_client.call_api(
  994. '/options/underlying/tickers/{underlying}',
  995. 'GET',
  996. path_params,
  997. query_params,
  998. header_params,
  999. body=body_params,
  1000. post_params=form_params,
  1001. files=local_var_files,
  1002. response_type='OptionsUnderlyingTicker', # noqa: E501
  1003. auth_settings=auth_settings,
  1004. async_req=local_var_params.get('async_req'),
  1005. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1006. _preload_content=local_var_params.get('_preload_content', True),
  1007. _request_timeout=local_var_params.get('_request_timeout'),
  1008. collection_formats=collection_formats,
  1009. )
  1010. def list_options_candlesticks(self, contract, **kwargs): # noqa: E501
  1011. """Get options candlesticks # noqa: E501
  1012. This method makes a synchronous HTTP request by default. To make an
  1013. asynchronous HTTP request, please pass async_req=True
  1014. >>> thread = api.list_options_candlesticks(contract, async_req=True)
  1015. >>> result = thread.get()
  1016. :param bool async_req: execute request asynchronously
  1017. :param str contract: Options contract name (required)
  1018. :param int limit: Maximum number of records to be returned in a single list
  1019. :param int _from: Start timestamp
  1020. :param int to: End timestamp
  1021. :param str interval: Interval time between data points
  1022. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1023. be returned without reading/decoding response
  1024. data. Default is True.
  1025. :param _request_timeout: timeout setting for this request. If one
  1026. number provided, it will be total request
  1027. timeout. It can also be a pair (tuple) of
  1028. (connection, read) timeouts.
  1029. :rtype: list[gate_api.OptionsCandlestick]
  1030. :return: If the method is called asynchronously,
  1031. returns the request thread.
  1032. """
  1033. kwargs['_return_http_data_only'] = True
  1034. return self.list_options_candlesticks_with_http_info(contract, **kwargs) # noqa: E501
  1035. def list_options_candlesticks_with_http_info(self, contract, **kwargs): # noqa: E501
  1036. """Get options candlesticks # noqa: E501
  1037. This method makes a synchronous HTTP request by default. To make an
  1038. asynchronous HTTP request, please pass async_req=True
  1039. >>> thread = api.list_options_candlesticks_with_http_info(contract, async_req=True)
  1040. >>> result = thread.get()
  1041. :param bool async_req: execute request asynchronously
  1042. :param str contract: Options contract name (required)
  1043. :param int limit: Maximum number of records to be returned in a single list
  1044. :param int _from: Start timestamp
  1045. :param int to: End timestamp
  1046. :param str interval: Interval time between data points
  1047. :param _return_http_data_only: response data without head status code
  1048. and headers
  1049. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1050. be returned without reading/decoding response
  1051. data. Default is True.
  1052. :param _request_timeout: timeout setting for this request. If one
  1053. number provided, it will be total request
  1054. timeout. It can also be a pair (tuple) of
  1055. (connection, read) timeouts.
  1056. :rtype: tuple(list[gate_api.OptionsCandlestick], status_code(int), headers(HTTPHeaderDict))
  1057. :return: If the method is called asynchronously,
  1058. returns the request thread.
  1059. """
  1060. local_var_params = locals()
  1061. all_params = ['contract', 'limit', '_from', 'to', 'interval']
  1062. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1063. for k, v in six.iteritems(local_var_params['kwargs']):
  1064. if k not in all_params:
  1065. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_candlesticks" % k)
  1066. local_var_params[k] = v
  1067. del local_var_params['kwargs']
  1068. # verify the required parameter 'contract' is set
  1069. if self.api_client.client_side_validation and (
  1070. 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501
  1071. ): # noqa: E501
  1072. raise ApiValueError(
  1073. "Missing the required parameter `contract` when calling `list_options_candlesticks`"
  1074. ) # noqa: E501
  1075. if (
  1076. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  1077. ): # noqa: E501
  1078. raise ApiValueError(
  1079. "Invalid value for parameter `limit` when calling `list_options_candlesticks`, must be a value less than or equal to `1000`"
  1080. ) # noqa: E501
  1081. if (
  1082. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  1083. ): # noqa: E501
  1084. raise ApiValueError(
  1085. "Invalid value for parameter `limit` when calling `list_options_candlesticks`, must be a value greater than or equal to `1`"
  1086. ) # noqa: E501
  1087. collection_formats = {}
  1088. path_params = {}
  1089. query_params = []
  1090. if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501
  1091. query_params.append(('contract', local_var_params['contract'])) # noqa: E501
  1092. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  1093. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  1094. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  1095. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  1096. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  1097. query_params.append(('to', local_var_params['to'])) # noqa: E501
  1098. if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501
  1099. query_params.append(('interval', local_var_params['interval'])) # noqa: E501
  1100. header_params = {}
  1101. form_params = []
  1102. local_var_files = {}
  1103. body_params = None
  1104. # HTTP header `Accept`
  1105. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1106. # Authentication setting
  1107. auth_settings = [] # noqa: E501
  1108. return self.api_client.call_api(
  1109. '/options/candlesticks',
  1110. 'GET',
  1111. path_params,
  1112. query_params,
  1113. header_params,
  1114. body=body_params,
  1115. post_params=form_params,
  1116. files=local_var_files,
  1117. response_type='list[OptionsCandlestick]', # noqa: E501
  1118. auth_settings=auth_settings,
  1119. async_req=local_var_params.get('async_req'),
  1120. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1121. _preload_content=local_var_params.get('_preload_content', True),
  1122. _request_timeout=local_var_params.get('_request_timeout'),
  1123. collection_formats=collection_formats,
  1124. )
  1125. def list_options_underlying_candlesticks(self, underlying, **kwargs): # noqa: E501
  1126. """Mark price candlesticks of an underlying # noqa: E501
  1127. This method makes a synchronous HTTP request by default. To make an
  1128. asynchronous HTTP request, please pass async_req=True
  1129. >>> thread = api.list_options_underlying_candlesticks(underlying, async_req=True)
  1130. >>> result = thread.get()
  1131. :param bool async_req: execute request asynchronously
  1132. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  1133. :param int limit: Maximum number of records to be returned in a single list
  1134. :param int _from: Start timestamp
  1135. :param int to: End timestamp
  1136. :param str interval: Interval time between data points
  1137. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1138. be returned without reading/decoding response
  1139. data. Default is True.
  1140. :param _request_timeout: timeout setting for this request. If one
  1141. number provided, it will be total request
  1142. timeout. It can also be a pair (tuple) of
  1143. (connection, read) timeouts.
  1144. :rtype: list[gate_api.FuturesCandlestick]
  1145. :return: If the method is called asynchronously,
  1146. returns the request thread.
  1147. """
  1148. kwargs['_return_http_data_only'] = True
  1149. return self.list_options_underlying_candlesticks_with_http_info(underlying, **kwargs) # noqa: E501
  1150. def list_options_underlying_candlesticks_with_http_info(self, underlying, **kwargs): # noqa: E501
  1151. """Mark price candlesticks of an underlying # noqa: E501
  1152. This method makes a synchronous HTTP request by default. To make an
  1153. asynchronous HTTP request, please pass async_req=True
  1154. >>> thread = api.list_options_underlying_candlesticks_with_http_info(underlying, async_req=True)
  1155. >>> result = thread.get()
  1156. :param bool async_req: execute request asynchronously
  1157. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  1158. :param int limit: Maximum number of records to be returned in a single list
  1159. :param int _from: Start timestamp
  1160. :param int to: End timestamp
  1161. :param str interval: Interval time between data points
  1162. :param _return_http_data_only: response data without head status code
  1163. and headers
  1164. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1165. be returned without reading/decoding response
  1166. data. Default is True.
  1167. :param _request_timeout: timeout setting for this request. If one
  1168. number provided, it will be total request
  1169. timeout. It can also be a pair (tuple) of
  1170. (connection, read) timeouts.
  1171. :rtype: tuple(list[gate_api.FuturesCandlestick], status_code(int), headers(HTTPHeaderDict))
  1172. :return: If the method is called asynchronously,
  1173. returns the request thread.
  1174. """
  1175. local_var_params = locals()
  1176. all_params = ['underlying', 'limit', '_from', 'to', 'interval']
  1177. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1178. for k, v in six.iteritems(local_var_params['kwargs']):
  1179. if k not in all_params:
  1180. raise ApiTypeError(
  1181. "Got an unexpected keyword argument '%s'" " to method list_options_underlying_candlesticks" % k
  1182. )
  1183. local_var_params[k] = v
  1184. del local_var_params['kwargs']
  1185. # verify the required parameter 'underlying' is set
  1186. if self.api_client.client_side_validation and (
  1187. 'underlying' not in local_var_params or local_var_params['underlying'] is None # noqa: E501
  1188. ): # noqa: E501
  1189. raise ApiValueError(
  1190. "Missing the required parameter `underlying` when calling `list_options_underlying_candlesticks`"
  1191. ) # noqa: E501
  1192. if (
  1193. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  1194. ): # noqa: E501
  1195. raise ApiValueError(
  1196. "Invalid value for parameter `limit` when calling `list_options_underlying_candlesticks`, must be a value less than or equal to `1000`"
  1197. ) # noqa: E501
  1198. if (
  1199. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  1200. ): # noqa: E501
  1201. raise ApiValueError(
  1202. "Invalid value for parameter `limit` when calling `list_options_underlying_candlesticks`, must be a value greater than or equal to `1`"
  1203. ) # noqa: E501
  1204. collection_formats = {}
  1205. path_params = {}
  1206. query_params = []
  1207. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  1208. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  1209. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  1210. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  1211. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  1212. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  1213. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  1214. query_params.append(('to', local_var_params['to'])) # noqa: E501
  1215. if 'interval' in local_var_params and local_var_params['interval'] is not None: # noqa: E501
  1216. query_params.append(('interval', local_var_params['interval'])) # noqa: E501
  1217. header_params = {}
  1218. form_params = []
  1219. local_var_files = {}
  1220. body_params = None
  1221. # HTTP header `Accept`
  1222. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1223. # Authentication setting
  1224. auth_settings = [] # noqa: E501
  1225. return self.api_client.call_api(
  1226. '/options/underlying/candlesticks',
  1227. 'GET',
  1228. path_params,
  1229. query_params,
  1230. header_params,
  1231. body=body_params,
  1232. post_params=form_params,
  1233. files=local_var_files,
  1234. response_type='list[FuturesCandlestick]', # noqa: E501
  1235. auth_settings=auth_settings,
  1236. async_req=local_var_params.get('async_req'),
  1237. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1238. _preload_content=local_var_params.get('_preload_content', True),
  1239. _request_timeout=local_var_params.get('_request_timeout'),
  1240. collection_formats=collection_formats,
  1241. )
  1242. def list_options_trades(self, **kwargs): # noqa: E501
  1243. """Options trade history # noqa: E501
  1244. This method makes a synchronous HTTP request by default. To make an
  1245. asynchronous HTTP request, please pass async_req=True
  1246. >>> thread = api.list_options_trades(async_req=True)
  1247. >>> result = thread.get()
  1248. :param bool async_req: execute request asynchronously
  1249. :param str contract: Options contract name
  1250. :param str type: `C` is call, while `P` is put
  1251. :param int limit: Maximum number of records to be returned in a single list
  1252. :param int offset: List offset, starting from 0
  1253. :param int _from: Start timestamp
  1254. :param int to: End timestamp
  1255. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1256. be returned without reading/decoding response
  1257. data. Default is True.
  1258. :param _request_timeout: timeout setting for this request. If one
  1259. number provided, it will be total request
  1260. timeout. It can also be a pair (tuple) of
  1261. (connection, read) timeouts.
  1262. :rtype: list[gate_api.FuturesTrade]
  1263. :return: If the method is called asynchronously,
  1264. returns the request thread.
  1265. """
  1266. kwargs['_return_http_data_only'] = True
  1267. return self.list_options_trades_with_http_info(**kwargs) # noqa: E501
  1268. def list_options_trades_with_http_info(self, **kwargs): # noqa: E501
  1269. """Options trade history # noqa: E501
  1270. This method makes a synchronous HTTP request by default. To make an
  1271. asynchronous HTTP request, please pass async_req=True
  1272. >>> thread = api.list_options_trades_with_http_info(async_req=True)
  1273. >>> result = thread.get()
  1274. :param bool async_req: execute request asynchronously
  1275. :param str contract: Options contract name
  1276. :param str type: `C` is call, while `P` is put
  1277. :param int limit: Maximum number of records to be returned in a single list
  1278. :param int offset: List offset, starting from 0
  1279. :param int _from: Start timestamp
  1280. :param int to: End timestamp
  1281. :param _return_http_data_only: response data without head status code
  1282. and headers
  1283. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1284. be returned without reading/decoding response
  1285. data. Default is True.
  1286. :param _request_timeout: timeout setting for this request. If one
  1287. number provided, it will be total request
  1288. timeout. It can also be a pair (tuple) of
  1289. (connection, read) timeouts.
  1290. :rtype: tuple(list[gate_api.FuturesTrade], status_code(int), headers(HTTPHeaderDict))
  1291. :return: If the method is called asynchronously,
  1292. returns the request thread.
  1293. """
  1294. local_var_params = locals()
  1295. all_params = ['contract', 'type', 'limit', 'offset', '_from', 'to']
  1296. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1297. for k, v in six.iteritems(local_var_params['kwargs']):
  1298. if k not in all_params:
  1299. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_trades" % k)
  1300. local_var_params[k] = v
  1301. del local_var_params['kwargs']
  1302. if (
  1303. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  1304. ): # noqa: E501
  1305. raise ApiValueError(
  1306. "Invalid value for parameter `limit` when calling `list_options_trades`, must be a value less than or equal to `1000`"
  1307. ) # noqa: E501
  1308. if (
  1309. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  1310. ): # noqa: E501
  1311. raise ApiValueError(
  1312. "Invalid value for parameter `limit` when calling `list_options_trades`, must be a value greater than or equal to `1`"
  1313. ) # noqa: E501
  1314. if (
  1315. self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0
  1316. ): # noqa: E501
  1317. raise ApiValueError(
  1318. "Invalid value for parameter `offset` when calling `list_options_trades`, must be a value greater than or equal to `0`"
  1319. ) # noqa: E501
  1320. collection_formats = {}
  1321. path_params = {}
  1322. query_params = []
  1323. if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501
  1324. query_params.append(('contract', local_var_params['contract'])) # noqa: E501
  1325. if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501
  1326. query_params.append(('type', local_var_params['type'])) # noqa: E501
  1327. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  1328. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  1329. if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501
  1330. query_params.append(('offset', local_var_params['offset'])) # noqa: E501
  1331. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  1332. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  1333. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  1334. query_params.append(('to', local_var_params['to'])) # noqa: E501
  1335. header_params = {}
  1336. form_params = []
  1337. local_var_files = {}
  1338. body_params = None
  1339. # HTTP header `Accept`
  1340. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1341. # Authentication setting
  1342. auth_settings = [] # noqa: E501
  1343. return self.api_client.call_api(
  1344. '/options/trades',
  1345. 'GET',
  1346. path_params,
  1347. query_params,
  1348. header_params,
  1349. body=body_params,
  1350. post_params=form_params,
  1351. files=local_var_files,
  1352. response_type='list[FuturesTrade]', # noqa: E501
  1353. auth_settings=auth_settings,
  1354. async_req=local_var_params.get('async_req'),
  1355. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1356. _preload_content=local_var_params.get('_preload_content', True),
  1357. _request_timeout=local_var_params.get('_request_timeout'),
  1358. collection_formats=collection_formats,
  1359. )
  1360. def list_options_account(self, **kwargs): # noqa: E501
  1361. """List options account # noqa: E501
  1362. This method makes a synchronous HTTP request by default. To make an
  1363. asynchronous HTTP request, please pass async_req=True
  1364. >>> thread = api.list_options_account(async_req=True)
  1365. >>> result = thread.get()
  1366. :param bool async_req: execute request asynchronously
  1367. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1368. be returned without reading/decoding response
  1369. data. Default is True.
  1370. :param _request_timeout: timeout setting for this request. If one
  1371. number provided, it will be total request
  1372. timeout. It can also be a pair (tuple) of
  1373. (connection, read) timeouts.
  1374. :rtype: gate_api.OptionsAccount
  1375. :return: If the method is called asynchronously,
  1376. returns the request thread.
  1377. """
  1378. kwargs['_return_http_data_only'] = True
  1379. return self.list_options_account_with_http_info(**kwargs) # noqa: E501
  1380. def list_options_account_with_http_info(self, **kwargs): # noqa: E501
  1381. """List options account # noqa: E501
  1382. This method makes a synchronous HTTP request by default. To make an
  1383. asynchronous HTTP request, please pass async_req=True
  1384. >>> thread = api.list_options_account_with_http_info(async_req=True)
  1385. >>> result = thread.get()
  1386. :param bool async_req: execute request asynchronously
  1387. :param _return_http_data_only: response data without head status code
  1388. and headers
  1389. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1390. be returned without reading/decoding response
  1391. data. Default is True.
  1392. :param _request_timeout: timeout setting for this request. If one
  1393. number provided, it will be total request
  1394. timeout. It can also be a pair (tuple) of
  1395. (connection, read) timeouts.
  1396. :rtype: tuple(gate_api.OptionsAccount, status_code(int), headers(HTTPHeaderDict))
  1397. :return: If the method is called asynchronously,
  1398. returns the request thread.
  1399. """
  1400. local_var_params = locals()
  1401. all_params = []
  1402. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1403. for k, v in six.iteritems(local_var_params['kwargs']):
  1404. if k not in all_params:
  1405. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_account" % k)
  1406. local_var_params[k] = v
  1407. del local_var_params['kwargs']
  1408. collection_formats = {}
  1409. path_params = {}
  1410. query_params = []
  1411. header_params = {}
  1412. form_params = []
  1413. local_var_files = {}
  1414. body_params = None
  1415. # HTTP header `Accept`
  1416. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1417. # Authentication setting
  1418. auth_settings = ['apiv4'] # noqa: E501
  1419. return self.api_client.call_api(
  1420. '/options/accounts',
  1421. 'GET',
  1422. path_params,
  1423. query_params,
  1424. header_params,
  1425. body=body_params,
  1426. post_params=form_params,
  1427. files=local_var_files,
  1428. response_type='OptionsAccount', # noqa: E501
  1429. auth_settings=auth_settings,
  1430. async_req=local_var_params.get('async_req'),
  1431. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1432. _preload_content=local_var_params.get('_preload_content', True),
  1433. _request_timeout=local_var_params.get('_request_timeout'),
  1434. collection_formats=collection_formats,
  1435. )
  1436. def list_options_account_book(self, **kwargs): # noqa: E501
  1437. """List account changing history # noqa: E501
  1438. This method makes a synchronous HTTP request by default. To make an
  1439. asynchronous HTTP request, please pass async_req=True
  1440. >>> thread = api.list_options_account_book(async_req=True)
  1441. >>> result = thread.get()
  1442. :param bool async_req: execute request asynchronously
  1443. :param int limit: Maximum number of records to be returned in a single list
  1444. :param int offset: List offset, starting from 0
  1445. :param int _from: Start timestamp
  1446. :param int to: End timestamp
  1447. :param str type: Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL
  1448. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1449. be returned without reading/decoding response
  1450. data. Default is True.
  1451. :param _request_timeout: timeout setting for this request. If one
  1452. number provided, it will be total request
  1453. timeout. It can also be a pair (tuple) of
  1454. (connection, read) timeouts.
  1455. :rtype: list[gate_api.OptionsAccountBook]
  1456. :return: If the method is called asynchronously,
  1457. returns the request thread.
  1458. """
  1459. kwargs['_return_http_data_only'] = True
  1460. return self.list_options_account_book_with_http_info(**kwargs) # noqa: E501
  1461. def list_options_account_book_with_http_info(self, **kwargs): # noqa: E501
  1462. """List account changing history # noqa: E501
  1463. This method makes a synchronous HTTP request by default. To make an
  1464. asynchronous HTTP request, please pass async_req=True
  1465. >>> thread = api.list_options_account_book_with_http_info(async_req=True)
  1466. >>> result = thread.get()
  1467. :param bool async_req: execute request asynchronously
  1468. :param int limit: Maximum number of records to be returned in a single list
  1469. :param int offset: List offset, starting from 0
  1470. :param int _from: Start timestamp
  1471. :param int to: End timestamp
  1472. :param str type: Changing Type: - dnw: Deposit & Withdraw - prem: Trading premium - fee: Trading fee - refr: Referrer rebate - set: settlement PNL
  1473. :param _return_http_data_only: response data without head status code
  1474. and headers
  1475. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1476. be returned without reading/decoding response
  1477. data. Default is True.
  1478. :param _request_timeout: timeout setting for this request. If one
  1479. number provided, it will be total request
  1480. timeout. It can also be a pair (tuple) of
  1481. (connection, read) timeouts.
  1482. :rtype: tuple(list[gate_api.OptionsAccountBook], status_code(int), headers(HTTPHeaderDict))
  1483. :return: If the method is called asynchronously,
  1484. returns the request thread.
  1485. """
  1486. local_var_params = locals()
  1487. all_params = ['limit', 'offset', '_from', 'to', 'type']
  1488. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1489. for k, v in six.iteritems(local_var_params['kwargs']):
  1490. if k not in all_params:
  1491. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_account_book" % k)
  1492. local_var_params[k] = v
  1493. del local_var_params['kwargs']
  1494. if (
  1495. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  1496. ): # noqa: E501
  1497. raise ApiValueError(
  1498. "Invalid value for parameter `limit` when calling `list_options_account_book`, must be a value less than or equal to `1000`"
  1499. ) # noqa: E501
  1500. if (
  1501. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  1502. ): # noqa: E501
  1503. raise ApiValueError(
  1504. "Invalid value for parameter `limit` when calling `list_options_account_book`, must be a value greater than or equal to `1`"
  1505. ) # noqa: E501
  1506. if (
  1507. self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0
  1508. ): # noqa: E501
  1509. raise ApiValueError(
  1510. "Invalid value for parameter `offset` when calling `list_options_account_book`, must be a value greater than or equal to `0`"
  1511. ) # noqa: E501
  1512. collection_formats = {}
  1513. path_params = {}
  1514. query_params = []
  1515. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  1516. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  1517. if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501
  1518. query_params.append(('offset', local_var_params['offset'])) # noqa: E501
  1519. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  1520. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  1521. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  1522. query_params.append(('to', local_var_params['to'])) # noqa: E501
  1523. if 'type' in local_var_params and local_var_params['type'] is not None: # noqa: E501
  1524. query_params.append(('type', local_var_params['type'])) # noqa: E501
  1525. header_params = {}
  1526. form_params = []
  1527. local_var_files = {}
  1528. body_params = None
  1529. # HTTP header `Accept`
  1530. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1531. # Authentication setting
  1532. auth_settings = ['apiv4'] # noqa: E501
  1533. return self.api_client.call_api(
  1534. '/options/account_book',
  1535. 'GET',
  1536. path_params,
  1537. query_params,
  1538. header_params,
  1539. body=body_params,
  1540. post_params=form_params,
  1541. files=local_var_files,
  1542. response_type='list[OptionsAccountBook]', # noqa: E501
  1543. auth_settings=auth_settings,
  1544. async_req=local_var_params.get('async_req'),
  1545. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1546. _preload_content=local_var_params.get('_preload_content', True),
  1547. _request_timeout=local_var_params.get('_request_timeout'),
  1548. collection_formats=collection_formats,
  1549. )
  1550. def list_options_positions(self, **kwargs): # noqa: E501
  1551. """List user's positions of specified underlying # noqa: E501
  1552. This method makes a synchronous HTTP request by default. To make an
  1553. asynchronous HTTP request, please pass async_req=True
  1554. >>> thread = api.list_options_positions(async_req=True)
  1555. >>> result = thread.get()
  1556. :param bool async_req: execute request asynchronously
  1557. :param str underlying: Underlying
  1558. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1559. be returned without reading/decoding response
  1560. data. Default is True.
  1561. :param _request_timeout: timeout setting for this request. If one
  1562. number provided, it will be total request
  1563. timeout. It can also be a pair (tuple) of
  1564. (connection, read) timeouts.
  1565. :rtype: list[gate_api.OptionsPosition]
  1566. :return: If the method is called asynchronously,
  1567. returns the request thread.
  1568. """
  1569. kwargs['_return_http_data_only'] = True
  1570. return self.list_options_positions_with_http_info(**kwargs) # noqa: E501
  1571. def list_options_positions_with_http_info(self, **kwargs): # noqa: E501
  1572. """List user's positions of specified underlying # noqa: E501
  1573. This method makes a synchronous HTTP request by default. To make an
  1574. asynchronous HTTP request, please pass async_req=True
  1575. >>> thread = api.list_options_positions_with_http_info(async_req=True)
  1576. >>> result = thread.get()
  1577. :param bool async_req: execute request asynchronously
  1578. :param str underlying: Underlying
  1579. :param _return_http_data_only: response data without head status code
  1580. and headers
  1581. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1582. be returned without reading/decoding response
  1583. data. Default is True.
  1584. :param _request_timeout: timeout setting for this request. If one
  1585. number provided, it will be total request
  1586. timeout. It can also be a pair (tuple) of
  1587. (connection, read) timeouts.
  1588. :rtype: tuple(list[gate_api.OptionsPosition], status_code(int), headers(HTTPHeaderDict))
  1589. :return: If the method is called asynchronously,
  1590. returns the request thread.
  1591. """
  1592. local_var_params = locals()
  1593. all_params = ['underlying']
  1594. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1595. for k, v in six.iteritems(local_var_params['kwargs']):
  1596. if k not in all_params:
  1597. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_positions" % k)
  1598. local_var_params[k] = v
  1599. del local_var_params['kwargs']
  1600. collection_formats = {}
  1601. path_params = {}
  1602. query_params = []
  1603. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  1604. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  1605. header_params = {}
  1606. form_params = []
  1607. local_var_files = {}
  1608. body_params = None
  1609. # HTTP header `Accept`
  1610. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1611. # Authentication setting
  1612. auth_settings = ['apiv4'] # noqa: E501
  1613. return self.api_client.call_api(
  1614. '/options/positions',
  1615. 'GET',
  1616. path_params,
  1617. query_params,
  1618. header_params,
  1619. body=body_params,
  1620. post_params=form_params,
  1621. files=local_var_files,
  1622. response_type='list[OptionsPosition]', # noqa: E501
  1623. auth_settings=auth_settings,
  1624. async_req=local_var_params.get('async_req'),
  1625. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1626. _preload_content=local_var_params.get('_preload_content', True),
  1627. _request_timeout=local_var_params.get('_request_timeout'),
  1628. collection_formats=collection_formats,
  1629. )
  1630. def get_options_position(self, contract, **kwargs): # noqa: E501
  1631. """Get specified contract position # noqa: E501
  1632. This method makes a synchronous HTTP request by default. To make an
  1633. asynchronous HTTP request, please pass async_req=True
  1634. >>> thread = api.get_options_position(contract, async_req=True)
  1635. >>> result = thread.get()
  1636. :param bool async_req: execute request asynchronously
  1637. :param str contract: (required)
  1638. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1639. be returned without reading/decoding response
  1640. data. Default is True.
  1641. :param _request_timeout: timeout setting for this request. If one
  1642. number provided, it will be total request
  1643. timeout. It can also be a pair (tuple) of
  1644. (connection, read) timeouts.
  1645. :rtype: gate_api.OptionsPosition
  1646. :return: If the method is called asynchronously,
  1647. returns the request thread.
  1648. """
  1649. kwargs['_return_http_data_only'] = True
  1650. return self.get_options_position_with_http_info(contract, **kwargs) # noqa: E501
  1651. def get_options_position_with_http_info(self, contract, **kwargs): # noqa: E501
  1652. """Get specified contract position # noqa: E501
  1653. This method makes a synchronous HTTP request by default. To make an
  1654. asynchronous HTTP request, please pass async_req=True
  1655. >>> thread = api.get_options_position_with_http_info(contract, async_req=True)
  1656. >>> result = thread.get()
  1657. :param bool async_req: execute request asynchronously
  1658. :param str contract: (required)
  1659. :param _return_http_data_only: response data without head status code
  1660. and headers
  1661. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1662. be returned without reading/decoding response
  1663. data. Default is True.
  1664. :param _request_timeout: timeout setting for this request. If one
  1665. number provided, it will be total request
  1666. timeout. It can also be a pair (tuple) of
  1667. (connection, read) timeouts.
  1668. :rtype: tuple(gate_api.OptionsPosition, status_code(int), headers(HTTPHeaderDict))
  1669. :return: If the method is called asynchronously,
  1670. returns the request thread.
  1671. """
  1672. local_var_params = locals()
  1673. all_params = ['contract']
  1674. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1675. for k, v in six.iteritems(local_var_params['kwargs']):
  1676. if k not in all_params:
  1677. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_options_position" % k)
  1678. local_var_params[k] = v
  1679. del local_var_params['kwargs']
  1680. # verify the required parameter 'contract' is set
  1681. if self.api_client.client_side_validation and (
  1682. 'contract' not in local_var_params or local_var_params['contract'] is None # noqa: E501
  1683. ): # noqa: E501
  1684. raise ApiValueError(
  1685. "Missing the required parameter `contract` when calling `get_options_position`"
  1686. ) # noqa: E501
  1687. collection_formats = {}
  1688. path_params = {}
  1689. if 'contract' in local_var_params:
  1690. path_params['contract'] = local_var_params['contract'] # noqa: E501
  1691. query_params = []
  1692. header_params = {}
  1693. form_params = []
  1694. local_var_files = {}
  1695. body_params = None
  1696. # HTTP header `Accept`
  1697. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1698. # Authentication setting
  1699. auth_settings = ['apiv4'] # noqa: E501
  1700. return self.api_client.call_api(
  1701. '/options/positions/{contract}',
  1702. 'GET',
  1703. path_params,
  1704. query_params,
  1705. header_params,
  1706. body=body_params,
  1707. post_params=form_params,
  1708. files=local_var_files,
  1709. response_type='OptionsPosition', # noqa: E501
  1710. auth_settings=auth_settings,
  1711. async_req=local_var_params.get('async_req'),
  1712. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1713. _preload_content=local_var_params.get('_preload_content', True),
  1714. _request_timeout=local_var_params.get('_request_timeout'),
  1715. collection_formats=collection_formats,
  1716. )
  1717. def list_options_position_close(self, underlying, **kwargs): # noqa: E501
  1718. """List user's liquidation history of specified underlying # noqa: E501
  1719. This method makes a synchronous HTTP request by default. To make an
  1720. asynchronous HTTP request, please pass async_req=True
  1721. >>> thread = api.list_options_position_close(underlying, async_req=True)
  1722. >>> result = thread.get()
  1723. :param bool async_req: execute request asynchronously
  1724. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  1725. :param str contract: Options contract name
  1726. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1727. be returned without reading/decoding response
  1728. data. Default is True.
  1729. :param _request_timeout: timeout setting for this request. If one
  1730. number provided, it will be total request
  1731. timeout. It can also be a pair (tuple) of
  1732. (connection, read) timeouts.
  1733. :rtype: list[gate_api.OptionsPositionClose]
  1734. :return: If the method is called asynchronously,
  1735. returns the request thread.
  1736. """
  1737. kwargs['_return_http_data_only'] = True
  1738. return self.list_options_position_close_with_http_info(underlying, **kwargs) # noqa: E501
  1739. def list_options_position_close_with_http_info(self, underlying, **kwargs): # noqa: E501
  1740. """List user's liquidation history of specified underlying # noqa: E501
  1741. This method makes a synchronous HTTP request by default. To make an
  1742. asynchronous HTTP request, please pass async_req=True
  1743. >>> thread = api.list_options_position_close_with_http_info(underlying, async_req=True)
  1744. >>> result = thread.get()
  1745. :param bool async_req: execute request asynchronously
  1746. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  1747. :param str contract: Options contract name
  1748. :param _return_http_data_only: response data without head status code
  1749. and headers
  1750. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1751. be returned without reading/decoding response
  1752. data. Default is True.
  1753. :param _request_timeout: timeout setting for this request. If one
  1754. number provided, it will be total request
  1755. timeout. It can also be a pair (tuple) of
  1756. (connection, read) timeouts.
  1757. :rtype: tuple(list[gate_api.OptionsPositionClose], status_code(int), headers(HTTPHeaderDict))
  1758. :return: If the method is called asynchronously,
  1759. returns the request thread.
  1760. """
  1761. local_var_params = locals()
  1762. all_params = ['underlying', 'contract']
  1763. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1764. for k, v in six.iteritems(local_var_params['kwargs']):
  1765. if k not in all_params:
  1766. raise ApiTypeError(
  1767. "Got an unexpected keyword argument '%s'" " to method list_options_position_close" % k
  1768. )
  1769. local_var_params[k] = v
  1770. del local_var_params['kwargs']
  1771. # verify the required parameter 'underlying' is set
  1772. if self.api_client.client_side_validation and (
  1773. 'underlying' not in local_var_params or local_var_params['underlying'] is None # noqa: E501
  1774. ): # noqa: E501
  1775. raise ApiValueError(
  1776. "Missing the required parameter `underlying` when calling `list_options_position_close`"
  1777. ) # noqa: E501
  1778. collection_formats = {}
  1779. path_params = {}
  1780. query_params = []
  1781. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  1782. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  1783. if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501
  1784. query_params.append(('contract', local_var_params['contract'])) # noqa: E501
  1785. header_params = {}
  1786. form_params = []
  1787. local_var_files = {}
  1788. body_params = None
  1789. # HTTP header `Accept`
  1790. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1791. # Authentication setting
  1792. auth_settings = ['apiv4'] # noqa: E501
  1793. return self.api_client.call_api(
  1794. '/options/position_close',
  1795. 'GET',
  1796. path_params,
  1797. query_params,
  1798. header_params,
  1799. body=body_params,
  1800. post_params=form_params,
  1801. files=local_var_files,
  1802. response_type='list[OptionsPositionClose]', # noqa: E501
  1803. auth_settings=auth_settings,
  1804. async_req=local_var_params.get('async_req'),
  1805. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1806. _preload_content=local_var_params.get('_preload_content', True),
  1807. _request_timeout=local_var_params.get('_request_timeout'),
  1808. collection_formats=collection_formats,
  1809. )
  1810. def list_options_orders(self, status, **kwargs): # noqa: E501
  1811. """List options orders # noqa: E501
  1812. This method makes a synchronous HTTP request by default. To make an
  1813. asynchronous HTTP request, please pass async_req=True
  1814. >>> thread = api.list_options_orders(status, async_req=True)
  1815. >>> result = thread.get()
  1816. :param bool async_req: execute request asynchronously
  1817. :param str status: Only list the orders with this status (required)
  1818. :param str contract: Options contract name
  1819. :param str underlying: Underlying
  1820. :param int limit: Maximum number of records to be returned in a single list
  1821. :param int offset: List offset, starting from 0
  1822. :param int _from: Start timestamp
  1823. :param int to: End timestamp
  1824. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1825. be returned without reading/decoding response
  1826. data. Default is True.
  1827. :param _request_timeout: timeout setting for this request. If one
  1828. number provided, it will be total request
  1829. timeout. It can also be a pair (tuple) of
  1830. (connection, read) timeouts.
  1831. :rtype: list[gate_api.OptionsOrder]
  1832. :return: If the method is called asynchronously,
  1833. returns the request thread.
  1834. """
  1835. kwargs['_return_http_data_only'] = True
  1836. return self.list_options_orders_with_http_info(status, **kwargs) # noqa: E501
  1837. def list_options_orders_with_http_info(self, status, **kwargs): # noqa: E501
  1838. """List options orders # noqa: E501
  1839. This method makes a synchronous HTTP request by default. To make an
  1840. asynchronous HTTP request, please pass async_req=True
  1841. >>> thread = api.list_options_orders_with_http_info(status, async_req=True)
  1842. >>> result = thread.get()
  1843. :param bool async_req: execute request asynchronously
  1844. :param str status: Only list the orders with this status (required)
  1845. :param str contract: Options contract name
  1846. :param str underlying: Underlying
  1847. :param int limit: Maximum number of records to be returned in a single list
  1848. :param int offset: List offset, starting from 0
  1849. :param int _from: Start timestamp
  1850. :param int to: End timestamp
  1851. :param _return_http_data_only: response data without head status code
  1852. and headers
  1853. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1854. be returned without reading/decoding response
  1855. data. Default is True.
  1856. :param _request_timeout: timeout setting for this request. If one
  1857. number provided, it will be total request
  1858. timeout. It can also be a pair (tuple) of
  1859. (connection, read) timeouts.
  1860. :rtype: tuple(list[gate_api.OptionsOrder], status_code(int), headers(HTTPHeaderDict))
  1861. :return: If the method is called asynchronously,
  1862. returns the request thread.
  1863. """
  1864. local_var_params = locals()
  1865. all_params = ['status', 'contract', 'underlying', 'limit', 'offset', '_from', 'to']
  1866. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1867. for k, v in six.iteritems(local_var_params['kwargs']):
  1868. if k not in all_params:
  1869. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_options_orders" % k)
  1870. local_var_params[k] = v
  1871. del local_var_params['kwargs']
  1872. # verify the required parameter 'status' is set
  1873. if self.api_client.client_side_validation and (
  1874. 'status' not in local_var_params or local_var_params['status'] is None # noqa: E501
  1875. ): # noqa: E501
  1876. raise ApiValueError(
  1877. "Missing the required parameter `status` when calling `list_options_orders`"
  1878. ) # noqa: E501
  1879. if (
  1880. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  1881. ): # noqa: E501
  1882. raise ApiValueError(
  1883. "Invalid value for parameter `limit` when calling `list_options_orders`, must be a value less than or equal to `1000`"
  1884. ) # noqa: E501
  1885. if (
  1886. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  1887. ): # noqa: E501
  1888. raise ApiValueError(
  1889. "Invalid value for parameter `limit` when calling `list_options_orders`, must be a value greater than or equal to `1`"
  1890. ) # noqa: E501
  1891. if (
  1892. self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0
  1893. ): # noqa: E501
  1894. raise ApiValueError(
  1895. "Invalid value for parameter `offset` when calling `list_options_orders`, must be a value greater than or equal to `0`"
  1896. ) # noqa: E501
  1897. collection_formats = {}
  1898. path_params = {}
  1899. query_params = []
  1900. if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501
  1901. query_params.append(('contract', local_var_params['contract'])) # noqa: E501
  1902. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  1903. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  1904. if 'status' in local_var_params and local_var_params['status'] is not None: # noqa: E501
  1905. query_params.append(('status', local_var_params['status'])) # noqa: E501
  1906. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  1907. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  1908. if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501
  1909. query_params.append(('offset', local_var_params['offset'])) # noqa: E501
  1910. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  1911. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  1912. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  1913. query_params.append(('to', local_var_params['to'])) # noqa: E501
  1914. header_params = {}
  1915. form_params = []
  1916. local_var_files = {}
  1917. body_params = None
  1918. # HTTP header `Accept`
  1919. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  1920. # Authentication setting
  1921. auth_settings = ['apiv4'] # noqa: E501
  1922. return self.api_client.call_api(
  1923. '/options/orders',
  1924. 'GET',
  1925. path_params,
  1926. query_params,
  1927. header_params,
  1928. body=body_params,
  1929. post_params=form_params,
  1930. files=local_var_files,
  1931. response_type='list[OptionsOrder]', # noqa: E501
  1932. auth_settings=auth_settings,
  1933. async_req=local_var_params.get('async_req'),
  1934. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  1935. _preload_content=local_var_params.get('_preload_content', True),
  1936. _request_timeout=local_var_params.get('_request_timeout'),
  1937. collection_formats=collection_formats,
  1938. )
  1939. def create_options_order(self, options_order, **kwargs): # noqa: E501
  1940. """Create an options order # noqa: E501
  1941. This method makes a synchronous HTTP request by default. To make an
  1942. asynchronous HTTP request, please pass async_req=True
  1943. >>> thread = api.create_options_order(options_order, async_req=True)
  1944. >>> result = thread.get()
  1945. :param bool async_req: execute request asynchronously
  1946. :param OptionsOrder options_order: (required)
  1947. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1948. be returned without reading/decoding response
  1949. data. Default is True.
  1950. :param _request_timeout: timeout setting for this request. If one
  1951. number provided, it will be total request
  1952. timeout. It can also be a pair (tuple) of
  1953. (connection, read) timeouts.
  1954. :rtype: gate_api.OptionsOrder
  1955. :return: If the method is called asynchronously,
  1956. returns the request thread.
  1957. """
  1958. kwargs['_return_http_data_only'] = True
  1959. return self.create_options_order_with_http_info(options_order, **kwargs) # noqa: E501
  1960. def create_options_order_with_http_info(self, options_order, **kwargs): # noqa: E501
  1961. """Create an options order # noqa: E501
  1962. This method makes a synchronous HTTP request by default. To make an
  1963. asynchronous HTTP request, please pass async_req=True
  1964. >>> thread = api.create_options_order_with_http_info(options_order, async_req=True)
  1965. >>> result = thread.get()
  1966. :param bool async_req: execute request asynchronously
  1967. :param OptionsOrder options_order: (required)
  1968. :param _return_http_data_only: response data without head status code
  1969. and headers
  1970. :param _preload_content: if False, the urllib3.HTTPResponse object will
  1971. be returned without reading/decoding response
  1972. data. Default is True.
  1973. :param _request_timeout: timeout setting for this request. If one
  1974. number provided, it will be total request
  1975. timeout. It can also be a pair (tuple) of
  1976. (connection, read) timeouts.
  1977. :rtype: tuple(gate_api.OptionsOrder, status_code(int), headers(HTTPHeaderDict))
  1978. :return: If the method is called asynchronously,
  1979. returns the request thread.
  1980. """
  1981. local_var_params = locals()
  1982. all_params = ['options_order']
  1983. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  1984. for k, v in six.iteritems(local_var_params['kwargs']):
  1985. if k not in all_params:
  1986. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_options_order" % k)
  1987. local_var_params[k] = v
  1988. del local_var_params['kwargs']
  1989. # verify the required parameter 'options_order' is set
  1990. if self.api_client.client_side_validation and (
  1991. 'options_order' not in local_var_params or local_var_params['options_order'] is None # noqa: E501
  1992. ): # noqa: E501
  1993. raise ApiValueError(
  1994. "Missing the required parameter `options_order` when calling `create_options_order`"
  1995. ) # noqa: E501
  1996. collection_formats = {}
  1997. path_params = {}
  1998. query_params = []
  1999. header_params = {}
  2000. form_params = []
  2001. local_var_files = {}
  2002. body_params = None
  2003. if 'options_order' in local_var_params:
  2004. body_params = local_var_params['options_order']
  2005. # HTTP header `Accept`
  2006. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2007. # HTTP header `Content-Type`
  2008. header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
  2009. ['application/json']
  2010. ) # noqa: E501
  2011. # Authentication setting
  2012. auth_settings = ['apiv4'] # noqa: E501
  2013. return self.api_client.call_api(
  2014. '/options/orders',
  2015. 'POST',
  2016. path_params,
  2017. query_params,
  2018. header_params,
  2019. body=body_params,
  2020. post_params=form_params,
  2021. files=local_var_files,
  2022. response_type='OptionsOrder', # noqa: E501
  2023. auth_settings=auth_settings,
  2024. async_req=local_var_params.get('async_req'),
  2025. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2026. _preload_content=local_var_params.get('_preload_content', True),
  2027. _request_timeout=local_var_params.get('_request_timeout'),
  2028. collection_formats=collection_formats,
  2029. )
  2030. def cancel_options_orders(self, **kwargs): # noqa: E501
  2031. """Cancel all `open` orders matched # noqa: E501
  2032. This method makes a synchronous HTTP request by default. To make an
  2033. asynchronous HTTP request, please pass async_req=True
  2034. >>> thread = api.cancel_options_orders(async_req=True)
  2035. >>> result = thread.get()
  2036. :param bool async_req: execute request asynchronously
  2037. :param str contract: Options contract name
  2038. :param str underlying: Underlying
  2039. :param str side: All bids or asks. Both included if not specified
  2040. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2041. be returned without reading/decoding response
  2042. data. Default is True.
  2043. :param _request_timeout: timeout setting for this request. If one
  2044. number provided, it will be total request
  2045. timeout. It can also be a pair (tuple) of
  2046. (connection, read) timeouts.
  2047. :rtype: list[gate_api.OptionsOrder]
  2048. :return: If the method is called asynchronously,
  2049. returns the request thread.
  2050. """
  2051. kwargs['_return_http_data_only'] = True
  2052. return self.cancel_options_orders_with_http_info(**kwargs) # noqa: E501
  2053. def cancel_options_orders_with_http_info(self, **kwargs): # noqa: E501
  2054. """Cancel all `open` orders matched # noqa: E501
  2055. This method makes a synchronous HTTP request by default. To make an
  2056. asynchronous HTTP request, please pass async_req=True
  2057. >>> thread = api.cancel_options_orders_with_http_info(async_req=True)
  2058. >>> result = thread.get()
  2059. :param bool async_req: execute request asynchronously
  2060. :param str contract: Options contract name
  2061. :param str underlying: Underlying
  2062. :param str side: All bids or asks. Both included if not specified
  2063. :param _return_http_data_only: response data without head status code
  2064. and headers
  2065. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2066. be returned without reading/decoding response
  2067. data. Default is True.
  2068. :param _request_timeout: timeout setting for this request. If one
  2069. number provided, it will be total request
  2070. timeout. It can also be a pair (tuple) of
  2071. (connection, read) timeouts.
  2072. :rtype: tuple(list[gate_api.OptionsOrder], status_code(int), headers(HTTPHeaderDict))
  2073. :return: If the method is called asynchronously,
  2074. returns the request thread.
  2075. """
  2076. local_var_params = locals()
  2077. all_params = ['contract', 'underlying', 'side']
  2078. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2079. for k, v in six.iteritems(local_var_params['kwargs']):
  2080. if k not in all_params:
  2081. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_options_orders" % k)
  2082. local_var_params[k] = v
  2083. del local_var_params['kwargs']
  2084. collection_formats = {}
  2085. path_params = {}
  2086. query_params = []
  2087. if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501
  2088. query_params.append(('contract', local_var_params['contract'])) # noqa: E501
  2089. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  2090. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  2091. if 'side' in local_var_params and local_var_params['side'] is not None: # noqa: E501
  2092. query_params.append(('side', local_var_params['side'])) # noqa: E501
  2093. header_params = {}
  2094. form_params = []
  2095. local_var_files = {}
  2096. body_params = None
  2097. # HTTP header `Accept`
  2098. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2099. # Authentication setting
  2100. auth_settings = ['apiv4'] # noqa: E501
  2101. return self.api_client.call_api(
  2102. '/options/orders',
  2103. 'DELETE',
  2104. path_params,
  2105. query_params,
  2106. header_params,
  2107. body=body_params,
  2108. post_params=form_params,
  2109. files=local_var_files,
  2110. response_type='list[OptionsOrder]', # noqa: E501
  2111. auth_settings=auth_settings,
  2112. async_req=local_var_params.get('async_req'),
  2113. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2114. _preload_content=local_var_params.get('_preload_content', True),
  2115. _request_timeout=local_var_params.get('_request_timeout'),
  2116. collection_formats=collection_formats,
  2117. )
  2118. def get_options_order(self, order_id, **kwargs): # noqa: E501
  2119. """Get a single order # noqa: E501
  2120. This method makes a synchronous HTTP request by default. To make an
  2121. asynchronous HTTP request, please pass async_req=True
  2122. >>> thread = api.get_options_order(order_id, async_req=True)
  2123. >>> result = thread.get()
  2124. :param bool async_req: execute request asynchronously
  2125. :param int order_id: Order ID returned on successful order creation (required)
  2126. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2127. be returned without reading/decoding response
  2128. data. Default is True.
  2129. :param _request_timeout: timeout setting for this request. If one
  2130. number provided, it will be total request
  2131. timeout. It can also be a pair (tuple) of
  2132. (connection, read) timeouts.
  2133. :rtype: gate_api.OptionsOrder
  2134. :return: If the method is called asynchronously,
  2135. returns the request thread.
  2136. """
  2137. kwargs['_return_http_data_only'] = True
  2138. return self.get_options_order_with_http_info(order_id, **kwargs) # noqa: E501
  2139. def get_options_order_with_http_info(self, order_id, **kwargs): # noqa: E501
  2140. """Get a single order # noqa: E501
  2141. This method makes a synchronous HTTP request by default. To make an
  2142. asynchronous HTTP request, please pass async_req=True
  2143. >>> thread = api.get_options_order_with_http_info(order_id, async_req=True)
  2144. >>> result = thread.get()
  2145. :param bool async_req: execute request asynchronously
  2146. :param int order_id: Order ID returned on successful order creation (required)
  2147. :param _return_http_data_only: response data without head status code
  2148. and headers
  2149. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2150. be returned without reading/decoding response
  2151. data. Default is True.
  2152. :param _request_timeout: timeout setting for this request. If one
  2153. number provided, it will be total request
  2154. timeout. It can also be a pair (tuple) of
  2155. (connection, read) timeouts.
  2156. :rtype: tuple(gate_api.OptionsOrder, status_code(int), headers(HTTPHeaderDict))
  2157. :return: If the method is called asynchronously,
  2158. returns the request thread.
  2159. """
  2160. local_var_params = locals()
  2161. all_params = ['order_id']
  2162. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2163. for k, v in six.iteritems(local_var_params['kwargs']):
  2164. if k not in all_params:
  2165. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method get_options_order" % k)
  2166. local_var_params[k] = v
  2167. del local_var_params['kwargs']
  2168. # verify the required parameter 'order_id' is set
  2169. if self.api_client.client_side_validation and (
  2170. 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501
  2171. ): # noqa: E501
  2172. raise ApiValueError(
  2173. "Missing the required parameter `order_id` when calling `get_options_order`"
  2174. ) # noqa: E501
  2175. collection_formats = {}
  2176. path_params = {}
  2177. if 'order_id' in local_var_params:
  2178. path_params['order_id'] = local_var_params['order_id'] # noqa: E501
  2179. query_params = []
  2180. header_params = {}
  2181. form_params = []
  2182. local_var_files = {}
  2183. body_params = None
  2184. # HTTP header `Accept`
  2185. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2186. # Authentication setting
  2187. auth_settings = ['apiv4'] # noqa: E501
  2188. return self.api_client.call_api(
  2189. '/options/orders/{order_id}',
  2190. 'GET',
  2191. path_params,
  2192. query_params,
  2193. header_params,
  2194. body=body_params,
  2195. post_params=form_params,
  2196. files=local_var_files,
  2197. response_type='OptionsOrder', # noqa: E501
  2198. auth_settings=auth_settings,
  2199. async_req=local_var_params.get('async_req'),
  2200. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2201. _preload_content=local_var_params.get('_preload_content', True),
  2202. _request_timeout=local_var_params.get('_request_timeout'),
  2203. collection_formats=collection_formats,
  2204. )
  2205. def cancel_options_order(self, order_id, **kwargs): # noqa: E501
  2206. """Cancel a single order # noqa: E501
  2207. This method makes a synchronous HTTP request by default. To make an
  2208. asynchronous HTTP request, please pass async_req=True
  2209. >>> thread = api.cancel_options_order(order_id, async_req=True)
  2210. >>> result = thread.get()
  2211. :param bool async_req: execute request asynchronously
  2212. :param int order_id: Order ID returned on successful order creation (required)
  2213. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2214. be returned without reading/decoding response
  2215. data. Default is True.
  2216. :param _request_timeout: timeout setting for this request. If one
  2217. number provided, it will be total request
  2218. timeout. It can also be a pair (tuple) of
  2219. (connection, read) timeouts.
  2220. :rtype: gate_api.OptionsOrder
  2221. :return: If the method is called asynchronously,
  2222. returns the request thread.
  2223. """
  2224. kwargs['_return_http_data_only'] = True
  2225. return self.cancel_options_order_with_http_info(order_id, **kwargs) # noqa: E501
  2226. def cancel_options_order_with_http_info(self, order_id, **kwargs): # noqa: E501
  2227. """Cancel a single order # noqa: E501
  2228. This method makes a synchronous HTTP request by default. To make an
  2229. asynchronous HTTP request, please pass async_req=True
  2230. >>> thread = api.cancel_options_order_with_http_info(order_id, async_req=True)
  2231. >>> result = thread.get()
  2232. :param bool async_req: execute request asynchronously
  2233. :param int order_id: Order ID returned on successful order creation (required)
  2234. :param _return_http_data_only: response data without head status code
  2235. and headers
  2236. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2237. be returned without reading/decoding response
  2238. data. Default is True.
  2239. :param _request_timeout: timeout setting for this request. If one
  2240. number provided, it will be total request
  2241. timeout. It can also be a pair (tuple) of
  2242. (connection, read) timeouts.
  2243. :rtype: tuple(gate_api.OptionsOrder, status_code(int), headers(HTTPHeaderDict))
  2244. :return: If the method is called asynchronously,
  2245. returns the request thread.
  2246. """
  2247. local_var_params = locals()
  2248. all_params = ['order_id']
  2249. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2250. for k, v in six.iteritems(local_var_params['kwargs']):
  2251. if k not in all_params:
  2252. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method cancel_options_order" % k)
  2253. local_var_params[k] = v
  2254. del local_var_params['kwargs']
  2255. # verify the required parameter 'order_id' is set
  2256. if self.api_client.client_side_validation and (
  2257. 'order_id' not in local_var_params or local_var_params['order_id'] is None # noqa: E501
  2258. ): # noqa: E501
  2259. raise ApiValueError(
  2260. "Missing the required parameter `order_id` when calling `cancel_options_order`"
  2261. ) # noqa: E501
  2262. collection_formats = {}
  2263. path_params = {}
  2264. if 'order_id' in local_var_params:
  2265. path_params['order_id'] = local_var_params['order_id'] # noqa: E501
  2266. query_params = []
  2267. header_params = {}
  2268. form_params = []
  2269. local_var_files = {}
  2270. body_params = None
  2271. # HTTP header `Accept`
  2272. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2273. # Authentication setting
  2274. auth_settings = ['apiv4'] # noqa: E501
  2275. return self.api_client.call_api(
  2276. '/options/orders/{order_id}',
  2277. 'DELETE',
  2278. path_params,
  2279. query_params,
  2280. header_params,
  2281. body=body_params,
  2282. post_params=form_params,
  2283. files=local_var_files,
  2284. response_type='OptionsOrder', # noqa: E501
  2285. auth_settings=auth_settings,
  2286. async_req=local_var_params.get('async_req'),
  2287. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2288. _preload_content=local_var_params.get('_preload_content', True),
  2289. _request_timeout=local_var_params.get('_request_timeout'),
  2290. collection_formats=collection_formats,
  2291. )
  2292. def list_my_options_trades(self, underlying, **kwargs): # noqa: E501
  2293. """List personal trading history # noqa: E501
  2294. This method makes a synchronous HTTP request by default. To make an
  2295. asynchronous HTTP request, please pass async_req=True
  2296. >>> thread = api.list_my_options_trades(underlying, async_req=True)
  2297. >>> result = thread.get()
  2298. :param bool async_req: execute request asynchronously
  2299. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  2300. :param str contract: Options contract name
  2301. :param int limit: Maximum number of records to be returned in a single list
  2302. :param int offset: List offset, starting from 0
  2303. :param int _from: Start timestamp
  2304. :param int to: End timestamp
  2305. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2306. be returned without reading/decoding response
  2307. data. Default is True.
  2308. :param _request_timeout: timeout setting for this request. If one
  2309. number provided, it will be total request
  2310. timeout. It can also be a pair (tuple) of
  2311. (connection, read) timeouts.
  2312. :rtype: list[gate_api.OptionsMyTrade]
  2313. :return: If the method is called asynchronously,
  2314. returns the request thread.
  2315. """
  2316. kwargs['_return_http_data_only'] = True
  2317. return self.list_my_options_trades_with_http_info(underlying, **kwargs) # noqa: E501
  2318. def list_my_options_trades_with_http_info(self, underlying, **kwargs): # noqa: E501
  2319. """List personal trading history # noqa: E501
  2320. This method makes a synchronous HTTP request by default. To make an
  2321. asynchronous HTTP request, please pass async_req=True
  2322. >>> thread = api.list_my_options_trades_with_http_info(underlying, async_req=True)
  2323. >>> result = thread.get()
  2324. :param bool async_req: execute request asynchronously
  2325. :param str underlying: Underlying (Obtained by listing underlying endpoint) (required)
  2326. :param str contract: Options contract name
  2327. :param int limit: Maximum number of records to be returned in a single list
  2328. :param int offset: List offset, starting from 0
  2329. :param int _from: Start timestamp
  2330. :param int to: End timestamp
  2331. :param _return_http_data_only: response data without head status code
  2332. and headers
  2333. :param _preload_content: if False, the urllib3.HTTPResponse object will
  2334. be returned without reading/decoding response
  2335. data. Default is True.
  2336. :param _request_timeout: timeout setting for this request. If one
  2337. number provided, it will be total request
  2338. timeout. It can also be a pair (tuple) of
  2339. (connection, read) timeouts.
  2340. :rtype: tuple(list[gate_api.OptionsMyTrade], status_code(int), headers(HTTPHeaderDict))
  2341. :return: If the method is called asynchronously,
  2342. returns the request thread.
  2343. """
  2344. local_var_params = locals()
  2345. all_params = ['underlying', 'contract', 'limit', 'offset', '_from', 'to']
  2346. all_params.extend(['async_req', '_return_http_data_only', '_preload_content', '_request_timeout'])
  2347. for k, v in six.iteritems(local_var_params['kwargs']):
  2348. if k not in all_params:
  2349. raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_my_options_trades" % k)
  2350. local_var_params[k] = v
  2351. del local_var_params['kwargs']
  2352. # verify the required parameter 'underlying' is set
  2353. if self.api_client.client_side_validation and (
  2354. 'underlying' not in local_var_params or local_var_params['underlying'] is None # noqa: E501
  2355. ): # noqa: E501
  2356. raise ApiValueError(
  2357. "Missing the required parameter `underlying` when calling `list_my_options_trades`"
  2358. ) # noqa: E501
  2359. if (
  2360. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 1000
  2361. ): # noqa: E501
  2362. raise ApiValueError(
  2363. "Invalid value for parameter `limit` when calling `list_my_options_trades`, must be a value less than or equal to `1000`"
  2364. ) # noqa: E501
  2365. if (
  2366. self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1
  2367. ): # noqa: E501
  2368. raise ApiValueError(
  2369. "Invalid value for parameter `limit` when calling `list_my_options_trades`, must be a value greater than or equal to `1`"
  2370. ) # noqa: E501
  2371. if (
  2372. self.api_client.client_side_validation and 'offset' in local_var_params and local_var_params['offset'] < 0
  2373. ): # noqa: E501
  2374. raise ApiValueError(
  2375. "Invalid value for parameter `offset` when calling `list_my_options_trades`, must be a value greater than or equal to `0`"
  2376. ) # noqa: E501
  2377. collection_formats = {}
  2378. path_params = {}
  2379. query_params = []
  2380. if 'underlying' in local_var_params and local_var_params['underlying'] is not None: # noqa: E501
  2381. query_params.append(('underlying', local_var_params['underlying'])) # noqa: E501
  2382. if 'contract' in local_var_params and local_var_params['contract'] is not None: # noqa: E501
  2383. query_params.append(('contract', local_var_params['contract'])) # noqa: E501
  2384. if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
  2385. query_params.append(('limit', local_var_params['limit'])) # noqa: E501
  2386. if 'offset' in local_var_params and local_var_params['offset'] is not None: # noqa: E501
  2387. query_params.append(('offset', local_var_params['offset'])) # noqa: E501
  2388. if '_from' in local_var_params and local_var_params['_from'] is not None: # noqa: E501
  2389. query_params.append(('from', local_var_params['_from'])) # noqa: E501
  2390. if 'to' in local_var_params and local_var_params['to'] is not None: # noqa: E501
  2391. query_params.append(('to', local_var_params['to'])) # noqa: E501
  2392. header_params = {}
  2393. form_params = []
  2394. local_var_files = {}
  2395. body_params = None
  2396. # HTTP header `Accept`
  2397. header_params['Accept'] = self.api_client.select_header_accept(['application/json']) # noqa: E501
  2398. # Authentication setting
  2399. auth_settings = ['apiv4'] # noqa: E501
  2400. return self.api_client.call_api(
  2401. '/options/my_trades',
  2402. 'GET',
  2403. path_params,
  2404. query_params,
  2405. header_params,
  2406. body=body_params,
  2407. post_params=form_params,
  2408. files=local_var_files,
  2409. response_type='list[OptionsMyTrade]', # noqa: E501
  2410. auth_settings=auth_settings,
  2411. async_req=local_var_params.get('async_req'),
  2412. _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
  2413. _preload_content=local_var_params.get('_preload_content', True),
  2414. _request_timeout=local_var_params.get('_request_timeout'),
  2415. collection_formats=collection_formats,
  2416. )