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

558 lines
19 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 CrossMarginAccount(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_id': 'int',
  26. 'locked': 'bool',
  27. 'balances': 'dict(str, CrossMarginBalance)',
  28. 'total': 'str',
  29. 'borrowed': 'str',
  30. 'interest': 'str',
  31. 'risk': 'str',
  32. 'total_initial_margin': 'str',
  33. 'total_margin_balance': 'str',
  34. 'total_maintenance_margin': 'str',
  35. 'total_initial_margin_rate': 'str',
  36. 'total_maintenance_margin_rate': 'str',
  37. 'total_available_margin': 'str',
  38. 'portfolio_margin_total': 'str',
  39. 'portfolio_margin_total_liab': 'str',
  40. 'portfolio_margin_total_equity': 'str',
  41. }
  42. attribute_map = {
  43. 'user_id': 'user_id',
  44. 'locked': 'locked',
  45. 'balances': 'balances',
  46. 'total': 'total',
  47. 'borrowed': 'borrowed',
  48. 'interest': 'interest',
  49. 'risk': 'risk',
  50. 'total_initial_margin': 'total_initial_margin',
  51. 'total_margin_balance': 'total_margin_balance',
  52. 'total_maintenance_margin': 'total_maintenance_margin',
  53. 'total_initial_margin_rate': 'total_initial_margin_rate',
  54. 'total_maintenance_margin_rate': 'total_maintenance_margin_rate',
  55. 'total_available_margin': 'total_available_margin',
  56. 'portfolio_margin_total': 'portfolio_margin_total',
  57. 'portfolio_margin_total_liab': 'portfolio_margin_total_liab',
  58. 'portfolio_margin_total_equity': 'portfolio_margin_total_equity',
  59. }
  60. def __init__(
  61. self,
  62. user_id=None,
  63. locked=None,
  64. balances=None,
  65. total=None,
  66. borrowed=None,
  67. interest=None,
  68. risk=None,
  69. total_initial_margin=None,
  70. total_margin_balance=None,
  71. total_maintenance_margin=None,
  72. total_initial_margin_rate=None,
  73. total_maintenance_margin_rate=None,
  74. total_available_margin=None,
  75. portfolio_margin_total=None,
  76. portfolio_margin_total_liab=None,
  77. portfolio_margin_total_equity=None,
  78. local_vars_configuration=None,
  79. ): # noqa: E501
  80. # type: (int, bool, dict(str, CrossMarginBalance), str, str, str, str, str, str, str, str, str, str, str, str, str, Configuration) -> None
  81. """CrossMarginAccount - a model defined in OpenAPI""" # noqa: E501
  82. if local_vars_configuration is None:
  83. local_vars_configuration = Configuration()
  84. self.local_vars_configuration = local_vars_configuration
  85. self._user_id = None
  86. self._locked = None
  87. self._balances = None
  88. self._total = None
  89. self._borrowed = None
  90. self._interest = None
  91. self._risk = None
  92. self._total_initial_margin = None
  93. self._total_margin_balance = None
  94. self._total_maintenance_margin = None
  95. self._total_initial_margin_rate = None
  96. self._total_maintenance_margin_rate = None
  97. self._total_available_margin = None
  98. self._portfolio_margin_total = None
  99. self._portfolio_margin_total_liab = None
  100. self._portfolio_margin_total_equity = None
  101. self.discriminator = None
  102. if user_id is not None:
  103. self.user_id = user_id
  104. if locked is not None:
  105. self.locked = locked
  106. if balances is not None:
  107. self.balances = balances
  108. if total is not None:
  109. self.total = total
  110. if borrowed is not None:
  111. self.borrowed = borrowed
  112. if interest is not None:
  113. self.interest = interest
  114. if risk is not None:
  115. self.risk = risk
  116. if total_initial_margin is not None:
  117. self.total_initial_margin = total_initial_margin
  118. if total_margin_balance is not None:
  119. self.total_margin_balance = total_margin_balance
  120. if total_maintenance_margin is not None:
  121. self.total_maintenance_margin = total_maintenance_margin
  122. if total_initial_margin_rate is not None:
  123. self.total_initial_margin_rate = total_initial_margin_rate
  124. if total_maintenance_margin_rate is not None:
  125. self.total_maintenance_margin_rate = total_maintenance_margin_rate
  126. if total_available_margin is not None:
  127. self.total_available_margin = total_available_margin
  128. if portfolio_margin_total is not None:
  129. self.portfolio_margin_total = portfolio_margin_total
  130. if portfolio_margin_total_liab is not None:
  131. self.portfolio_margin_total_liab = portfolio_margin_total_liab
  132. if portfolio_margin_total_equity is not None:
  133. self.portfolio_margin_total_equity = portfolio_margin_total_equity
  134. @property
  135. def user_id(self):
  136. """Gets the user_id of this CrossMarginAccount. # noqa: E501
  137. User ID # noqa: E501
  138. :return: The user_id of this CrossMarginAccount. # noqa: E501
  139. :rtype: int
  140. """
  141. return self._user_id
  142. @user_id.setter
  143. def user_id(self, user_id):
  144. """Sets the user_id of this CrossMarginAccount.
  145. User ID # noqa: E501
  146. :param user_id: The user_id of this CrossMarginAccount. # noqa: E501
  147. :type: int
  148. """
  149. self._user_id = user_id
  150. @property
  151. def locked(self):
  152. """Gets the locked of this CrossMarginAccount. # noqa: E501
  153. Whether account is locked # noqa: E501
  154. :return: The locked of this CrossMarginAccount. # noqa: E501
  155. :rtype: bool
  156. """
  157. return self._locked
  158. @locked.setter
  159. def locked(self, locked):
  160. """Sets the locked of this CrossMarginAccount.
  161. Whether account is locked # noqa: E501
  162. :param locked: The locked of this CrossMarginAccount. # noqa: E501
  163. :type: bool
  164. """
  165. self._locked = locked
  166. @property
  167. def balances(self):
  168. """Gets the balances of this CrossMarginAccount. # noqa: E501
  169. :return: The balances of this CrossMarginAccount. # noqa: E501
  170. :rtype: dict(str, CrossMarginBalance)
  171. """
  172. return self._balances
  173. @balances.setter
  174. def balances(self, balances):
  175. """Sets the balances of this CrossMarginAccount.
  176. :param balances: The balances of this CrossMarginAccount. # noqa: E501
  177. :type: dict(str, CrossMarginBalance)
  178. """
  179. self._balances = balances
  180. @property
  181. def total(self):
  182. """Gets the total of this CrossMarginAccount. # noqa: E501
  183. Total account value in USDT, i.e., the sum of all currencies' `(available+freeze)*price*discount` # noqa: E501
  184. :return: The total of this CrossMarginAccount. # noqa: E501
  185. :rtype: str
  186. """
  187. return self._total
  188. @total.setter
  189. def total(self, total):
  190. """Sets the total of this CrossMarginAccount.
  191. Total account value in USDT, i.e., the sum of all currencies' `(available+freeze)*price*discount` # noqa: E501
  192. :param total: The total of this CrossMarginAccount. # noqa: E501
  193. :type: str
  194. """
  195. self._total = total
  196. @property
  197. def borrowed(self):
  198. """Gets the borrowed of this CrossMarginAccount. # noqa: E501
  199. Total borrowed value in USDT, i.e., the sum of all currencies' `borrowed*price*discount` # noqa: E501
  200. :return: The borrowed of this CrossMarginAccount. # noqa: E501
  201. :rtype: str
  202. """
  203. return self._borrowed
  204. @borrowed.setter
  205. def borrowed(self, borrowed):
  206. """Sets the borrowed of this CrossMarginAccount.
  207. Total borrowed value in USDT, i.e., the sum of all currencies' `borrowed*price*discount` # noqa: E501
  208. :param borrowed: The borrowed of this CrossMarginAccount. # noqa: E501
  209. :type: str
  210. """
  211. self._borrowed = borrowed
  212. @property
  213. def interest(self):
  214. """Gets the interest of this CrossMarginAccount. # noqa: E501
  215. Total unpaid interests in USDT, i.e., the sum of all currencies' `interest*price*discount` # noqa: E501
  216. :return: The interest of this CrossMarginAccount. # noqa: E501
  217. :rtype: str
  218. """
  219. return self._interest
  220. @interest.setter
  221. def interest(self, interest):
  222. """Sets the interest of this CrossMarginAccount.
  223. Total unpaid interests in USDT, i.e., the sum of all currencies' `interest*price*discount` # noqa: E501
  224. :param interest: The interest of this CrossMarginAccount. # noqa: E501
  225. :type: str
  226. """
  227. self._interest = interest
  228. @property
  229. def risk(self):
  230. """Gets the risk of this CrossMarginAccount. # noqa: E501
  231. Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: `total / (borrowed+interest)` # noqa: E501
  232. :return: The risk of this CrossMarginAccount. # noqa: E501
  233. :rtype: str
  234. """
  235. return self._risk
  236. @risk.setter
  237. def risk(self, risk):
  238. """Sets the risk of this CrossMarginAccount.
  239. Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: `total / (borrowed+interest)` # noqa: E501
  240. :param risk: The risk of this CrossMarginAccount. # noqa: E501
  241. :type: str
  242. """
  243. self._risk = risk
  244. @property
  245. def total_initial_margin(self):
  246. """Gets the total_initial_margin of this CrossMarginAccount. # noqa: E501
  247. Total initial margin # noqa: E501
  248. :return: The total_initial_margin of this CrossMarginAccount. # noqa: E501
  249. :rtype: str
  250. """
  251. return self._total_initial_margin
  252. @total_initial_margin.setter
  253. def total_initial_margin(self, total_initial_margin):
  254. """Sets the total_initial_margin of this CrossMarginAccount.
  255. Total initial margin # noqa: E501
  256. :param total_initial_margin: The total_initial_margin of this CrossMarginAccount. # noqa: E501
  257. :type: str
  258. """
  259. self._total_initial_margin = total_initial_margin
  260. @property
  261. def total_margin_balance(self):
  262. """Gets the total_margin_balance of this CrossMarginAccount. # noqa: E501
  263. Total Margin Balance ((positive equity index price * discount) + (negative equity * index price)) # noqa: E501
  264. :return: The total_margin_balance of this CrossMarginAccount. # noqa: E501
  265. :rtype: str
  266. """
  267. return self._total_margin_balance
  268. @total_margin_balance.setter
  269. def total_margin_balance(self, total_margin_balance):
  270. """Sets the total_margin_balance of this CrossMarginAccount.
  271. Total Margin Balance ((positive equity index price * discount) + (negative equity * index price)) # noqa: E501
  272. :param total_margin_balance: The total_margin_balance of this CrossMarginAccount. # noqa: E501
  273. :type: str
  274. """
  275. self._total_margin_balance = total_margin_balance
  276. @property
  277. def total_maintenance_margin(self):
  278. """Gets the total_maintenance_margin of this CrossMarginAccount. # noqa: E501
  279. Total maintenance margin # noqa: E501
  280. :return: The total_maintenance_margin of this CrossMarginAccount. # noqa: E501
  281. :rtype: str
  282. """
  283. return self._total_maintenance_margin
  284. @total_maintenance_margin.setter
  285. def total_maintenance_margin(self, total_maintenance_margin):
  286. """Sets the total_maintenance_margin of this CrossMarginAccount.
  287. Total maintenance margin # noqa: E501
  288. :param total_maintenance_margin: The total_maintenance_margin of this CrossMarginAccount. # noqa: E501
  289. :type: str
  290. """
  291. self._total_maintenance_margin = total_maintenance_margin
  292. @property
  293. def total_initial_margin_rate(self):
  294. """Gets the total_initial_margin_rate of this CrossMarginAccount. # noqa: E501
  295. Total initial margin rate # noqa: E501
  296. :return: The total_initial_margin_rate of this CrossMarginAccount. # noqa: E501
  297. :rtype: str
  298. """
  299. return self._total_initial_margin_rate
  300. @total_initial_margin_rate.setter
  301. def total_initial_margin_rate(self, total_initial_margin_rate):
  302. """Sets the total_initial_margin_rate of this CrossMarginAccount.
  303. Total initial margin rate # noqa: E501
  304. :param total_initial_margin_rate: The total_initial_margin_rate of this CrossMarginAccount. # noqa: E501
  305. :type: str
  306. """
  307. self._total_initial_margin_rate = total_initial_margin_rate
  308. @property
  309. def total_maintenance_margin_rate(self):
  310. """Gets the total_maintenance_margin_rate of this CrossMarginAccount. # noqa: E501
  311. Total maintenance margin rate # noqa: E501
  312. :return: The total_maintenance_margin_rate of this CrossMarginAccount. # noqa: E501
  313. :rtype: str
  314. """
  315. return self._total_maintenance_margin_rate
  316. @total_maintenance_margin_rate.setter
  317. def total_maintenance_margin_rate(self, total_maintenance_margin_rate):
  318. """Sets the total_maintenance_margin_rate of this CrossMarginAccount.
  319. Total maintenance margin rate # noqa: E501
  320. :param total_maintenance_margin_rate: The total_maintenance_margin_rate of this CrossMarginAccount. # noqa: E501
  321. :type: str
  322. """
  323. self._total_maintenance_margin_rate = total_maintenance_margin_rate
  324. @property
  325. def total_available_margin(self):
  326. """Gets the total_available_margin of this CrossMarginAccount. # noqa: E501
  327. Total available margin # noqa: E501
  328. :return: The total_available_margin of this CrossMarginAccount. # noqa: E501
  329. :rtype: str
  330. """
  331. return self._total_available_margin
  332. @total_available_margin.setter
  333. def total_available_margin(self, total_available_margin):
  334. """Sets the total_available_margin of this CrossMarginAccount.
  335. Total available margin # noqa: E501
  336. :param total_available_margin: The total_available_margin of this CrossMarginAccount. # noqa: E501
  337. :type: str
  338. """
  339. self._total_available_margin = total_available_margin
  340. @property
  341. def portfolio_margin_total(self):
  342. """Gets the portfolio_margin_total of this CrossMarginAccount. # noqa: E501
  343. Total amount of the portfolio margin account # noqa: E501
  344. :return: The portfolio_margin_total of this CrossMarginAccount. # noqa: E501
  345. :rtype: str
  346. """
  347. return self._portfolio_margin_total
  348. @portfolio_margin_total.setter
  349. def portfolio_margin_total(self, portfolio_margin_total):
  350. """Sets the portfolio_margin_total of this CrossMarginAccount.
  351. Total amount of the portfolio margin account # noqa: E501
  352. :param portfolio_margin_total: The portfolio_margin_total of this CrossMarginAccount. # noqa: E501
  353. :type: str
  354. """
  355. self._portfolio_margin_total = portfolio_margin_total
  356. @property
  357. def portfolio_margin_total_liab(self):
  358. """Gets the portfolio_margin_total_liab of this CrossMarginAccount. # noqa: E501
  359. Total liabilities of the portfolio margin account # noqa: E501
  360. :return: The portfolio_margin_total_liab of this CrossMarginAccount. # noqa: E501
  361. :rtype: str
  362. """
  363. return self._portfolio_margin_total_liab
  364. @portfolio_margin_total_liab.setter
  365. def portfolio_margin_total_liab(self, portfolio_margin_total_liab):
  366. """Sets the portfolio_margin_total_liab of this CrossMarginAccount.
  367. Total liabilities of the portfolio margin account # noqa: E501
  368. :param portfolio_margin_total_liab: The portfolio_margin_total_liab of this CrossMarginAccount. # noqa: E501
  369. :type: str
  370. """
  371. self._portfolio_margin_total_liab = portfolio_margin_total_liab
  372. @property
  373. def portfolio_margin_total_equity(self):
  374. """Gets the portfolio_margin_total_equity of this CrossMarginAccount. # noqa: E501
  375. Total equity of the portfolio margin account # noqa: E501
  376. :return: The portfolio_margin_total_equity of this CrossMarginAccount. # noqa: E501
  377. :rtype: str
  378. """
  379. return self._portfolio_margin_total_equity
  380. @portfolio_margin_total_equity.setter
  381. def portfolio_margin_total_equity(self, portfolio_margin_total_equity):
  382. """Sets the portfolio_margin_total_equity of this CrossMarginAccount.
  383. Total equity of the portfolio margin account # noqa: E501
  384. :param portfolio_margin_total_equity: The portfolio_margin_total_equity of this CrossMarginAccount. # noqa: E501
  385. :type: str
  386. """
  387. self._portfolio_margin_total_equity = portfolio_margin_total_equity
  388. def to_dict(self):
  389. """Returns the model properties as a dict"""
  390. result = {}
  391. for attr, _ in six.iteritems(self.openapi_types):
  392. value = getattr(self, attr)
  393. if isinstance(value, list):
  394. result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
  395. elif hasattr(value, "to_dict"):
  396. result[attr] = value.to_dict()
  397. elif isinstance(value, dict):
  398. result[attr] = dict(
  399. map(
  400. lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
  401. value.items(),
  402. )
  403. )
  404. else:
  405. result[attr] = value
  406. return result
  407. def to_str(self):
  408. """Returns the string representation of the model"""
  409. return pprint.pformat(self.to_dict())
  410. def __repr__(self):
  411. """For `print` and `pprint`"""
  412. return self.to_str()
  413. def __eq__(self, other):
  414. """Returns true if both objects are equal"""
  415. if not isinstance(other, CrossMarginAccount):
  416. return False
  417. return self.to_dict() == other.to_dict()
  418. def __ne__(self, other):
  419. """Returns true if both objects are not equal"""
  420. if not isinstance(other, CrossMarginAccount):
  421. return True
  422. return self.to_dict() != other.to_dict()