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

471 lines
15 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 FuturesAccount(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. 'total': 'str',
  26. 'unrealised_pnl': 'str',
  27. 'position_margin': 'str',
  28. 'order_margin': 'str',
  29. 'available': 'str',
  30. 'point': 'str',
  31. 'currency': 'str',
  32. 'in_dual_mode': 'bool',
  33. 'enable_credit': 'bool',
  34. 'position_initial_margin': 'str',
  35. 'maintenance_margin': 'str',
  36. 'bonus': 'str',
  37. 'history': 'FuturesAccountHistory',
  38. }
  39. attribute_map = {
  40. 'total': 'total',
  41. 'unrealised_pnl': 'unrealised_pnl',
  42. 'position_margin': 'position_margin',
  43. 'order_margin': 'order_margin',
  44. 'available': 'available',
  45. 'point': 'point',
  46. 'currency': 'currency',
  47. 'in_dual_mode': 'in_dual_mode',
  48. 'enable_credit': 'enable_credit',
  49. 'position_initial_margin': 'position_initial_margin',
  50. 'maintenance_margin': 'maintenance_margin',
  51. 'bonus': 'bonus',
  52. 'history': 'history',
  53. }
  54. def __init__(
  55. self,
  56. total=None,
  57. unrealised_pnl=None,
  58. position_margin=None,
  59. order_margin=None,
  60. available=None,
  61. point=None,
  62. currency=None,
  63. in_dual_mode=None,
  64. enable_credit=None,
  65. position_initial_margin=None,
  66. maintenance_margin=None,
  67. bonus=None,
  68. history=None,
  69. local_vars_configuration=None,
  70. ): # noqa: E501
  71. # type: (str, str, str, str, str, str, str, bool, bool, str, str, str, FuturesAccountHistory, Configuration) -> None
  72. """FuturesAccount - 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._total = None
  77. self._unrealised_pnl = None
  78. self._position_margin = None
  79. self._order_margin = None
  80. self._available = None
  81. self._point = None
  82. self._currency = None
  83. self._in_dual_mode = None
  84. self._enable_credit = None
  85. self._position_initial_margin = None
  86. self._maintenance_margin = None
  87. self._bonus = None
  88. self._history = None
  89. self.discriminator = None
  90. if total is not None:
  91. self.total = total
  92. if unrealised_pnl is not None:
  93. self.unrealised_pnl = unrealised_pnl
  94. if position_margin is not None:
  95. self.position_margin = position_margin
  96. if order_margin is not None:
  97. self.order_margin = order_margin
  98. if available is not None:
  99. self.available = available
  100. if point is not None:
  101. self.point = point
  102. if currency is not None:
  103. self.currency = currency
  104. if in_dual_mode is not None:
  105. self.in_dual_mode = in_dual_mode
  106. if enable_credit is not None:
  107. self.enable_credit = enable_credit
  108. if position_initial_margin is not None:
  109. self.position_initial_margin = position_initial_margin
  110. if maintenance_margin is not None:
  111. self.maintenance_margin = maintenance_margin
  112. if bonus is not None:
  113. self.bonus = bonus
  114. if history is not None:
  115. self.history = history
  116. @property
  117. def total(self):
  118. """Gets the total of this FuturesAccount. # noqa: E501
  119. total is the balance after the user's accumulated deposit, withdraw, profit and loss (including realized profit and loss, fund, fee and referral rebate), excluding unrealized profit and loss. total = SUM(history_dnw, history_pnl, history_fee, history_refr, history_fund) # noqa: E501
  120. :return: The total of this FuturesAccount. # noqa: E501
  121. :rtype: str
  122. """
  123. return self._total
  124. @total.setter
  125. def total(self, total):
  126. """Sets the total of this FuturesAccount.
  127. total is the balance after the user's accumulated deposit, withdraw, profit and loss (including realized profit and loss, fund, fee and referral rebate), excluding unrealized profit and loss. total = SUM(history_dnw, history_pnl, history_fee, history_refr, history_fund) # noqa: E501
  128. :param total: The total of this FuturesAccount. # noqa: E501
  129. :type: str
  130. """
  131. self._total = total
  132. @property
  133. def unrealised_pnl(self):
  134. """Gets the unrealised_pnl of this FuturesAccount. # noqa: E501
  135. Unrealized PNL # noqa: E501
  136. :return: The unrealised_pnl of this FuturesAccount. # noqa: E501
  137. :rtype: str
  138. """
  139. return self._unrealised_pnl
  140. @unrealised_pnl.setter
  141. def unrealised_pnl(self, unrealised_pnl):
  142. """Sets the unrealised_pnl of this FuturesAccount.
  143. Unrealized PNL # noqa: E501
  144. :param unrealised_pnl: The unrealised_pnl of this FuturesAccount. # noqa: E501
  145. :type: str
  146. """
  147. self._unrealised_pnl = unrealised_pnl
  148. @property
  149. def position_margin(self):
  150. """Gets the position_margin of this FuturesAccount. # noqa: E501
  151. Position margin # noqa: E501
  152. :return: The position_margin of this FuturesAccount. # noqa: E501
  153. :rtype: str
  154. """
  155. return self._position_margin
  156. @position_margin.setter
  157. def position_margin(self, position_margin):
  158. """Sets the position_margin of this FuturesAccount.
  159. Position margin # noqa: E501
  160. :param position_margin: The position_margin of this FuturesAccount. # noqa: E501
  161. :type: str
  162. """
  163. self._position_margin = position_margin
  164. @property
  165. def order_margin(self):
  166. """Gets the order_margin of this FuturesAccount. # noqa: E501
  167. Order margin of unfinished orders # noqa: E501
  168. :return: The order_margin of this FuturesAccount. # noqa: E501
  169. :rtype: str
  170. """
  171. return self._order_margin
  172. @order_margin.setter
  173. def order_margin(self, order_margin):
  174. """Sets the order_margin of this FuturesAccount.
  175. Order margin of unfinished orders # noqa: E501
  176. :param order_margin: The order_margin of this FuturesAccount. # noqa: E501
  177. :type: str
  178. """
  179. self._order_margin = order_margin
  180. @property
  181. def available(self):
  182. """Gets the available of this FuturesAccount. # noqa: E501
  183. The available balance for transferring or trading(including bonus. Bonus can't be be withdrawn. The transfer amount needs to deduct the bonus) # noqa: E501
  184. :return: The available of this FuturesAccount. # noqa: E501
  185. :rtype: str
  186. """
  187. return self._available
  188. @available.setter
  189. def available(self, available):
  190. """Sets the available of this FuturesAccount.
  191. The available balance for transferring or trading(including bonus. Bonus can't be be withdrawn. The transfer amount needs to deduct the bonus) # noqa: E501
  192. :param available: The available of this FuturesAccount. # noqa: E501
  193. :type: str
  194. """
  195. self._available = available
  196. @property
  197. def point(self):
  198. """Gets the point of this FuturesAccount. # noqa: E501
  199. POINT amount # noqa: E501
  200. :return: The point of this FuturesAccount. # noqa: E501
  201. :rtype: str
  202. """
  203. return self._point
  204. @point.setter
  205. def point(self, point):
  206. """Sets the point of this FuturesAccount.
  207. POINT amount # noqa: E501
  208. :param point: The point of this FuturesAccount. # noqa: E501
  209. :type: str
  210. """
  211. self._point = point
  212. @property
  213. def currency(self):
  214. """Gets the currency of this FuturesAccount. # noqa: E501
  215. Settle currency # noqa: E501
  216. :return: The currency of this FuturesAccount. # noqa: E501
  217. :rtype: str
  218. """
  219. return self._currency
  220. @currency.setter
  221. def currency(self, currency):
  222. """Sets the currency of this FuturesAccount.
  223. Settle currency # noqa: E501
  224. :param currency: The currency of this FuturesAccount. # noqa: E501
  225. :type: str
  226. """
  227. self._currency = currency
  228. @property
  229. def in_dual_mode(self):
  230. """Gets the in_dual_mode of this FuturesAccount. # noqa: E501
  231. Whether dual mode is enabled # noqa: E501
  232. :return: The in_dual_mode of this FuturesAccount. # noqa: E501
  233. :rtype: bool
  234. """
  235. return self._in_dual_mode
  236. @in_dual_mode.setter
  237. def in_dual_mode(self, in_dual_mode):
  238. """Sets the in_dual_mode of this FuturesAccount.
  239. Whether dual mode is enabled # noqa: E501
  240. :param in_dual_mode: The in_dual_mode of this FuturesAccount. # noqa: E501
  241. :type: bool
  242. """
  243. self._in_dual_mode = in_dual_mode
  244. @property
  245. def enable_credit(self):
  246. """Gets the enable_credit of this FuturesAccount. # noqa: E501
  247. Whether portfolio margin account mode is enabled # noqa: E501
  248. :return: The enable_credit of this FuturesAccount. # noqa: E501
  249. :rtype: bool
  250. """
  251. return self._enable_credit
  252. @enable_credit.setter
  253. def enable_credit(self, enable_credit):
  254. """Sets the enable_credit of this FuturesAccount.
  255. Whether portfolio margin account mode is enabled # noqa: E501
  256. :param enable_credit: The enable_credit of this FuturesAccount. # noqa: E501
  257. :type: bool
  258. """
  259. self._enable_credit = enable_credit
  260. @property
  261. def position_initial_margin(self):
  262. """Gets the position_initial_margin of this FuturesAccount. # noqa: E501
  263. Initial margin position, applicable to the portfolio margin account model # noqa: E501
  264. :return: The position_initial_margin of this FuturesAccount. # noqa: E501
  265. :rtype: str
  266. """
  267. return self._position_initial_margin
  268. @position_initial_margin.setter
  269. def position_initial_margin(self, position_initial_margin):
  270. """Sets the position_initial_margin of this FuturesAccount.
  271. Initial margin position, applicable to the portfolio margin account model # noqa: E501
  272. :param position_initial_margin: The position_initial_margin of this FuturesAccount. # noqa: E501
  273. :type: str
  274. """
  275. self._position_initial_margin = position_initial_margin
  276. @property
  277. def maintenance_margin(self):
  278. """Gets the maintenance_margin of this FuturesAccount. # noqa: E501
  279. Maintenance margin position, applicable to the portfolio margin account model # noqa: E501
  280. :return: The maintenance_margin of this FuturesAccount. # noqa: E501
  281. :rtype: str
  282. """
  283. return self._maintenance_margin
  284. @maintenance_margin.setter
  285. def maintenance_margin(self, maintenance_margin):
  286. """Sets the maintenance_margin of this FuturesAccount.
  287. Maintenance margin position, applicable to the portfolio margin account model # noqa: E501
  288. :param maintenance_margin: The maintenance_margin of this FuturesAccount. # noqa: E501
  289. :type: str
  290. """
  291. self._maintenance_margin = maintenance_margin
  292. @property
  293. def bonus(self):
  294. """Gets the bonus of this FuturesAccount. # noqa: E501
  295. Perpetual Contract Bonus # noqa: E501
  296. :return: The bonus of this FuturesAccount. # noqa: E501
  297. :rtype: str
  298. """
  299. return self._bonus
  300. @bonus.setter
  301. def bonus(self, bonus):
  302. """Sets the bonus of this FuturesAccount.
  303. Perpetual Contract Bonus # noqa: E501
  304. :param bonus: The bonus of this FuturesAccount. # noqa: E501
  305. :type: str
  306. """
  307. self._bonus = bonus
  308. @property
  309. def history(self):
  310. """Gets the history of this FuturesAccount. # noqa: E501
  311. :return: The history of this FuturesAccount. # noqa: E501
  312. :rtype: FuturesAccountHistory
  313. """
  314. return self._history
  315. @history.setter
  316. def history(self, history):
  317. """Sets the history of this FuturesAccount.
  318. :param history: The history of this FuturesAccount. # noqa: E501
  319. :type: FuturesAccountHistory
  320. """
  321. self._history = history
  322. def to_dict(self):
  323. """Returns the model properties as a dict"""
  324. result = {}
  325. for attr, _ in six.iteritems(self.openapi_types):
  326. value = getattr(self, attr)
  327. if isinstance(value, list):
  328. result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
  329. elif hasattr(value, "to_dict"):
  330. result[attr] = value.to_dict()
  331. elif isinstance(value, dict):
  332. result[attr] = dict(
  333. map(
  334. lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
  335. value.items(),
  336. )
  337. )
  338. else:
  339. result[attr] = value
  340. return result
  341. def to_str(self):
  342. """Returns the string representation of the model"""
  343. return pprint.pformat(self.to_dict())
  344. def __repr__(self):
  345. """For `print` and `pprint`"""
  346. return self.to_str()
  347. def __eq__(self, other):
  348. """Returns true if both objects are equal"""
  349. if not isinstance(other, FuturesAccount):
  350. return False
  351. return self.to_dict() == other.to_dict()
  352. def __ne__(self, other):
  353. """Returns true if both objects are not equal"""
  354. if not isinstance(other, FuturesAccount):
  355. return True
  356. return self.to_dict() != other.to_dict()