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

228 lines
6.5 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 PositionClose(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 = {'time': 'float', 'contract': 'str', 'side': 'str', 'pnl': 'str', 'text': 'str'}
  25. attribute_map = {'time': 'time', 'contract': 'contract', 'side': 'side', 'pnl': 'pnl', 'text': 'text'}
  26. def __init__(
  27. self, time=None, contract=None, side=None, pnl=None, text=None, local_vars_configuration=None
  28. ): # noqa: E501
  29. # type: (float, str, str, str, str, Configuration) -> None
  30. """PositionClose - a model defined in OpenAPI""" # noqa: E501
  31. if local_vars_configuration is None:
  32. local_vars_configuration = Configuration()
  33. self.local_vars_configuration = local_vars_configuration
  34. self._time = None
  35. self._contract = None
  36. self._side = None
  37. self._pnl = None
  38. self._text = None
  39. self.discriminator = None
  40. if time is not None:
  41. self.time = time
  42. if contract is not None:
  43. self.contract = contract
  44. if side is not None:
  45. self.side = side
  46. if pnl is not None:
  47. self.pnl = pnl
  48. if text is not None:
  49. self.text = text
  50. @property
  51. def time(self):
  52. """Gets the time of this PositionClose. # noqa: E501
  53. Position close time # noqa: E501
  54. :return: The time of this PositionClose. # noqa: E501
  55. :rtype: float
  56. """
  57. return self._time
  58. @time.setter
  59. def time(self, time):
  60. """Sets the time of this PositionClose.
  61. Position close time # noqa: E501
  62. :param time: The time of this PositionClose. # noqa: E501
  63. :type: float
  64. """
  65. self._time = time
  66. @property
  67. def contract(self):
  68. """Gets the contract of this PositionClose. # noqa: E501
  69. Futures contract # noqa: E501
  70. :return: The contract of this PositionClose. # noqa: E501
  71. :rtype: str
  72. """
  73. return self._contract
  74. @contract.setter
  75. def contract(self, contract):
  76. """Sets the contract of this PositionClose.
  77. Futures contract # noqa: E501
  78. :param contract: The contract of this PositionClose. # noqa: E501
  79. :type: str
  80. """
  81. self._contract = contract
  82. @property
  83. def side(self):
  84. """Gets the side of this PositionClose. # noqa: E501
  85. Position side, long or short # noqa: E501
  86. :return: The side of this PositionClose. # noqa: E501
  87. :rtype: str
  88. """
  89. return self._side
  90. @side.setter
  91. def side(self, side):
  92. """Sets the side of this PositionClose.
  93. Position side, long or short # noqa: E501
  94. :param side: The side of this PositionClose. # noqa: E501
  95. :type: str
  96. """
  97. allowed_values = ["long", "short"] # noqa: E501
  98. if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501
  99. raise ValueError(
  100. "Invalid value for `side` ({0}), must be one of {1}".format(side, allowed_values) # noqa: E501
  101. )
  102. self._side = side
  103. @property
  104. def pnl(self):
  105. """Gets the pnl of this PositionClose. # noqa: E501
  106. PNL # noqa: E501
  107. :return: The pnl of this PositionClose. # noqa: E501
  108. :rtype: str
  109. """
  110. return self._pnl
  111. @pnl.setter
  112. def pnl(self, pnl):
  113. """Sets the pnl of this PositionClose.
  114. PNL # noqa: E501
  115. :param pnl: The pnl of this PositionClose. # noqa: E501
  116. :type: str
  117. """
  118. self._pnl = pnl
  119. @property
  120. def text(self):
  121. """Gets the text of this PositionClose. # noqa: E501
  122. Text of close order # noqa: E501
  123. :return: The text of this PositionClose. # noqa: E501
  124. :rtype: str
  125. """
  126. return self._text
  127. @text.setter
  128. def text(self, text):
  129. """Sets the text of this PositionClose.
  130. Text of close order # noqa: E501
  131. :param text: The text of this PositionClose. # noqa: E501
  132. :type: str
  133. """
  134. self._text = text
  135. def to_dict(self):
  136. """Returns the model properties as a dict"""
  137. result = {}
  138. for attr, _ in six.iteritems(self.openapi_types):
  139. value = getattr(self, attr)
  140. if isinstance(value, list):
  141. result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
  142. elif hasattr(value, "to_dict"):
  143. result[attr] = value.to_dict()
  144. elif isinstance(value, dict):
  145. result[attr] = dict(
  146. map(
  147. lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
  148. value.items(),
  149. )
  150. )
  151. else:
  152. result[attr] = value
  153. return result
  154. def to_str(self):
  155. """Returns the string representation of the model"""
  156. return pprint.pformat(self.to_dict())
  157. def __repr__(self):
  158. """For `print` and `pprint`"""
  159. return self.to_str()
  160. def __eq__(self, other):
  161. """Returns true if both objects are equal"""
  162. if not isinstance(other, PositionClose):
  163. return False
  164. return self.to_dict() == other.to_dict()
  165. def __ne__(self, other):
  166. """Returns true if both objects are not equal"""
  167. if not isinstance(other, PositionClose):
  168. return True
  169. return self.to_dict() != other.to_dict()