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

631 lines
18 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 Loan(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. 'expire_time': 'str',
  28. 'status': 'str',
  29. 'side': 'str',
  30. 'currency': 'str',
  31. 'rate': 'str',
  32. 'amount': 'str',
  33. 'days': 'int',
  34. 'auto_renew': 'bool',
  35. 'currency_pair': 'str',
  36. 'left': 'str',
  37. 'repaid': 'str',
  38. 'paid_interest': 'str',
  39. 'unpaid_interest': 'str',
  40. 'fee_rate': 'str',
  41. 'orig_id': 'str',
  42. 'text': 'str',
  43. }
  44. attribute_map = {
  45. 'id': 'id',
  46. 'create_time': 'create_time',
  47. 'expire_time': 'expire_time',
  48. 'status': 'status',
  49. 'side': 'side',
  50. 'currency': 'currency',
  51. 'rate': 'rate',
  52. 'amount': 'amount',
  53. 'days': 'days',
  54. 'auto_renew': 'auto_renew',
  55. 'currency_pair': 'currency_pair',
  56. 'left': 'left',
  57. 'repaid': 'repaid',
  58. 'paid_interest': 'paid_interest',
  59. 'unpaid_interest': 'unpaid_interest',
  60. 'fee_rate': 'fee_rate',
  61. 'orig_id': 'orig_id',
  62. 'text': 'text',
  63. }
  64. def __init__(
  65. self,
  66. id=None,
  67. create_time=None,
  68. expire_time=None,
  69. status=None,
  70. side=None,
  71. currency=None,
  72. rate=None,
  73. amount=None,
  74. days=None,
  75. auto_renew=False,
  76. currency_pair=None,
  77. left=None,
  78. repaid=None,
  79. paid_interest=None,
  80. unpaid_interest=None,
  81. fee_rate=None,
  82. orig_id=None,
  83. text=None,
  84. local_vars_configuration=None,
  85. ): # noqa: E501
  86. # type: (str, str, str, str, str, str, str, str, int, bool, str, str, str, str, str, str, str, str, Configuration) -> None
  87. """Loan - a model defined in OpenAPI""" # noqa: E501
  88. if local_vars_configuration is None:
  89. local_vars_configuration = Configuration()
  90. self.local_vars_configuration = local_vars_configuration
  91. self._id = None
  92. self._create_time = None
  93. self._expire_time = None
  94. self._status = None
  95. self._side = None
  96. self._currency = None
  97. self._rate = None
  98. self._amount = None
  99. self._days = None
  100. self._auto_renew = None
  101. self._currency_pair = None
  102. self._left = None
  103. self._repaid = None
  104. self._paid_interest = None
  105. self._unpaid_interest = None
  106. self._fee_rate = None
  107. self._orig_id = None
  108. self._text = None
  109. self.discriminator = None
  110. if id is not None:
  111. self.id = id
  112. if create_time is not None:
  113. self.create_time = create_time
  114. if expire_time is not None:
  115. self.expire_time = expire_time
  116. if status is not None:
  117. self.status = status
  118. self.side = side
  119. self.currency = currency
  120. if rate is not None:
  121. self.rate = rate
  122. self.amount = amount
  123. if days is not None:
  124. self.days = days
  125. if auto_renew is not None:
  126. self.auto_renew = auto_renew
  127. if currency_pair is not None:
  128. self.currency_pair = currency_pair
  129. if left is not None:
  130. self.left = left
  131. if repaid is not None:
  132. self.repaid = repaid
  133. if paid_interest is not None:
  134. self.paid_interest = paid_interest
  135. if unpaid_interest is not None:
  136. self.unpaid_interest = unpaid_interest
  137. if fee_rate is not None:
  138. self.fee_rate = fee_rate
  139. if orig_id is not None:
  140. self.orig_id = orig_id
  141. if text is not None:
  142. self.text = text
  143. @property
  144. def id(self):
  145. """Gets the id of this Loan. # noqa: E501
  146. Loan ID # noqa: E501
  147. :return: The id of this Loan. # noqa: E501
  148. :rtype: str
  149. """
  150. return self._id
  151. @id.setter
  152. def id(self, id):
  153. """Sets the id of this Loan.
  154. Loan ID # noqa: E501
  155. :param id: The id of this Loan. # noqa: E501
  156. :type: str
  157. """
  158. self._id = id
  159. @property
  160. def create_time(self):
  161. """Gets the create_time of this Loan. # noqa: E501
  162. Creation time # noqa: E501
  163. :return: The create_time of this Loan. # noqa: E501
  164. :rtype: str
  165. """
  166. return self._create_time
  167. @create_time.setter
  168. def create_time(self, create_time):
  169. """Sets the create_time of this Loan.
  170. Creation time # noqa: E501
  171. :param create_time: The create_time of this Loan. # noqa: E501
  172. :type: str
  173. """
  174. self._create_time = create_time
  175. @property
  176. def expire_time(self):
  177. """Gets the expire_time of this Loan. # noqa: E501
  178. Repay time of the loan. No value will be returned for lending loan # noqa: E501
  179. :return: The expire_time of this Loan. # noqa: E501
  180. :rtype: str
  181. """
  182. return self._expire_time
  183. @expire_time.setter
  184. def expire_time(self, expire_time):
  185. """Sets the expire_time of this Loan.
  186. Repay time of the loan. No value will be returned for lending loan # noqa: E501
  187. :param expire_time: The expire_time of this Loan. # noqa: E501
  188. :type: str
  189. """
  190. self._expire_time = expire_time
  191. @property
  192. def status(self):
  193. """Gets the status of this Loan. # noqa: E501
  194. Loan status open - not fully loaned loaned - all loaned out for lending loan; loaned in for borrowing side finished - loan is finished, either being all repaid or cancelled by the lender auto_repaid - automatically repaid by the system # noqa: E501
  195. :return: The status of this Loan. # noqa: E501
  196. :rtype: str
  197. """
  198. return self._status
  199. @status.setter
  200. def status(self, status):
  201. """Sets the status of this Loan.
  202. Loan status open - not fully loaned loaned - all loaned out for lending loan; loaned in for borrowing side finished - loan is finished, either being all repaid or cancelled by the lender auto_repaid - automatically repaid by the system # noqa: E501
  203. :param status: The status of this Loan. # noqa: E501
  204. :type: str
  205. """
  206. allowed_values = ["open", "loaned", "finished", "auto_repaid"] # noqa: E501
  207. if self.local_vars_configuration.client_side_validation and status not in allowed_values: # noqa: E501
  208. raise ValueError(
  209. "Invalid value for `status` ({0}), must be one of {1}".format(status, allowed_values) # noqa: E501
  210. )
  211. self._status = status
  212. @property
  213. def side(self):
  214. """Gets the side of this Loan. # noqa: E501
  215. Loan side # noqa: E501
  216. :return: The side of this Loan. # noqa: E501
  217. :rtype: str
  218. """
  219. return self._side
  220. @side.setter
  221. def side(self, side):
  222. """Sets the side of this Loan.
  223. Loan side # noqa: E501
  224. :param side: The side of this Loan. # noqa: E501
  225. :type: str
  226. """
  227. if self.local_vars_configuration.client_side_validation and side is None: # noqa: E501
  228. raise ValueError("Invalid value for `side`, must not be `None`") # noqa: E501
  229. allowed_values = ["lend", "borrow"] # noqa: E501
  230. if self.local_vars_configuration.client_side_validation and side not in allowed_values: # noqa: E501
  231. raise ValueError(
  232. "Invalid value for `side` ({0}), must be one of {1}".format(side, allowed_values) # noqa: E501
  233. )
  234. self._side = side
  235. @property
  236. def currency(self):
  237. """Gets the currency of this Loan. # noqa: E501
  238. Loan currency # noqa: E501
  239. :return: The currency of this Loan. # noqa: E501
  240. :rtype: str
  241. """
  242. return self._currency
  243. @currency.setter
  244. def currency(self, currency):
  245. """Sets the currency of this Loan.
  246. Loan currency # noqa: E501
  247. :param currency: The currency of this Loan. # noqa: E501
  248. :type: str
  249. """
  250. if self.local_vars_configuration.client_side_validation and currency is None: # noqa: E501
  251. raise ValueError("Invalid value for `currency`, must not be `None`") # noqa: E501
  252. self._currency = currency
  253. @property
  254. def rate(self):
  255. """Gets the rate of this Loan. # noqa: E501
  256. Loan rate. Only rates in [0.0001, 0.01] are supported. Not required in lending. Market rate calculated from recent rates will be used if not set # noqa: E501
  257. :return: The rate of this Loan. # noqa: E501
  258. :rtype: str
  259. """
  260. return self._rate
  261. @rate.setter
  262. def rate(self, rate):
  263. """Sets the rate of this Loan.
  264. Loan rate. Only rates in [0.0001, 0.01] are supported. Not required in lending. Market rate calculated from recent rates will be used if not set # noqa: E501
  265. :param rate: The rate of this Loan. # noqa: E501
  266. :type: str
  267. """
  268. self._rate = rate
  269. @property
  270. def amount(self):
  271. """Gets the amount of this Loan. # noqa: E501
  272. Loan amount # noqa: E501
  273. :return: The amount of this Loan. # noqa: E501
  274. :rtype: str
  275. """
  276. return self._amount
  277. @amount.setter
  278. def amount(self, amount):
  279. """Sets the amount of this Loan.
  280. Loan amount # noqa: E501
  281. :param amount: The amount of this Loan. # noqa: E501
  282. :type: str
  283. """
  284. if self.local_vars_configuration.client_side_validation and amount is None: # noqa: E501
  285. raise ValueError("Invalid value for `amount`, must not be `None`") # noqa: E501
  286. self._amount = amount
  287. @property
  288. def days(self):
  289. """Gets the days of this Loan. # noqa: E501
  290. Loan days. Only 10 is supported for now # noqa: E501
  291. :return: The days of this Loan. # noqa: E501
  292. :rtype: int
  293. """
  294. return self._days
  295. @days.setter
  296. def days(self, days):
  297. """Sets the days of this Loan.
  298. Loan days. Only 10 is supported for now # noqa: E501
  299. :param days: The days of this Loan. # noqa: E501
  300. :type: int
  301. """
  302. self._days = days
  303. @property
  304. def auto_renew(self):
  305. """Gets the auto_renew of this Loan. # noqa: E501
  306. Whether to auto renew the loan upon expiration # noqa: E501
  307. :return: The auto_renew of this Loan. # noqa: E501
  308. :rtype: bool
  309. """
  310. return self._auto_renew
  311. @auto_renew.setter
  312. def auto_renew(self, auto_renew):
  313. """Sets the auto_renew of this Loan.
  314. Whether to auto renew the loan upon expiration # noqa: E501
  315. :param auto_renew: The auto_renew of this Loan. # noqa: E501
  316. :type: bool
  317. """
  318. self._auto_renew = auto_renew
  319. @property
  320. def currency_pair(self):
  321. """Gets the currency_pair of this Loan. # noqa: E501
  322. Currency pair. Required if borrowing # noqa: E501
  323. :return: The currency_pair of this Loan. # noqa: E501
  324. :rtype: str
  325. """
  326. return self._currency_pair
  327. @currency_pair.setter
  328. def currency_pair(self, currency_pair):
  329. """Sets the currency_pair of this Loan.
  330. Currency pair. Required if borrowing # noqa: E501
  331. :param currency_pair: The currency_pair of this Loan. # noqa: E501
  332. :type: str
  333. """
  334. self._currency_pair = currency_pair
  335. @property
  336. def left(self):
  337. """Gets the left of this Loan. # noqa: E501
  338. Amount not lent out yet # noqa: E501
  339. :return: The left of this Loan. # noqa: E501
  340. :rtype: str
  341. """
  342. return self._left
  343. @left.setter
  344. def left(self, left):
  345. """Sets the left of this Loan.
  346. Amount not lent out yet # noqa: E501
  347. :param left: The left of this Loan. # noqa: E501
  348. :type: str
  349. """
  350. self._left = left
  351. @property
  352. def repaid(self):
  353. """Gets the repaid of this Loan. # noqa: E501
  354. Repaid amount # noqa: E501
  355. :return: The repaid of this Loan. # noqa: E501
  356. :rtype: str
  357. """
  358. return self._repaid
  359. @repaid.setter
  360. def repaid(self, repaid):
  361. """Sets the repaid of this Loan.
  362. Repaid amount # noqa: E501
  363. :param repaid: The repaid of this Loan. # noqa: E501
  364. :type: str
  365. """
  366. self._repaid = repaid
  367. @property
  368. def paid_interest(self):
  369. """Gets the paid_interest of this Loan. # noqa: E501
  370. Repaid interest # noqa: E501
  371. :return: The paid_interest of this Loan. # noqa: E501
  372. :rtype: str
  373. """
  374. return self._paid_interest
  375. @paid_interest.setter
  376. def paid_interest(self, paid_interest):
  377. """Sets the paid_interest of this Loan.
  378. Repaid interest # noqa: E501
  379. :param paid_interest: The paid_interest of this Loan. # noqa: E501
  380. :type: str
  381. """
  382. self._paid_interest = paid_interest
  383. @property
  384. def unpaid_interest(self):
  385. """Gets the unpaid_interest of this Loan. # noqa: E501
  386. Outstanding interest yet to be paid # noqa: E501
  387. :return: The unpaid_interest of this Loan. # noqa: E501
  388. :rtype: str
  389. """
  390. return self._unpaid_interest
  391. @unpaid_interest.setter
  392. def unpaid_interest(self, unpaid_interest):
  393. """Sets the unpaid_interest of this Loan.
  394. Outstanding interest yet to be paid # noqa: E501
  395. :param unpaid_interest: The unpaid_interest of this Loan. # noqa: E501
  396. :type: str
  397. """
  398. self._unpaid_interest = unpaid_interest
  399. @property
  400. def fee_rate(self):
  401. """Gets the fee_rate of this Loan. # noqa: E501
  402. Loan fee rate # noqa: E501
  403. :return: The fee_rate of this Loan. # noqa: E501
  404. :rtype: str
  405. """
  406. return self._fee_rate
  407. @fee_rate.setter
  408. def fee_rate(self, fee_rate):
  409. """Sets the fee_rate of this Loan.
  410. Loan fee rate # noqa: E501
  411. :param fee_rate: The fee_rate of this Loan. # noqa: E501
  412. :type: str
  413. """
  414. self._fee_rate = fee_rate
  415. @property
  416. def orig_id(self):
  417. """Gets the orig_id of this Loan. # noqa: E501
  418. Original loan ID of the loan if auto-renewed, otherwise equals to id # noqa: E501
  419. :return: The orig_id of this Loan. # noqa: E501
  420. :rtype: str
  421. """
  422. return self._orig_id
  423. @orig_id.setter
  424. def orig_id(self, orig_id):
  425. """Sets the orig_id of this Loan.
  426. Original loan ID of the loan if auto-renewed, otherwise equals to id # noqa: E501
  427. :param orig_id: The orig_id of this Loan. # noqa: E501
  428. :type: str
  429. """
  430. self._orig_id = orig_id
  431. @property
  432. def text(self):
  433. """Gets the text of this Loan. # noqa: E501
  434. User defined custom ID # noqa: E501
  435. :return: The text of this Loan. # noqa: E501
  436. :rtype: str
  437. """
  438. return self._text
  439. @text.setter
  440. def text(self, text):
  441. """Sets the text of this Loan.
  442. User defined custom ID # noqa: E501
  443. :param text: The text of this Loan. # noqa: E501
  444. :type: str
  445. """
  446. self._text = text
  447. def to_dict(self):
  448. """Returns the model properties as a dict"""
  449. result = {}
  450. for attr, _ in six.iteritems(self.openapi_types):
  451. value = getattr(self, attr)
  452. if isinstance(value, list):
  453. result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
  454. elif hasattr(value, "to_dict"):
  455. result[attr] = value.to_dict()
  456. elif isinstance(value, dict):
  457. result[attr] = dict(
  458. map(
  459. lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item,
  460. value.items(),
  461. )
  462. )
  463. else:
  464. result[attr] = value
  465. return result
  466. def to_str(self):
  467. """Returns the string representation of the model"""
  468. return pprint.pformat(self.to_dict())
  469. def __repr__(self):
  470. """For `print` and `pprint`"""
  471. return self.to_str()
  472. def __eq__(self, other):
  473. """Returns true if both objects are equal"""
  474. if not isinstance(other, Loan):
  475. return False
  476. return self.to_dict() == other.to_dict()
  477. def __ne__(self, other):
  478. """Returns true if both objects are not equal"""
  479. if not isinstance(other, Loan):
  480. return True
  481. return self.to_dict() != other.to_dict()