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

791 lines
24 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. import pprint
  9. import re # noqa: F401
  10. import six
  11. from gate_api.configuration import Configuration
  12. class OptionsOrder(object):
  13. """NOTE: This class is auto generated by OpenAPI Generator.
  14. Ref: https://openapi-generator.tech
  15. Do not edit the class manually.
  16. """
  17. """
  18. Attributes:
  19. openapi_types (dict): The key is attribute name
  20. and the value is attribute type.
  21. attribute_map (dict): The key is attribute name
  22. and the value is json key in definition.
  23. """
  24. openapi_types = {
  25. 'id': 'int',
  26. 'user': 'int',
  27. 'create_time': 'float',
  28. 'finish_time': 'float',
  29. 'finish_as': 'str',
  30. 'status': 'str',
  31. 'contract': 'str',
  32. 'size': 'int',
  33. 'iceberg': 'int',
  34. 'price': 'str',
  35. 'close': 'bool',
  36. 'is_close': 'bool',
  37. 'reduce_only': 'bool',
  38. 'is_reduce_only': 'bool',
  39. 'is_liq': 'bool',
  40. 'tif': 'str',
  41. 'left': 'int',
  42. 'fill_price': 'str',
  43. 'text': 'str',
  44. 'tkfr': 'str',
  45. 'mkfr': 'str',
  46. 'refu': 'int',
  47. 'refr': 'str',
  48. }
  49. attribute_map = {
  50. 'id': 'id',
  51. 'user': 'user',
  52. 'create_time': 'create_time',
  53. 'finish_time': 'finish_time',
  54. 'finish_as': 'finish_as',
  55. 'status': 'status',
  56. 'contract': 'contract',
  57. 'size': 'size',
  58. 'iceberg': 'iceberg',
  59. 'price': 'price',
  60. 'close': 'close',
  61. 'is_close': 'is_close',
  62. 'reduce_only': 'reduce_only',
  63. 'is_reduce_only': 'is_reduce_only',
  64. 'is_liq': 'is_liq',
  65. 'tif': 'tif',
  66. 'left': 'left',
  67. 'fill_price': 'fill_price',
  68. 'text': 'text',
  69. 'tkfr': 'tkfr',
  70. 'mkfr': 'mkfr',
  71. 'refu': 'refu',
  72. 'refr': 'refr',
  73. }
  74. def __init__(
  75. self,
  76. id=None,
  77. user=None,
  78. create_time=None,
  79. finish_time=None,
  80. finish_as=None,
  81. status=None,
  82. contract=None,
  83. size=None,
  84. iceberg=None,
  85. price=None,
  86. close=False,
  87. is_close=None,
  88. reduce_only=False,
  89. is_reduce_only=None,
  90. is_liq=None,
  91. tif='gtc',
  92. left=None,
  93. fill_price=None,
  94. text=None,
  95. tkfr=None,
  96. mkfr=None,
  97. refu=None,
  98. refr=None,
  99. local_vars_configuration=None,
  100. ): # noqa: E501
  101. # type: (int, int, float, float, str, str, str, int, int, str, bool, bool, bool, bool, bool, str, int, str, str, str, str, int, str, Configuration) -> None
  102. """OptionsOrder - a model defined in OpenAPI""" # noqa: E501
  103. if local_vars_configuration is None:
  104. local_vars_configuration = Configuration()
  105. self.local_vars_configuration = local_vars_configuration
  106. self._id = None
  107. self._user = None
  108. self._create_time = None
  109. self._finish_time = None
  110. self._finish_as = None
  111. self._status = None
  112. self._contract = None
  113. self._size = None
  114. self._iceberg = None
  115. self._price = None
  116. self._close = None
  117. self._is_close = None
  118. self._reduce_only = None
  119. self._is_reduce_only = None
  120. self._is_liq = None
  121. self._tif = None
  122. self._left = None
  123. self._fill_price = None
  124. self._text = None
  125. self._tkfr = None
  126. self._mkfr = None
  127. self._refu = None
  128. self._refr = None
  129. self.discriminator = None
  130. if id is not None:
  131. self.id = id
  132. if user is not None:
  133. self.user = user
  134. if create_time is not None:
  135. self.create_time = create_time
  136. if finish_time is not None:
  137. self.finish_time = finish_time
  138. if finish_as is not None:
  139. self.finish_as = finish_as
  140. if status is not None:
  141. self.status = status
  142. self.contract = contract
  143. self.size = size
  144. if iceberg is not None:
  145. self.iceberg = iceberg
  146. if price is not None:
  147. self.price = price
  148. if close is not None:
  149. self.close = close
  150. if is_close is not None:
  151. self.is_close = is_close
  152. if reduce_only is not None:
  153. self.reduce_only = reduce_only
  154. if is_reduce_only is not None:
  155. self.is_reduce_only = is_reduce_only
  156. if is_liq is not None:
  157. self.is_liq = is_liq
  158. if tif is not None:
  159. self.tif = tif
  160. if left is not None:
  161. self.left = left
  162. if fill_price is not None:
  163. self.fill_price = fill_price
  164. if text is not None:
  165. self.text = text
  166. if tkfr is not None:
  167. self.tkfr = tkfr
  168. if mkfr is not None:
  169. self.mkfr = mkfr
  170. if refu is not None:
  171. self.refu = refu
  172. if refr is not None:
  173. self.refr = refr
  174. @property
  175. def id(self):
  176. """Gets the id of this OptionsOrder. # noqa: E501
  177. Options order ID # noqa: E501
  178. :return: The id of this OptionsOrder. # noqa: E501
  179. :rtype: int
  180. """
  181. return self._id
  182. @id.setter
  183. def id(self, id):
  184. """Sets the id of this OptionsOrder.
  185. Options order ID # noqa: E501
  186. :param id: The id of this OptionsOrder. # noqa: E501
  187. :type: int
  188. """
  189. self._id = id
  190. @property
  191. def user(self):
  192. """Gets the user of this OptionsOrder. # noqa: E501
  193. User ID # noqa: E501
  194. :return: The user of this OptionsOrder. # noqa: E501
  195. :rtype: int
  196. """
  197. return self._user
  198. @user.setter
  199. def user(self, user):
  200. """Sets the user of this OptionsOrder.
  201. User ID # noqa: E501
  202. :param user: The user of this OptionsOrder. # noqa: E501
  203. :type: int
  204. """
  205. self._user = user
  206. @property
  207. def create_time(self):
  208. """Gets the create_time of this OptionsOrder. # noqa: E501
  209. Creation time of order # noqa: E501
  210. :return: The create_time of this OptionsOrder. # noqa: E501
  211. :rtype: float
  212. """
  213. return self._create_time
  214. @create_time.setter
  215. def create_time(self, create_time):
  216. """Sets the create_time of this OptionsOrder.
  217. Creation time of order # noqa: E501
  218. :param create_time: The create_time of this OptionsOrder. # noqa: E501
  219. :type: float
  220. """
  221. self._create_time = create_time
  222. @property
  223. def finish_time(self):
  224. """Gets the finish_time of this OptionsOrder. # noqa: E501
  225. Order finished time. Not returned if order is open # noqa: E501
  226. :return: The finish_time of this OptionsOrder. # noqa: E501
  227. :rtype: float
  228. """
  229. return self._finish_time
  230. @finish_time.setter
  231. def finish_time(self, finish_time):
  232. """Sets the finish_time of this OptionsOrder.
  233. Order finished time. Not returned if order is open # noqa: E501
  234. :param finish_time: The finish_time of this OptionsOrder. # noqa: E501
  235. :type: float
  236. """
  237. self._finish_time = finish_time
  238. @property
  239. def finish_as(self):
  240. """Gets the finish_as of this OptionsOrder. # noqa: E501
  241. How the order was finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close # noqa: E501
  242. :return: The finish_as of this OptionsOrder. # noqa: E501
  243. :rtype: str
  244. """
  245. return self._finish_as
  246. @finish_as.setter
  247. def finish_as(self, finish_as):
  248. """Sets the finish_as of this OptionsOrder.
  249. How the order was finished. - filled: all filled - cancelled: manually cancelled - liquidated: cancelled because of liquidation - ioc: time in force is `IOC`, finish immediately - auto_deleveraged: finished by ADL - reduce_only: cancelled because of increasing position while `reduce-only` set- position_closed: cancelled because of position close # noqa: E501
  250. :param finish_as: The finish_as of this OptionsOrder. # noqa: E501
  251. :type: str
  252. """
  253. allowed_values = [
  254. "filled",
  255. "cancelled",
  256. "liquidated",
  257. "ioc",
  258. "auto_deleveraged",
  259. "reduce_only",
  260. "position_closed",
  261. "reduce_out",
  262. ] # noqa: E501
  263. if self.local_vars_configuration.client_side_validation and finish_as not in allowed_values: # noqa: E501
  264. raise ValueError(
  265. "Invalid value for `finish_as` ({0}), must be one of {1}".format( # noqa: E501
  266. finish_as, allowed_values
  267. )
  268. )
  269. self._finish_as = finish_as
  270. @property
  271. def status(self):
  272. """Gets the status of this OptionsOrder. # noqa: E501
  273. Order status - `open`: waiting to be traded - `finished`: finished # noqa: E501
  274. :return: The status of this OptionsOrder. # noqa: E501
  275. :rtype: str
  276. """
  277. return self._status
  278. @status.setter
  279. def status(self, status):
  280. """Sets the status of this OptionsOrder.
  281. Order status - `open`: waiting to be traded - `finished`: finished # noqa: E501
  282. :param status: The status of this OptionsOrder. # noqa: E501
  283. :type: str
  284. """
  285. allowed_values = ["open", "finished"] # noqa: E501
  286. if self.local_vars_configuration.client_side_validation and status not in allowed_values: # noqa: E501
  287. raise ValueError(
  288. "Invalid value for `status` ({0}), must be one of {1}".format(status, allowed_values) # noqa: E501
  289. )
  290. self._status = status
  291. @property
  292. def contract(self):
  293. """Gets the contract of this OptionsOrder. # noqa: E501
  294. Contract name # noqa: E501
  295. :return: The contract of this OptionsOrder. # noqa: E501
  296. :rtype: str
  297. """
  298. return self._contract
  299. @contract.setter
  300. def contract(self, contract):
  301. """Sets the contract of this OptionsOrder.
  302. Contract name # noqa: E501
  303. :param contract: The contract of this OptionsOrder. # noqa: E501
  304. :type: str
  305. """
  306. if self.local_vars_configuration.client_side_validation and contract is None: # noqa: E501
  307. raise ValueError("Invalid value for `contract`, must not be `None`") # noqa: E501
  308. self._contract = contract
  309. @property
  310. def size(self):
  311. """Gets the size of this OptionsOrder. # noqa: E501
  312. Order size. Specify positive number to make a bid, and negative number to ask # noqa: E501
  313. :return: The size of this OptionsOrder. # noqa: E501
  314. :rtype: int
  315. """
  316. return self._size
  317. @size.setter
  318. def size(self, size):
  319. """Sets the size of this OptionsOrder.
  320. Order size. Specify positive number to make a bid, and negative number to ask # noqa: E501
  321. :param size: The size of this OptionsOrder. # noqa: E501
  322. :type: int
  323. """
  324. if self.local_vars_configuration.client_side_validation and size is None: # noqa: E501
  325. raise ValueError("Invalid value for `size`, must not be `None`") # noqa: E501
  326. self._size = size
  327. @property
  328. def iceberg(self):
  329. """Gets the iceberg of this OptionsOrder. # noqa: E501
  330. Display size for iceberg order. 0 for non-iceberg. Note that you will have to pay the taker fee for the hidden size # noqa: E501
  331. :return: The iceberg of this OptionsOrder. # noqa: E501
  332. :rtype: int
  333. """
  334. return self._iceberg
  335. @iceberg.setter
  336. def iceberg(self, iceberg):
  337. """Sets the iceberg of this OptionsOrder.
  338. Display size for iceberg order. 0 for non-iceberg. Note that you will have to pay the taker fee for the hidden size # noqa: E501
  339. :param iceberg: The iceberg of this OptionsOrder. # noqa: E501
  340. :type: int
  341. """
  342. self._iceberg = iceberg
  343. @property
  344. def price(self):
  345. """Gets the price of this OptionsOrder. # noqa: E501
  346. Order price. 0 for market order with `tif` set as `ioc` (USDT) # noqa: E501
  347. :return: The price of this OptionsOrder. # noqa: E501
  348. :rtype: str
  349. """
  350. return self._price
  351. @price.setter
  352. def price(self, price):
  353. """Sets the price of this OptionsOrder.
  354. Order price. 0 for market order with `tif` set as `ioc` (USDT) # noqa: E501
  355. :param price: The price of this OptionsOrder. # noqa: E501
  356. :type: str
  357. """
  358. self._price = price
  359. @property
  360. def close(self):
  361. """Gets the close of this OptionsOrder. # noqa: E501
  362. Set as `true` to close the position, with `size` set to 0 # noqa: E501
  363. :return: The close of this OptionsOrder. # noqa: E501
  364. :rtype: bool
  365. """
  366. return self._close
  367. @close.setter
  368. def close(self, close):
  369. """Sets the close of this OptionsOrder.
  370. Set as `true` to close the position, with `size` set to 0 # noqa: E501
  371. :param close: The close of this OptionsOrder. # noqa: E501
  372. :type: bool
  373. """
  374. self._close = close
  375. @property
  376. def is_close(self):
  377. """Gets the is_close of this OptionsOrder. # noqa: E501
  378. Is the order to close position # noqa: E501
  379. :return: The is_close of this OptionsOrder. # noqa: E501
  380. :rtype: bool
  381. """
  382. return self._is_close
  383. @is_close.setter
  384. def is_close(self, is_close):
  385. """Sets the is_close of this OptionsOrder.
  386. Is the order to close position # noqa: E501
  387. :param is_close: The is_close of this OptionsOrder. # noqa: E501
  388. :type: bool
  389. """
  390. self._is_close = is_close
  391. @property
  392. def reduce_only(self):
  393. """Gets the reduce_only of this OptionsOrder. # noqa: E501
  394. Set as `true` to be reduce-only order # noqa: E501
  395. :return: The reduce_only of this OptionsOrder. # noqa: E501
  396. :rtype: bool
  397. """
  398. return self._reduce_only
  399. @reduce_only.setter
  400. def reduce_only(self, reduce_only):
  401. """Sets the reduce_only of this OptionsOrder.
  402. Set as `true` to be reduce-only order # noqa: E501
  403. :param reduce_only: The reduce_only of this OptionsOrder. # noqa: E501
  404. :type: bool
  405. """
  406. self._reduce_only = reduce_only
  407. @property
  408. def is_reduce_only(self):
  409. """Gets the is_reduce_only of this OptionsOrder. # noqa: E501
  410. Is the order reduce-only # noqa: E501
  411. :return: The is_reduce_only of this OptionsOrder. # noqa: E501
  412. :rtype: bool
  413. """
  414. return self._is_reduce_only
  415. @is_reduce_only.setter
  416. def is_reduce_only(self, is_reduce_only):
  417. """Sets the is_reduce_only of this OptionsOrder.
  418. Is the order reduce-only # noqa: E501
  419. :param is_reduce_only: The is_reduce_only of this OptionsOrder. # noqa: E501
  420. :type: bool
  421. """
  422. self._is_reduce_only = is_reduce_only
  423. @property
  424. def is_liq(self):
  425. """Gets the is_liq of this OptionsOrder. # noqa: E501
  426. Is the order for liquidation # noqa: E501
  427. :return: The is_liq of this OptionsOrder. # noqa: E501
  428. :rtype: bool
  429. """
  430. return self._is_liq
  431. @is_liq.setter
  432. def is_liq(self, is_liq):
  433. """Sets the is_liq of this OptionsOrder.
  434. Is the order for liquidation # noqa: E501
  435. :param is_liq: The is_liq of this OptionsOrder. # noqa: E501
  436. :type: bool
  437. """
  438. self._is_liq = is_liq
  439. @property
  440. def tif(self):
  441. """Gets the tif of this OptionsOrder. # noqa: E501
  442. Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee # noqa: E501
  443. :return: The tif of this OptionsOrder. # noqa: E501
  444. :rtype: str
  445. """
  446. return self._tif
  447. @tif.setter
  448. def tif(self, tif):
  449. """Sets the tif of this OptionsOrder.
  450. Time in force - gtc: GoodTillCancelled - ioc: ImmediateOrCancelled, taker only - poc: PendingOrCancelled, makes a post-only order that always enjoys a maker fee # noqa: E501
  451. :param tif: The tif of this OptionsOrder. # noqa: E501
  452. :type: str
  453. """
  454. allowed_values = ["gtc", "ioc", "poc"] # noqa: E501
  455. if self.local_vars_configuration.client_side_validation and tif not in allowed_values: # noqa: E501
  456. raise ValueError(
  457. "Invalid value for `tif` ({0}), must be one of {1}".format(tif, allowed_values) # noqa: E501
  458. )
  459. self._tif = tif
  460. @property
  461. def left(self):
  462. """Gets the left of this OptionsOrder. # noqa: E501
  463. Size left to be traded # noqa: E501
  464. :return: The left of this OptionsOrder. # noqa: E501
  465. :rtype: int
  466. """
  467. return self._left
  468. @left.setter
  469. def left(self, left):
  470. """Sets the left of this OptionsOrder.
  471. Size left to be traded # noqa: E501
  472. :param left: The left of this OptionsOrder. # noqa: E501
  473. :type: int
  474. """
  475. self._left = left
  476. @property
  477. def fill_price(self):
  478. """Gets the fill_price of this OptionsOrder. # noqa: E501
  479. Fill price of the order # noqa: E501
  480. :return: The fill_price of this OptionsOrder. # noqa: E501
  481. :rtype: str
  482. """
  483. return self._fill_price
  484. @fill_price.setter
  485. def fill_price(self, fill_price):
  486. """Sets the fill_price of this OptionsOrder.
  487. Fill price of the order # noqa: E501
  488. :param fill_price: The fill_price of this OptionsOrder. # noqa: E501
  489. :type: str
  490. """
  491. self._fill_price = fill_price
  492. @property
  493. def text(self):
  494. """Gets the text of this OptionsOrder. # noqa: E501
  495. User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance # noqa: E501
  496. :return: The text of this OptionsOrder. # noqa: E501
  497. :rtype: str
  498. """
  499. return self._text
  500. @text.setter
  501. def text(self, text):
  502. """Sets the text of this OptionsOrder.
  503. User defined information. If not empty, must follow the rules below: 1. prefixed with `t-` 2. no longer than 28 bytes without `t-` prefix 3. can only include 0-9, A-Z, a-z, underscore(_), hyphen(-) or dot(.) Besides user defined information, reserved contents are listed below, denoting how the order is created: - web: from web - api: from API - app: from mobile phones - auto_deleveraging: from ADL - liquidation: from liquidation - insurance: from insurance # noqa: E501
  504. :param text: The text of this OptionsOrder. # noqa: E501
  505. :type: str
  506. """
  507. self._text = text
  508. @property
  509. def tkfr(self):
  510. """Gets the tkfr of this OptionsOrder. # noqa: E501
  511. Taker fee # noqa: E501
  512. :return: The tkfr of this OptionsOrder. # noqa: E501
  513. :rtype: str
  514. """
  515. return self._tkfr
  516. @tkfr.setter
  517. def tkfr(self, tkfr):
  518. """Sets the tkfr of this OptionsOrder.
  519. Taker fee # noqa: E501
  520. :param tkfr: The tkfr of this OptionsOrder. # noqa: E501
  521. :type: str
  522. """
  523. self._tkfr = tkfr
  524. @property
  525. def mkfr(self):
  526. """Gets the mkfr of this OptionsOrder. # noqa: E501
  527. Maker fee # noqa: E501
  528. :return: The mkfr of this OptionsOrder. # noqa: E501
  529. :rtype: str
  530. """
  531. return self._mkfr
  532. @mkfr.setter
  533. def mkfr(self, mkfr):
  534. """Sets the mkfr of this OptionsOrder.
  535. Maker fee # noqa: E501
  536. :param mkfr: The mkfr of this OptionsOrder. # noqa: E501
  537. :type: str
  538. """
  539. self._mkfr = mkfr
  540. @property
  541. def refu(self):
  542. """Gets the refu of this OptionsOrder. # noqa: E501
  543. Reference user ID # noqa: E501
  544. :return: The refu of this OptionsOrder. # noqa: E501
  545. :rtype: int
  546. """
  547. return self._refu
  548. @refu.setter
  549. def refu(self, refu):
  550. """Sets the refu of this OptionsOrder.
  551. Reference user ID # noqa: E501
  552. :param refu: The refu of this OptionsOrder. # noqa: E501
  553. :type: int
  554. """
  555. self._refu = refu
  556. @property
  557. def refr(self):
  558. """Gets the refr of this OptionsOrder. # noqa: E501
  559. Referrer rebate # noqa: E501
  560. :return: The refr of this OptionsOrder. # noqa: E501
  561. :rtype: str
  562. """
  563. return self._refr
  564. @refr.setter
  565. def refr(self, refr):
  566. """Sets the refr of this OptionsOrder.
  567. Referrer rebate # noqa: E501
  568. :param refr: The refr of this OptionsOrder. # noqa: E501
  569. :type: str
  570. """
  571. self._refr = refr
  572. def to_dict(self):
  573. """Returns the model properties as a dict"""
  574. result = {}
  575. for attr, _ in six.iteritems(self.openapi_types):
  576. value = getattr(self, attr)
  577. if isinstance(value, list):
  578. result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
  579. elif hasattr(value, "to_dict"):
  580. result[attr] = value.to_dict()
  581. elif isinstance(value, dict):
  582. result[attr] = dict(
  583. map(
  584. lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
  585. value.items(),
  586. )
  587. )
  588. else:
  589. result[attr] = value
  590. return result
  591. def to_str(self):
  592. """Returns the string representation of the model"""
  593. return pprint.pformat(self.to_dict())
  594. def __repr__(self):
  595. """For `print` and `pprint`"""
  596. return self.to_str()
  597. def __eq__(self, other):
  598. """Returns true if both objects are equal"""
  599. if not isinstance(other, OptionsOrder):
  600. return False
  601. return self.to_dict() == other.to_dict()
  602. def __ne__(self, other):
  603. """Returns true if both objects are not equal"""
  604. if not isinstance(other, OptionsOrder):
  605. return True
  606. return self.to_dict() != other.to_dict()