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

248 lines
9.0 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 FuturesPriceTrigger(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 = {'strategy_type': 'int', 'price_type': 'int', 'price': 'str', 'rule': 'int', 'expiration': 'int'}
  25. attribute_map = {
  26. 'strategy_type': 'strategy_type',
  27. 'price_type': 'price_type',
  28. 'price': 'price',
  29. 'rule': 'rule',
  30. 'expiration': 'expiration',
  31. }
  32. def __init__(
  33. self, strategy_type=None, price_type=None, price=None, rule=None, expiration=None, local_vars_configuration=None
  34. ): # noqa: E501
  35. # type: (int, int, str, int, int, Configuration) -> None
  36. """FuturesPriceTrigger - a model defined in OpenAPI""" # noqa: E501
  37. if local_vars_configuration is None:
  38. local_vars_configuration = Configuration()
  39. self.local_vars_configuration = local_vars_configuration
  40. self._strategy_type = None
  41. self._price_type = None
  42. self._price = None
  43. self._rule = None
  44. self._expiration = None
  45. self.discriminator = None
  46. if strategy_type is not None:
  47. self.strategy_type = strategy_type
  48. if price_type is not None:
  49. self.price_type = price_type
  50. if price is not None:
  51. self.price = price
  52. if rule is not None:
  53. self.rule = rule
  54. if expiration is not None:
  55. self.expiration = expiration
  56. @property
  57. def strategy_type(self):
  58. """Gets the strategy_type of this FuturesPriceTrigger. # noqa: E501
  59. How the order will be triggered - `0`: by price, which means the order will be triggered if price condition is satisfied - `1`: by price gap, which means the order will be triggered if gap of recent two prices of specified `price_type` are satisfied. Only `0` is supported currently # noqa: E501
  60. :return: The strategy_type of this FuturesPriceTrigger. # noqa: E501
  61. :rtype: int
  62. """
  63. return self._strategy_type
  64. @strategy_type.setter
  65. def strategy_type(self, strategy_type):
  66. """Sets the strategy_type of this FuturesPriceTrigger.
  67. How the order will be triggered - `0`: by price, which means the order will be triggered if price condition is satisfied - `1`: by price gap, which means the order will be triggered if gap of recent two prices of specified `price_type` are satisfied. Only `0` is supported currently # noqa: E501
  68. :param strategy_type: The strategy_type of this FuturesPriceTrigger. # noqa: E501
  69. :type: int
  70. """
  71. allowed_values = [0, 1] # noqa: E501
  72. if self.local_vars_configuration.client_side_validation and strategy_type not in allowed_values: # noqa: E501
  73. raise ValueError(
  74. "Invalid value for `strategy_type` ({0}), must be one of {1}".format( # noqa: E501
  75. strategy_type, allowed_values
  76. )
  77. )
  78. self._strategy_type = strategy_type
  79. @property
  80. def price_type(self):
  81. """Gets the price_type of this FuturesPriceTrigger. # noqa: E501
  82. Price type. 0 - latest deal price, 1 - mark price, 2 - index price # noqa: E501
  83. :return: The price_type of this FuturesPriceTrigger. # noqa: E501
  84. :rtype: int
  85. """
  86. return self._price_type
  87. @price_type.setter
  88. def price_type(self, price_type):
  89. """Sets the price_type of this FuturesPriceTrigger.
  90. Price type. 0 - latest deal price, 1 - mark price, 2 - index price # noqa: E501
  91. :param price_type: The price_type of this FuturesPriceTrigger. # noqa: E501
  92. :type: int
  93. """
  94. allowed_values = [0, 1, 2] # noqa: E501
  95. if self.local_vars_configuration.client_side_validation and price_type not in allowed_values: # noqa: E501
  96. raise ValueError(
  97. "Invalid value for `price_type` ({0}), must be one of {1}".format( # noqa: E501
  98. price_type, allowed_values
  99. )
  100. )
  101. self._price_type = price_type
  102. @property
  103. def price(self):
  104. """Gets the price of this FuturesPriceTrigger. # noqa: E501
  105. Value of price on price triggered, or price gap on price gap triggered # noqa: E501
  106. :return: The price of this FuturesPriceTrigger. # noqa: E501
  107. :rtype: str
  108. """
  109. return self._price
  110. @price.setter
  111. def price(self, price):
  112. """Sets the price of this FuturesPriceTrigger.
  113. Value of price on price triggered, or price gap on price gap triggered # noqa: E501
  114. :param price: The price of this FuturesPriceTrigger. # noqa: E501
  115. :type: str
  116. """
  117. self._price = price
  118. @property
  119. def rule(self):
  120. """Gets the rule of this FuturesPriceTrigger. # noqa: E501
  121. Trigger condition type - `1`: calculated price based on `strategy_type` and `price_type` >= `price` - `2`: calculated price based on `strategy_type` and `price_type` <= `price` # noqa: E501
  122. :return: The rule of this FuturesPriceTrigger. # noqa: E501
  123. :rtype: int
  124. """
  125. return self._rule
  126. @rule.setter
  127. def rule(self, rule):
  128. """Sets the rule of this FuturesPriceTrigger.
  129. Trigger condition type - `1`: calculated price based on `strategy_type` and `price_type` >= `price` - `2`: calculated price based on `strategy_type` and `price_type` <= `price` # noqa: E501
  130. :param rule: The rule of this FuturesPriceTrigger. # noqa: E501
  131. :type: int
  132. """
  133. allowed_values = [1, 2] # noqa: E501
  134. if self.local_vars_configuration.client_side_validation and rule not in allowed_values: # noqa: E501
  135. raise ValueError(
  136. "Invalid value for `rule` ({0}), must be one of {1}".format(rule, allowed_values) # noqa: E501
  137. )
  138. self._rule = rule
  139. @property
  140. def expiration(self):
  141. """Gets the expiration of this FuturesPriceTrigger. # noqa: E501
  142. How long (in seconds) to wait for the condition to be triggered before cancelling the order. # noqa: E501
  143. :return: The expiration of this FuturesPriceTrigger. # noqa: E501
  144. :rtype: int
  145. """
  146. return self._expiration
  147. @expiration.setter
  148. def expiration(self, expiration):
  149. """Sets the expiration of this FuturesPriceTrigger.
  150. How long (in seconds) to wait for the condition to be triggered before cancelling the order. # noqa: E501
  151. :param expiration: The expiration of this FuturesPriceTrigger. # noqa: E501
  152. :type: int
  153. """
  154. self._expiration = expiration
  155. def to_dict(self):
  156. """Returns the model properties as a dict"""
  157. result = {}
  158. for attr, _ in six.iteritems(self.openapi_types):
  159. value = getattr(self, attr)
  160. if isinstance(value, list):
  161. result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
  162. elif hasattr(value, "to_dict"):
  163. result[attr] = value.to_dict()
  164. elif isinstance(value, dict):
  165. result[attr] = dict(
  166. map(
  167. lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
  168. value.items(),
  169. )
  170. )
  171. else:
  172. result[attr] = value
  173. return result
  174. def to_str(self):
  175. """Returns the string representation of the model"""
  176. return pprint.pformat(self.to_dict())
  177. def __repr__(self):
  178. """For `print` and `pprint`"""
  179. return self.to_str()
  180. def __eq__(self, other):
  181. """Returns true if both objects are equal"""
  182. if not isinstance(other, FuturesPriceTrigger):
  183. return False
  184. return self.to_dict() == other.to_dict()
  185. def __ne__(self, other):
  186. """Returns true if both objects are not equal"""
  187. if not isinstance(other, FuturesPriceTrigger):
  188. return True
  189. return self.to_dict() != other.to_dict()