PricingVO.py 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class PricingVO(object):
  6. def __init__(self):
  7. self._bid = None
  8. self._currency = None
  9. self._currency_unit = None
  10. self._expiry_timestamp = None
  11. self._generate_timestamp = None
  12. self._maturity_date = None
  13. self._maximum_bid_amount = None
  14. self._maximum_offer_amount = None
  15. self._memo = None
  16. self._mid = None
  17. self._minimum_bid_amount = None
  18. self._minimum_offer_amount = None
  19. self._offer = None
  20. self._period = None
  21. self._rate_reference_id = None
  22. self._rate_type = None
  23. self._spot_bid = None
  24. self._spot_mid = None
  25. self._spot_offer = None
  26. self._start_timestamp = None
  27. self._symbol = None
  28. self._threshold_timestamp = None
  29. self._valid_timestamp = None
  30. @property
  31. def bid(self):
  32. return self._bid
  33. @bid.setter
  34. def bid(self, value):
  35. self._bid = value
  36. @property
  37. def currency(self):
  38. return self._currency
  39. @currency.setter
  40. def currency(self, value):
  41. self._currency = value
  42. @property
  43. def currency_unit(self):
  44. return self._currency_unit
  45. @currency_unit.setter
  46. def currency_unit(self, value):
  47. self._currency_unit = value
  48. @property
  49. def expiry_timestamp(self):
  50. return self._expiry_timestamp
  51. @expiry_timestamp.setter
  52. def expiry_timestamp(self, value):
  53. self._expiry_timestamp = value
  54. @property
  55. def generate_timestamp(self):
  56. return self._generate_timestamp
  57. @generate_timestamp.setter
  58. def generate_timestamp(self, value):
  59. self._generate_timestamp = value
  60. @property
  61. def maturity_date(self):
  62. return self._maturity_date
  63. @maturity_date.setter
  64. def maturity_date(self, value):
  65. self._maturity_date = value
  66. @property
  67. def maximum_bid_amount(self):
  68. return self._maximum_bid_amount
  69. @maximum_bid_amount.setter
  70. def maximum_bid_amount(self, value):
  71. self._maximum_bid_amount = value
  72. @property
  73. def maximum_offer_amount(self):
  74. return self._maximum_offer_amount
  75. @maximum_offer_amount.setter
  76. def maximum_offer_amount(self, value):
  77. self._maximum_offer_amount = value
  78. @property
  79. def memo(self):
  80. return self._memo
  81. @memo.setter
  82. def memo(self, value):
  83. self._memo = value
  84. @property
  85. def mid(self):
  86. return self._mid
  87. @mid.setter
  88. def mid(self, value):
  89. self._mid = value
  90. @property
  91. def minimum_bid_amount(self):
  92. return self._minimum_bid_amount
  93. @minimum_bid_amount.setter
  94. def minimum_bid_amount(self, value):
  95. self._minimum_bid_amount = value
  96. @property
  97. def minimum_offer_amount(self):
  98. return self._minimum_offer_amount
  99. @minimum_offer_amount.setter
  100. def minimum_offer_amount(self, value):
  101. self._minimum_offer_amount = value
  102. @property
  103. def offer(self):
  104. return self._offer
  105. @offer.setter
  106. def offer(self, value):
  107. self._offer = value
  108. @property
  109. def period(self):
  110. return self._period
  111. @period.setter
  112. def period(self, value):
  113. self._period = value
  114. @property
  115. def rate_reference_id(self):
  116. return self._rate_reference_id
  117. @rate_reference_id.setter
  118. def rate_reference_id(self, value):
  119. self._rate_reference_id = value
  120. @property
  121. def rate_type(self):
  122. return self._rate_type
  123. @rate_type.setter
  124. def rate_type(self, value):
  125. self._rate_type = value
  126. @property
  127. def spot_bid(self):
  128. return self._spot_bid
  129. @spot_bid.setter
  130. def spot_bid(self, value):
  131. self._spot_bid = value
  132. @property
  133. def spot_mid(self):
  134. return self._spot_mid
  135. @spot_mid.setter
  136. def spot_mid(self, value):
  137. self._spot_mid = value
  138. @property
  139. def spot_offer(self):
  140. return self._spot_offer
  141. @spot_offer.setter
  142. def spot_offer(self, value):
  143. self._spot_offer = value
  144. @property
  145. def start_timestamp(self):
  146. return self._start_timestamp
  147. @start_timestamp.setter
  148. def start_timestamp(self, value):
  149. self._start_timestamp = value
  150. @property
  151. def symbol(self):
  152. return self._symbol
  153. @symbol.setter
  154. def symbol(self, value):
  155. self._symbol = value
  156. @property
  157. def threshold_timestamp(self):
  158. return self._threshold_timestamp
  159. @threshold_timestamp.setter
  160. def threshold_timestamp(self, value):
  161. self._threshold_timestamp = value
  162. @property
  163. def valid_timestamp(self):
  164. return self._valid_timestamp
  165. @valid_timestamp.setter
  166. def valid_timestamp(self, value):
  167. self._valid_timestamp = value
  168. def to_alipay_dict(self):
  169. params = dict()
  170. if self.bid:
  171. if hasattr(self.bid, 'to_alipay_dict'):
  172. params['bid'] = self.bid.to_alipay_dict()
  173. else:
  174. params['bid'] = self.bid
  175. if self.currency:
  176. if hasattr(self.currency, 'to_alipay_dict'):
  177. params['currency'] = self.currency.to_alipay_dict()
  178. else:
  179. params['currency'] = self.currency
  180. if self.currency_unit:
  181. if hasattr(self.currency_unit, 'to_alipay_dict'):
  182. params['currency_unit'] = self.currency_unit.to_alipay_dict()
  183. else:
  184. params['currency_unit'] = self.currency_unit
  185. if self.expiry_timestamp:
  186. if hasattr(self.expiry_timestamp, 'to_alipay_dict'):
  187. params['expiry_timestamp'] = self.expiry_timestamp.to_alipay_dict()
  188. else:
  189. params['expiry_timestamp'] = self.expiry_timestamp
  190. if self.generate_timestamp:
  191. if hasattr(self.generate_timestamp, 'to_alipay_dict'):
  192. params['generate_timestamp'] = self.generate_timestamp.to_alipay_dict()
  193. else:
  194. params['generate_timestamp'] = self.generate_timestamp
  195. if self.maturity_date:
  196. if hasattr(self.maturity_date, 'to_alipay_dict'):
  197. params['maturity_date'] = self.maturity_date.to_alipay_dict()
  198. else:
  199. params['maturity_date'] = self.maturity_date
  200. if self.maximum_bid_amount:
  201. if hasattr(self.maximum_bid_amount, 'to_alipay_dict'):
  202. params['maximum_bid_amount'] = self.maximum_bid_amount.to_alipay_dict()
  203. else:
  204. params['maximum_bid_amount'] = self.maximum_bid_amount
  205. if self.maximum_offer_amount:
  206. if hasattr(self.maximum_offer_amount, 'to_alipay_dict'):
  207. params['maximum_offer_amount'] = self.maximum_offer_amount.to_alipay_dict()
  208. else:
  209. params['maximum_offer_amount'] = self.maximum_offer_amount
  210. if self.memo:
  211. if hasattr(self.memo, 'to_alipay_dict'):
  212. params['memo'] = self.memo.to_alipay_dict()
  213. else:
  214. params['memo'] = self.memo
  215. if self.mid:
  216. if hasattr(self.mid, 'to_alipay_dict'):
  217. params['mid'] = self.mid.to_alipay_dict()
  218. else:
  219. params['mid'] = self.mid
  220. if self.minimum_bid_amount:
  221. if hasattr(self.minimum_bid_amount, 'to_alipay_dict'):
  222. params['minimum_bid_amount'] = self.minimum_bid_amount.to_alipay_dict()
  223. else:
  224. params['minimum_bid_amount'] = self.minimum_bid_amount
  225. if self.minimum_offer_amount:
  226. if hasattr(self.minimum_offer_amount, 'to_alipay_dict'):
  227. params['minimum_offer_amount'] = self.minimum_offer_amount.to_alipay_dict()
  228. else:
  229. params['minimum_offer_amount'] = self.minimum_offer_amount
  230. if self.offer:
  231. if hasattr(self.offer, 'to_alipay_dict'):
  232. params['offer'] = self.offer.to_alipay_dict()
  233. else:
  234. params['offer'] = self.offer
  235. if self.period:
  236. if hasattr(self.period, 'to_alipay_dict'):
  237. params['period'] = self.period.to_alipay_dict()
  238. else:
  239. params['period'] = self.period
  240. if self.rate_reference_id:
  241. if hasattr(self.rate_reference_id, 'to_alipay_dict'):
  242. params['rate_reference_id'] = self.rate_reference_id.to_alipay_dict()
  243. else:
  244. params['rate_reference_id'] = self.rate_reference_id
  245. if self.rate_type:
  246. if hasattr(self.rate_type, 'to_alipay_dict'):
  247. params['rate_type'] = self.rate_type.to_alipay_dict()
  248. else:
  249. params['rate_type'] = self.rate_type
  250. if self.spot_bid:
  251. if hasattr(self.spot_bid, 'to_alipay_dict'):
  252. params['spot_bid'] = self.spot_bid.to_alipay_dict()
  253. else:
  254. params['spot_bid'] = self.spot_bid
  255. if self.spot_mid:
  256. if hasattr(self.spot_mid, 'to_alipay_dict'):
  257. params['spot_mid'] = self.spot_mid.to_alipay_dict()
  258. else:
  259. params['spot_mid'] = self.spot_mid
  260. if self.spot_offer:
  261. if hasattr(self.spot_offer, 'to_alipay_dict'):
  262. params['spot_offer'] = self.spot_offer.to_alipay_dict()
  263. else:
  264. params['spot_offer'] = self.spot_offer
  265. if self.start_timestamp:
  266. if hasattr(self.start_timestamp, 'to_alipay_dict'):
  267. params['start_timestamp'] = self.start_timestamp.to_alipay_dict()
  268. else:
  269. params['start_timestamp'] = self.start_timestamp
  270. if self.symbol:
  271. if hasattr(self.symbol, 'to_alipay_dict'):
  272. params['symbol'] = self.symbol.to_alipay_dict()
  273. else:
  274. params['symbol'] = self.symbol
  275. if self.threshold_timestamp:
  276. if hasattr(self.threshold_timestamp, 'to_alipay_dict'):
  277. params['threshold_timestamp'] = self.threshold_timestamp.to_alipay_dict()
  278. else:
  279. params['threshold_timestamp'] = self.threshold_timestamp
  280. if self.valid_timestamp:
  281. if hasattr(self.valid_timestamp, 'to_alipay_dict'):
  282. params['valid_timestamp'] = self.valid_timestamp.to_alipay_dict()
  283. else:
  284. params['valid_timestamp'] = self.valid_timestamp
  285. return params
  286. @staticmethod
  287. def from_alipay_dict(d):
  288. if not d:
  289. return None
  290. o = PricingVO()
  291. if 'bid' in d:
  292. o.bid = d['bid']
  293. if 'currency' in d:
  294. o.currency = d['currency']
  295. if 'currency_unit' in d:
  296. o.currency_unit = d['currency_unit']
  297. if 'expiry_timestamp' in d:
  298. o.expiry_timestamp = d['expiry_timestamp']
  299. if 'generate_timestamp' in d:
  300. o.generate_timestamp = d['generate_timestamp']
  301. if 'maturity_date' in d:
  302. o.maturity_date = d['maturity_date']
  303. if 'maximum_bid_amount' in d:
  304. o.maximum_bid_amount = d['maximum_bid_amount']
  305. if 'maximum_offer_amount' in d:
  306. o.maximum_offer_amount = d['maximum_offer_amount']
  307. if 'memo' in d:
  308. o.memo = d['memo']
  309. if 'mid' in d:
  310. o.mid = d['mid']
  311. if 'minimum_bid_amount' in d:
  312. o.minimum_bid_amount = d['minimum_bid_amount']
  313. if 'minimum_offer_amount' in d:
  314. o.minimum_offer_amount = d['minimum_offer_amount']
  315. if 'offer' in d:
  316. o.offer = d['offer']
  317. if 'period' in d:
  318. o.period = d['period']
  319. if 'rate_reference_id' in d:
  320. o.rate_reference_id = d['rate_reference_id']
  321. if 'rate_type' in d:
  322. o.rate_type = d['rate_type']
  323. if 'spot_bid' in d:
  324. o.spot_bid = d['spot_bid']
  325. if 'spot_mid' in d:
  326. o.spot_mid = d['spot_mid']
  327. if 'spot_offer' in d:
  328. o.spot_offer = d['spot_offer']
  329. if 'start_timestamp' in d:
  330. o.start_timestamp = d['start_timestamp']
  331. if 'symbol' in d:
  332. o.symbol = d['symbol']
  333. if 'threshold_timestamp' in d:
  334. o.threshold_timestamp = d['threshold_timestamp']
  335. if 'valid_timestamp' in d:
  336. o.valid_timestamp = d['valid_timestamp']
  337. return o