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

483 lines
13 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 Trade(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': 'str',
  26. 'create_time': 'str',
  27. 'create_time_ms': 'str',
  28. 'currency_pair': 'str',
  29. 'side': 'str',
  30. 'role': 'str',
  31. 'amount': 'str',
  32. 'price': 'str',
  33. 'order_id': 'str',
  34. 'fee': 'str',
  35. 'fee_currency': 'str',
  36. 'point_fee': 'str',
  37. 'gt_fee': 'str',
  38. }
  39. attribute_map = {
  40. 'id': 'id',
  41. 'create_time': 'create_time',
  42. 'create_time_ms': 'create_time_ms',
  43. 'currency_pair': 'currency_pair',
  44. 'side': 'side',
  45. 'role': 'role',
  46. 'amount': 'amount',
  47. 'price': 'price',
  48. 'order_id': 'order_id',
  49. 'fee': 'fee',
  50. 'fee_currency': 'fee_currency',
  51. 'point_fee': 'point_fee',
  52. 'gt_fee': 'gt_fee',
  53. }
  54. def __init__(
  55. self,
  56. id=None,
  57. create_time=None,
  58. create_time_ms=None,
  59. currency_pair=None,
  60. side=None,
  61. role=None,
  62. amount=None,
  63. price=None,
  64. order_id=None,
  65. fee=None,
  66. fee_currency=None,
  67. point_fee=None,
  68. gt_fee=None,
  69. local_vars_configuration=None,
  70. ): # noqa: E501
  71. # type: (str, str, str, str, str, str, str, str, str, str, str, str, str, Configuration) -> None
  72. """Trade - a model defined in OpenAPI""" # noqa: E501
  73. if local_vars_configuration is None:
  74. local_vars_configuration = Configuration()
  75. self.local_vars_configuration = local_vars_configuration
  76. self._id = None
  77. self._create_time = None
  78. self._create_time_ms = None
  79. self._currency_pair = None
  80. self._side = None
  81. self._role = None
  82. self._amount = None
  83. self._price = None
  84. self._order_id = None
  85. self._fee = None
  86. self._fee_currency = None
  87. self._point_fee = None
  88. self._gt_fee = None
  89. self.discriminator = None
  90. if id is not None:
  91. self.id = id
  92. if create_time is not None:
  93. self.create_time = create_time
  94. if create_time_ms is not None:
  95. self.create_time_ms = create_time_ms
  96. if currency_pair is not None:
  97. self.currency_pair = currency_pair
  98. if side is not None:
  99. self.side = side
  100. if role is not None:
  101. self.role = role
  102. if amount is not None:
  103. self.amount = amount
  104. if price is not None:
  105. self.price = price
  106. if order_id is not None:
  107. self.order_id = order_id
  108. if fee is not None:
  109. self.fee = fee
  110. if fee_currency is not None:
  111. self.fee_currency = fee_currency
  112. if point_fee is not None:
  113. self.point_fee = point_fee
  114. if gt_fee is not None:
  115. self.gt_fee = gt_fee
  116. @property
  117. def id(self):
  118. """Gets the id of this Trade. # noqa: E501
  119. Trade ID # noqa: E501
  120. :return: The id of this Trade. # noqa: E501
  121. :rtype: str
  122. """
  123. return self._id
  124. @id.setter
  125. def id(self, id):
  126. """Sets the id of this Trade.
  127. Trade ID # noqa: E501
  128. :param id: The id of this Trade. # noqa: E501
  129. :type: str
  130. """
  131. self._id = id
  132. @property
  133. def create_time(self):
  134. """Gets the create_time of this Trade. # noqa: E501
  135. Trading time # noqa: E501
  136. :return: The create_time of this Trade. # noqa: E501
  137. :rtype: str
  138. """
  139. return self._create_time
  140. @create_time.setter
  141. def create_time(self, create_time):
  142. """Sets the create_time of this Trade.
  143. Trading time # noqa: E501
  144. :param create_time: The create_time of this Trade. # noqa: E501
  145. :type: str
  146. """
  147. self._create_time = create_time
  148. @property
  149. def create_time_ms(self):
  150. """Gets the create_time_ms of this Trade. # noqa: E501
  151. Trading time, with millisecond precision # noqa: E501
  152. :return: The create_time_ms of this Trade. # noqa: E501
  153. :rtype: str
  154. """
  155. return self._create_time_ms
  156. @create_time_ms.setter
  157. def create_time_ms(self, create_time_ms):
  158. """Sets the create_time_ms of this Trade.
  159. Trading time, with millisecond precision # noqa: E501
  160. :param create_time_ms: The create_time_ms of this Trade. # noqa: E501
  161. :type: str
  162. """
  163. self._create_time_ms = create_time_ms
  164. @property
  165. def currency_pair(self):
  166. """Gets the currency_pair of this Trade. # noqa: E501
  167. Currency pair # noqa: E501
  168. :return: The currency_pair of this Trade. # noqa: E501
  169. :rtype: str
  170. """
  171. return self._currency_pair
  172. @currency_pair.setter
  173. def currency_pair(self, currency_pair):
  174. """Sets the currency_pair of this Trade.
  175. Currency pair # noqa: E501
  176. :param currency_pair: The currency_pair of this Trade. # noqa: E501
  177. :type: str
  178. """
  179. self._currency_pair = currency_pair
  180. @property
  181. def side(self):
  182. """Gets the side of this Trade. # noqa: E501
  183. Order side # noqa: E501
  184. :return: The side of this Trade. # noqa: E501
  185. :rtype: str
  186. """
  187. return self._side
  188. @side.setter
  189. def side(self, side):
  190. """Sets the side of this Trade.
  191. Order side # noqa: E501
  192. :param side: The side of this Trade. # noqa: E501
  193. :type: str
  194. """
  195. allowed_values = ["buy", "sell"] # noqa: E501
  196. if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501
  197. raise ValueError(
  198. "Invalid value for `side` ({0}), must be one of {1}".format(side, allowed_values) # noqa: E501
  199. )
  200. self._side = side
  201. @property
  202. def role(self):
  203. """Gets the role of this Trade. # noqa: E501
  204. Trade role. No value in public endpoints # noqa: E501
  205. :return: The role of this Trade. # noqa: E501
  206. :rtype: str
  207. """
  208. return self._role
  209. @role.setter
  210. def role(self, role):
  211. """Sets the role of this Trade.
  212. Trade role. No value in public endpoints # noqa: E501
  213. :param role: The role of this Trade. # noqa: E501
  214. :type: str
  215. """
  216. allowed_values = ["taker", "maker"] # noqa: E501
  217. if self.local_vars_configuration.client_side_validation and role not in allowed_values: # noqa: E501
  218. raise ValueError(
  219. "Invalid value for `role` ({0}), must be one of {1}".format(role, allowed_values) # noqa: E501
  220. )
  221. self._role = role
  222. @property
  223. def amount(self):
  224. """Gets the amount of this Trade. # noqa: E501
  225. Trade amount # noqa: E501
  226. :return: The amount of this Trade. # noqa: E501
  227. :rtype: str
  228. """
  229. return self._amount
  230. @amount.setter
  231. def amount(self, amount):
  232. """Sets the amount of this Trade.
  233. Trade amount # noqa: E501
  234. :param amount: The amount of this Trade. # noqa: E501
  235. :type: str
  236. """
  237. self._amount = amount
  238. @property
  239. def price(self):
  240. """Gets the price of this Trade. # noqa: E501
  241. Order price # noqa: E501
  242. :return: The price of this Trade. # noqa: E501
  243. :rtype: str
  244. """
  245. return self._price
  246. @price.setter
  247. def price(self, price):
  248. """Sets the price of this Trade.
  249. Order price # noqa: E501
  250. :param price: The price of this Trade. # noqa: E501
  251. :type: str
  252. """
  253. self._price = price
  254. @property
  255. def order_id(self):
  256. """Gets the order_id of this Trade. # noqa: E501
  257. Related order ID. No value in public endpoints # noqa: E501
  258. :return: The order_id of this Trade. # noqa: E501
  259. :rtype: str
  260. """
  261. return self._order_id
  262. @order_id.setter
  263. def order_id(self, order_id):
  264. """Sets the order_id of this Trade.
  265. Related order ID. No value in public endpoints # noqa: E501
  266. :param order_id: The order_id of this Trade. # noqa: E501
  267. :type: str
  268. """
  269. self._order_id = order_id
  270. @property
  271. def fee(self):
  272. """Gets the fee of this Trade. # noqa: E501
  273. Fee deducted. No value in public endpoints # noqa: E501
  274. :return: The fee of this Trade. # noqa: E501
  275. :rtype: str
  276. """
  277. return self._fee
  278. @fee.setter
  279. def fee(self, fee):
  280. """Sets the fee of this Trade.
  281. Fee deducted. No value in public endpoints # noqa: E501
  282. :param fee: The fee of this Trade. # noqa: E501
  283. :type: str
  284. """
  285. self._fee = fee
  286. @property
  287. def fee_currency(self):
  288. """Gets the fee_currency of this Trade. # noqa: E501
  289. Fee currency unit. No value in public endpoints # noqa: E501
  290. :return: The fee_currency of this Trade. # noqa: E501
  291. :rtype: str
  292. """
  293. return self._fee_currency
  294. @fee_currency.setter
  295. def fee_currency(self, fee_currency):
  296. """Sets the fee_currency of this Trade.
  297. Fee currency unit. No value in public endpoints # noqa: E501
  298. :param fee_currency: The fee_currency of this Trade. # noqa: E501
  299. :type: str
  300. """
  301. self._fee_currency = fee_currency
  302. @property
  303. def point_fee(self):
  304. """Gets the point_fee of this Trade. # noqa: E501
  305. Points used to deduct fee. No value in public endpoints # noqa: E501
  306. :return: The point_fee of this Trade. # noqa: E501
  307. :rtype: str
  308. """
  309. return self._point_fee
  310. @point_fee.setter
  311. def point_fee(self, point_fee):
  312. """Sets the point_fee of this Trade.
  313. Points used to deduct fee. No value in public endpoints # noqa: E501
  314. :param point_fee: The point_fee of this Trade. # noqa: E501
  315. :type: str
  316. """
  317. self._point_fee = point_fee
  318. @property
  319. def gt_fee(self):
  320. """Gets the gt_fee of this Trade. # noqa: E501
  321. GT used to deduct fee. No value in public endpoints # noqa: E501
  322. :return: The gt_fee of this Trade. # noqa: E501
  323. :rtype: str
  324. """
  325. return self._gt_fee
  326. @gt_fee.setter
  327. def gt_fee(self, gt_fee):
  328. """Sets the gt_fee of this Trade.
  329. GT used to deduct fee. No value in public endpoints # noqa: E501
  330. :param gt_fee: The gt_fee of this Trade. # noqa: E501
  331. :type: str
  332. """
  333. self._gt_fee = gt_fee
  334. def to_dict(self):
  335. """Returns the model properties as a dict"""
  336. result = {}
  337. for attr, _ in six.iteritems(self.openapi_types):
  338. value = getattr(self, attr)
  339. if isinstance(value, list):
  340. result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
  341. elif hasattr(value, "to_dict"):
  342. result[attr] = value.to_dict()
  343. elif isinstance(value, dict):
  344. result[attr] = dict(
  345. map(
  346. lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
  347. value.items(),
  348. )
  349. )
  350. else:
  351. result[attr] = value
  352. return result
  353. def to_str(self):
  354. """Returns the string representation of the model"""
  355. return pprint.pformat(self.to_dict())
  356. def __repr__(self):
  357. """For `print` and `pprint`"""
  358. return self.to_str()
  359. def __eq__(self, other):
  360. """Returns true if both objects are equal"""
  361. if not isinstance(other, Trade):
  362. return False
  363. return self.to_dict() == other.to_dict()
  364. def __ne__(self, other):
  365. """Returns true if both objects are not equal"""
  366. if not isinstance(other, Trade):
  367. return True
  368. return self.to_dict() != other.to_dict()