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

177 lines
6.2 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 SpotPriceTrigger(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 = {'price': 'str', 'rule': 'str', 'expiration': 'int'}
  25. attribute_map = {'price': 'price', 'rule': 'rule', 'expiration': 'expiration'}
  26. def __init__(self, price=None, rule=None, expiration=None, local_vars_configuration=None): # noqa: E501
  27. # type: (str, str, int, Configuration) -> None
  28. """SpotPriceTrigger - a model defined in OpenAPI""" # noqa: E501
  29. if local_vars_configuration is None:
  30. local_vars_configuration = Configuration()
  31. self.local_vars_configuration = local_vars_configuration
  32. self._price = None
  33. self._rule = None
  34. self._expiration = None
  35. self.discriminator = None
  36. self.price = price
  37. self.rule = rule
  38. self.expiration = expiration
  39. @property
  40. def price(self):
  41. """Gets the price of this SpotPriceTrigger. # noqa: E501
  42. Trigger price # noqa: E501
  43. :return: The price of this SpotPriceTrigger. # noqa: E501
  44. :rtype: str
  45. """
  46. return self._price
  47. @price.setter
  48. def price(self, price):
  49. """Sets the price of this SpotPriceTrigger.
  50. Trigger price # noqa: E501
  51. :param price: The price of this SpotPriceTrigger. # noqa: E501
  52. :type: str
  53. """
  54. if self.local_vars_configuration.client_side_validation and price is None: # noqa: E501
  55. raise ValueError("Invalid value for `price`, must not be `None`") # noqa: E501
  56. self._price = price
  57. @property
  58. def rule(self):
  59. """Gets the rule of this SpotPriceTrigger. # noqa: E501
  60. Price trigger condition - >=: triggered when market price larger than or equal to `price` field - <=: triggered when market price less than or equal to `price` field # noqa: E501
  61. :return: The rule of this SpotPriceTrigger. # noqa: E501
  62. :rtype: str
  63. """
  64. return self._rule
  65. @rule.setter
  66. def rule(self, rule):
  67. """Sets the rule of this SpotPriceTrigger.
  68. Price trigger condition - >=: triggered when market price larger than or equal to `price` field - <=: triggered when market price less than or equal to `price` field # noqa: E501
  69. :param rule: The rule of this SpotPriceTrigger. # noqa: E501
  70. :type: str
  71. """
  72. if self.local_vars_configuration.client_side_validation and rule is None: # noqa: E501
  73. raise ValueError("Invalid value for `rule`, must not be `None`") # noqa: E501
  74. allowed_values = [">=", "<="] # noqa: E501
  75. if self.local_vars_configuration.client_side_validation and rule not in allowed_values: # noqa: E501
  76. raise ValueError(
  77. "Invalid value for `rule` ({0}), must be one of {1}".format(rule, allowed_values) # noqa: E501
  78. )
  79. self._rule = rule
  80. @property
  81. def expiration(self):
  82. """Gets the expiration of this SpotPriceTrigger. # noqa: E501
  83. How long (in seconds) to wait for the condition to be triggered before cancelling the order. # noqa: E501
  84. :return: The expiration of this SpotPriceTrigger. # noqa: E501
  85. :rtype: int
  86. """
  87. return self._expiration
  88. @expiration.setter
  89. def expiration(self, expiration):
  90. """Sets the expiration of this SpotPriceTrigger.
  91. How long (in seconds) to wait for the condition to be triggered before cancelling the order. # noqa: E501
  92. :param expiration: The expiration of this SpotPriceTrigger. # noqa: E501
  93. :type: int
  94. """
  95. if self.local_vars_configuration.client_side_validation and expiration is None: # noqa: E501
  96. raise ValueError("Invalid value for `expiration`, must not be `None`") # noqa: E501
  97. self._expiration = expiration
  98. def to_dict(self):
  99. """Returns the model properties as a dict"""
  100. result = {}
  101. for attr, _ in six.iteritems(self.openapi_types):
  102. value = getattr(self, attr)
  103. if isinstance(value, list):
  104. result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
  105. elif hasattr(value, "to_dict"):
  106. result[attr] = value.to_dict()
  107. elif isinstance(value, dict):
  108. result[attr] = dict(
  109. map(
  110. lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
  111. value.items(),
  112. )
  113. )
  114. else:
  115. result[attr] = value
  116. return result
  117. def to_str(self):
  118. """Returns the string representation of the model"""
  119. return pprint.pformat(self.to_dict())
  120. def __repr__(self):
  121. """For `print` and `pprint`"""
  122. return self.to_str()
  123. def __eq__(self, other):
  124. """Returns true if both objects are equal"""
  125. if not isinstance(other, SpotPriceTrigger):
  126. return False
  127. return self.to_dict() == other.to_dict()
  128. def __ne__(self, other):
  129. """Returns true if both objects are not equal"""
  130. if not isinstance(other, SpotPriceTrigger):
  131. return True
  132. return self.to_dict() != other.to_dict()