本文整理汇总了Python中weboob.capabilities.bank.Investment._detail_url方法的典型用法代码示例。如果您正苦于以下问题:Python Investment._detail_url方法的具体用法?Python Investment._detail_url怎么用?Python Investment._detail_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weboob.capabilities.bank.Investment
的用法示例。
在下文中一共展示了Investment._detail_url方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_investment
# 需要导入模块: from weboob.capabilities.bank import Investment [as 别名]
# 或者: from weboob.capabilities.bank.Investment import _detail_url [as 别名]
def get_investment(self):
Decimal = CleanDecimal(replace_dots=True).filter
for tr in self._tr_list(self.document):
cells = list(el_to_string(td) for td in self._td_list(tr))
link = unicode(self._link(tr)[0])
'''
Boursorama table cells
----------------------
0. Fonds
1. Date de valeur
2. Valeur de part
3. Nombre de parts
4. Contre valeur
5. Prix revient
6. +/- value en €*
7. +/- value en %*
Investment model
----------------
label = StringField('Label of stocks')
code = StringField('Identifier of the stock (ISIN code)')
description = StringField('Short description of the stock')
quantity = IntField('Quantity of stocks')
unitprice = DecimalField('Buy price of one stock')
unitvalue = DecimalField('Current value of one stock')
valuation = DecimalField('Total current valuation of the Investment')
diff = DecimalField('Difference between the buy cost and the current valuation')
'''
inv = Investment()
isin = self.get_isin(link)
if isin:
inv.id = inv.code = isin
inv.label = cells[0]
inv.quantity = Decimal(cells[3])
inv.valuation = Decimal(cells[4])
inv.unitprice = Decimal(cells[5])
inv.unitvalue = Decimal(cells[2])
inv.diff = Decimal(cells[6])
inv._detail_url = link if '/cours.phtml' in link else None
yield inv
示例2: get_investment
# 需要导入模块: from weboob.capabilities.bank import Investment [as 别名]
# 或者: from weboob.capabilities.bank.Investment import _detail_url [as 别名]
def get_investment(self):
for tr in self.document.xpath('//table[@id="liste-positions-engagements"]/tbody/tr'):
cells = tr.xpath('./td')
if len(cells) < 6:
continue
inv = Investment()
inv.label = self.parser.tocleanstring(cells[0].xpath('.//a')[0])
isin_div = cells[0].xpath('.//div')
if len(isin_div) > 0:
inv.id = inv.code = self.parser.tocleanstring(isin_div[0])
inv.quantity = Decimal(cells[1])
# <td data-header="Cours">20,650<br>(<span class="varup">+0,54%</span>)</td>
inv.unitprice = Decimal(cells[2].xpath('text()')[0])
inv.unitvalue = Decimal(cells[3].xpath('text()')[0])
inv.valuation = Decimal(cells[4])
inv.diff = Decimal(cells[5])
inv._detail_url = None
yield inv