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

231 lines
6.9 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 OrderBook(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. 'current': 'int',
  27. 'update': 'int',
  28. 'asks': 'list[list[str]]',
  29. 'bids': 'list[list[str]]',
  30. }
  31. attribute_map = {'id': 'id', 'current': 'current', 'update': 'update', 'asks': 'asks', 'bids': 'bids'}
  32. def __init__(
  33. self, id=None, current=None, update=None, asks=None, bids=None, local_vars_configuration=None
  34. ): # noqa: E501
  35. # type: (int, int, int, list[list[str]], list[list[str]], Configuration) -> None
  36. """OrderBook - 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._id = None
  41. self._current = None
  42. self._update = None
  43. self._asks = None
  44. self._bids = None
  45. self.discriminator = None
  46. if id is not None:
  47. self.id = id
  48. if current is not None:
  49. self.current = current
  50. if update is not None:
  51. self.update = update
  52. self.asks = asks
  53. self.bids = bids
  54. @property
  55. def id(self):
  56. """Gets the id of this OrderBook. # noqa: E501
  57. Order book ID, which is updated whenever the order book is changed. Valid only when `with_id` is set to `true` # noqa: E501
  58. :return: The id of this OrderBook. # noqa: E501
  59. :rtype: int
  60. """
  61. return self._id
  62. @id.setter
  63. def id(self, id):
  64. """Sets the id of this OrderBook.
  65. Order book ID, which is updated whenever the order book is changed. Valid only when `with_id` is set to `true` # noqa: E501
  66. :param id: The id of this OrderBook. # noqa: E501
  67. :type: int
  68. """
  69. self._id = id
  70. @property
  71. def current(self):
  72. """Gets the current of this OrderBook. # noqa: E501
  73. The timestamp of the response data being generated (in milliseconds) # noqa: E501
  74. :return: The current of this OrderBook. # noqa: E501
  75. :rtype: int
  76. """
  77. return self._current
  78. @current.setter
  79. def current(self, current):
  80. """Sets the current of this OrderBook.
  81. The timestamp of the response data being generated (in milliseconds) # noqa: E501
  82. :param current: The current of this OrderBook. # noqa: E501
  83. :type: int
  84. """
  85. self._current = current
  86. @property
  87. def update(self):
  88. """Gets the update of this OrderBook. # noqa: E501
  89. The timestamp of when the orderbook last changed (in milliseconds) # noqa: E501
  90. :return: The update of this OrderBook. # noqa: E501
  91. :rtype: int
  92. """
  93. return self._update
  94. @update.setter
  95. def update(self, update):
  96. """Sets the update of this OrderBook.
  97. The timestamp of when the orderbook last changed (in milliseconds) # noqa: E501
  98. :param update: The update of this OrderBook. # noqa: E501
  99. :type: int
  100. """
  101. self._update = update
  102. @property
  103. def asks(self):
  104. """Gets the asks of this OrderBook. # noqa: E501
  105. Asks order depth # noqa: E501
  106. :return: The asks of this OrderBook. # noqa: E501
  107. :rtype: list[list[str]]
  108. """
  109. return self._asks
  110. @asks.setter
  111. def asks(self, asks):
  112. """Sets the asks of this OrderBook.
  113. Asks order depth # noqa: E501
  114. :param asks: The asks of this OrderBook. # noqa: E501
  115. :type: list[list[str]]
  116. """
  117. if self.local_vars_configuration.client_side_validation and asks is None: # noqa: E501
  118. raise ValueError("Invalid value for `asks`, must not be `None`") # noqa: E501
  119. self._asks = asks
  120. @property
  121. def bids(self):
  122. """Gets the bids of this OrderBook. # noqa: E501
  123. Bids order depth # noqa: E501
  124. :return: The bids of this OrderBook. # noqa: E501
  125. :rtype: list[list[str]]
  126. """
  127. return self._bids
  128. @bids.setter
  129. def bids(self, bids):
  130. """Sets the bids of this OrderBook.
  131. Bids order depth # noqa: E501
  132. :param bids: The bids of this OrderBook. # noqa: E501
  133. :type: list[list[str]]
  134. """
  135. if self.local_vars_configuration.client_side_validation and bids is None: # noqa: E501
  136. raise ValueError("Invalid value for `bids`, must not be `None`") # noqa: E501
  137. self._bids = bids
  138. def to_dict(self):
  139. """Returns the model properties as a dict"""
  140. result = {}
  141. for attr, _ in six.iteritems(self.openapi_types):
  142. value = getattr(self, attr)
  143. if isinstance(value, list):
  144. result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
  145. elif hasattr(value, "to_dict"):
  146. result[attr] = value.to_dict()
  147. elif isinstance(value, dict):
  148. result[attr] = dict(
  149. map(
  150. lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
  151. value.items(),
  152. )
  153. )
  154. else:
  155. result[attr] = value
  156. return result
  157. def to_str(self):
  158. """Returns the string representation of the model"""
  159. return pprint.pformat(self.to_dict())
  160. def __repr__(self):
  161. """For `print` and `pprint`"""
  162. return self.to_str()
  163. def __eq__(self, other):
  164. """Returns true if both objects are equal"""
  165. if not isinstance(other, OrderBook):
  166. return False
  167. return self.to_dict() == other.to_dict()
  168. def __ne__(self, other):
  169. """Returns true if both objects are not equal"""
  170. if not isinstance(other, OrderBook):
  171. return True
  172. return self.to_dict() != other.to_dict()