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

354 lines
10 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 OptionsPosition(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. 'user': 'int',
  26. 'contract': 'str',
  27. 'size': 'int',
  28. 'entry_price': 'str',
  29. 'mark_price': 'str',
  30. 'realised_pnl': 'str',
  31. 'unrealised_pnl': 'str',
  32. 'pending_orders': 'int',
  33. 'close_order': 'OptionsPositionCloseOrder',
  34. }
  35. attribute_map = {
  36. 'user': 'user',
  37. 'contract': 'contract',
  38. 'size': 'size',
  39. 'entry_price': 'entry_price',
  40. 'mark_price': 'mark_price',
  41. 'realised_pnl': 'realised_pnl',
  42. 'unrealised_pnl': 'unrealised_pnl',
  43. 'pending_orders': 'pending_orders',
  44. 'close_order': 'close_order',
  45. }
  46. def __init__(
  47. self,
  48. user=None,
  49. contract=None,
  50. size=None,
  51. entry_price=None,
  52. mark_price=None,
  53. realised_pnl=None,
  54. unrealised_pnl=None,
  55. pending_orders=None,
  56. close_order=None,
  57. local_vars_configuration=None,
  58. ): # noqa: E501
  59. # type: (int, str, int, str, str, str, str, int, OptionsPositionCloseOrder, Configuration) -> None
  60. """OptionsPosition - a model defined in OpenAPI""" # noqa: E501
  61. if local_vars_configuration is None:
  62. local_vars_configuration = Configuration()
  63. self.local_vars_configuration = local_vars_configuration
  64. self._user = None
  65. self._contract = None
  66. self._size = None
  67. self._entry_price = None
  68. self._mark_price = None
  69. self._realised_pnl = None
  70. self._unrealised_pnl = None
  71. self._pending_orders = None
  72. self._close_order = None
  73. self.discriminator = None
  74. if user is not None:
  75. self.user = user
  76. if contract is not None:
  77. self.contract = contract
  78. if size is not None:
  79. self.size = size
  80. if entry_price is not None:
  81. self.entry_price = entry_price
  82. if mark_price is not None:
  83. self.mark_price = mark_price
  84. if realised_pnl is not None:
  85. self.realised_pnl = realised_pnl
  86. if unrealised_pnl is not None:
  87. self.unrealised_pnl = unrealised_pnl
  88. if pending_orders is not None:
  89. self.pending_orders = pending_orders
  90. self.close_order = close_order
  91. @property
  92. def user(self):
  93. """Gets the user of this OptionsPosition. # noqa: E501
  94. User ID # noqa: E501
  95. :return: The user of this OptionsPosition. # noqa: E501
  96. :rtype: int
  97. """
  98. return self._user
  99. @user.setter
  100. def user(self, user):
  101. """Sets the user of this OptionsPosition.
  102. User ID # noqa: E501
  103. :param user: The user of this OptionsPosition. # noqa: E501
  104. :type: int
  105. """
  106. self._user = user
  107. @property
  108. def contract(self):
  109. """Gets the contract of this OptionsPosition. # noqa: E501
  110. Options contract name # noqa: E501
  111. :return: The contract of this OptionsPosition. # noqa: E501
  112. :rtype: str
  113. """
  114. return self._contract
  115. @contract.setter
  116. def contract(self, contract):
  117. """Sets the contract of this OptionsPosition.
  118. Options contract name # noqa: E501
  119. :param contract: The contract of this OptionsPosition. # noqa: E501
  120. :type: str
  121. """
  122. self._contract = contract
  123. @property
  124. def size(self):
  125. """Gets the size of this OptionsPosition. # noqa: E501
  126. Position size (contract size) # noqa: E501
  127. :return: The size of this OptionsPosition. # noqa: E501
  128. :rtype: int
  129. """
  130. return self._size
  131. @size.setter
  132. def size(self, size):
  133. """Sets the size of this OptionsPosition.
  134. Position size (contract size) # noqa: E501
  135. :param size: The size of this OptionsPosition. # noqa: E501
  136. :type: int
  137. """
  138. self._size = size
  139. @property
  140. def entry_price(self):
  141. """Gets the entry_price of this OptionsPosition. # noqa: E501
  142. Entry size (quote currency) # noqa: E501
  143. :return: The entry_price of this OptionsPosition. # noqa: E501
  144. :rtype: str
  145. """
  146. return self._entry_price
  147. @entry_price.setter
  148. def entry_price(self, entry_price):
  149. """Sets the entry_price of this OptionsPosition.
  150. Entry size (quote currency) # noqa: E501
  151. :param entry_price: The entry_price of this OptionsPosition. # noqa: E501
  152. :type: str
  153. """
  154. self._entry_price = entry_price
  155. @property
  156. def mark_price(self):
  157. """Gets the mark_price of this OptionsPosition. # noqa: E501
  158. Current mark price (quote currency) # noqa: E501
  159. :return: The mark_price of this OptionsPosition. # noqa: E501
  160. :rtype: str
  161. """
  162. return self._mark_price
  163. @mark_price.setter
  164. def mark_price(self, mark_price):
  165. """Sets the mark_price of this OptionsPosition.
  166. Current mark price (quote currency) # noqa: E501
  167. :param mark_price: The mark_price of this OptionsPosition. # noqa: E501
  168. :type: str
  169. """
  170. self._mark_price = mark_price
  171. @property
  172. def realised_pnl(self):
  173. """Gets the realised_pnl of this OptionsPosition. # noqa: E501
  174. Realized PNL # noqa: E501
  175. :return: The realised_pnl of this OptionsPosition. # noqa: E501
  176. :rtype: str
  177. """
  178. return self._realised_pnl
  179. @realised_pnl.setter
  180. def realised_pnl(self, realised_pnl):
  181. """Sets the realised_pnl of this OptionsPosition.
  182. Realized PNL # noqa: E501
  183. :param realised_pnl: The realised_pnl of this OptionsPosition. # noqa: E501
  184. :type: str
  185. """
  186. self._realised_pnl = realised_pnl
  187. @property
  188. def unrealised_pnl(self):
  189. """Gets the unrealised_pnl of this OptionsPosition. # noqa: E501
  190. Unrealized PNL # noqa: E501
  191. :return: The unrealised_pnl of this OptionsPosition. # noqa: E501
  192. :rtype: str
  193. """
  194. return self._unrealised_pnl
  195. @unrealised_pnl.setter
  196. def unrealised_pnl(self, unrealised_pnl):
  197. """Sets the unrealised_pnl of this OptionsPosition.
  198. Unrealized PNL # noqa: E501
  199. :param unrealised_pnl: The unrealised_pnl of this OptionsPosition. # noqa: E501
  200. :type: str
  201. """
  202. self._unrealised_pnl = unrealised_pnl
  203. @property
  204. def pending_orders(self):
  205. """Gets the pending_orders of this OptionsPosition. # noqa: E501
  206. Current open orders # noqa: E501
  207. :return: The pending_orders of this OptionsPosition. # noqa: E501
  208. :rtype: int
  209. """
  210. return self._pending_orders
  211. @pending_orders.setter
  212. def pending_orders(self, pending_orders):
  213. """Sets the pending_orders of this OptionsPosition.
  214. Current open orders # noqa: E501
  215. :param pending_orders: The pending_orders of this OptionsPosition. # noqa: E501
  216. :type: int
  217. """
  218. self._pending_orders = pending_orders
  219. @property
  220. def close_order(self):
  221. """Gets the close_order of this OptionsPosition. # noqa: E501
  222. :return: The close_order of this OptionsPosition. # noqa: E501
  223. :rtype: OptionsPositionCloseOrder
  224. """
  225. return self._close_order
  226. @close_order.setter
  227. def close_order(self, close_order):
  228. """Sets the close_order of this OptionsPosition.
  229. :param close_order: The close_order of this OptionsPosition. # noqa: E501
  230. :type: OptionsPositionCloseOrder
  231. """
  232. self._close_order = close_order
  233. def to_dict(self):
  234. """Returns the model properties as a dict"""
  235. result = {}
  236. for attr, _ in six.iteritems(self.openapi_types):
  237. value = getattr(self, attr)
  238. if isinstance(value, list):
  239. result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
  240. elif hasattr(value, "to_dict"):
  241. result[attr] = value.to_dict()
  242. elif isinstance(value, dict):
  243. result[attr] = dict(
  244. map(
  245. lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
  246. value.items(),
  247. )
  248. )
  249. else:
  250. result[attr] = value
  251. return result
  252. def to_str(self):
  253. """Returns the string representation of the model"""
  254. return pprint.pformat(self.to_dict())
  255. def __repr__(self):
  256. """For `print` and `pprint`"""
  257. return self.to_str()
  258. def __eq__(self, other):
  259. """Returns true if both objects are equal"""
  260. if not isinstance(other, OptionsPosition):
  261. return False
  262. return self.to_dict() == other.to_dict()
  263. def __ne__(self, other):
  264. """Returns true if both objects are not equal"""
  265. if not isinstance(other, OptionsPosition):
  266. return True
  267. return self.to_dict() != other.to_dict()