本文整理汇总了Python中weboob.capabilities.bank.Investment.portfolio_share方法的典型用法代码示例。如果您正苦于以下问题:Python Investment.portfolio_share方法的具体用法?Python Investment.portfolio_share怎么用?Python Investment.portfolio_share使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weboob.capabilities.bank.Investment
的用法示例。
在下文中一共展示了Investment.portfolio_share方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: iter_investment
# 需要导入模块: from weboob.capabilities.bank import Investment [as 别名]
# 或者: from weboob.capabilities.bank.Investment import portfolio_share [as 别名]
def iter_investment(self):
item = self.doc.xpath(u'//table[@summary="Liste des échéances"]/tfoot/tr/td[@class="tot _c1 d _c1"]')[0]
total = CleanDecimal(Regexp(CleanText('.'), '(.*) .*'),
default=1, replace_dots=True)(item)
item_xpath = u'((//table[@summary="Liste des échéances"])[1]/tbody/tr)[position() < last() and not(contains(./td[1]/@class, "tittot"))]'
obj = None
for tr in self.doc.xpath(item_xpath):
tds = tr.xpath('./td')
if len(tds) > 3:
if obj is not None:
obj.portfolio_share = (obj.valuation / total).quantize(Decimal('.0001'))
yield obj
obj = Investment()
obj.label = CleanText('.')(tds[0])
obj.vdate = date.today() # * En réalité derniere date de valorisation connue
obj.unitvalue = CleanDecimal('.', replace_dots=True)(tds[2])
obj.valuation = CleanDecimal('.', replace_dots=True)(tds[5])
obj.quantity = CleanDecimal('.', replace_dots=True)(tds[4])
elif obj is not None:
obj.quantity += CleanDecimal('.', replace_dots=True)(tds[1])
obj.valuation += CleanDecimal('.', replace_dots=True)(tds[2])
if obj is not None:
obj.portfolio_share = (obj.valuation / total).quantize(Decimal('.0001'))
yield obj
示例2: iter_investment
# 需要导入模块: from weboob.capabilities.bank import Investment [as 别名]
# 或者: from weboob.capabilities.bank.Investment import portfolio_share [as 别名]
def iter_investment(self, account):
self.account.go(id=account.id)
key = self.page.get_invest_key()
self.invests.go()
data = self.page.get_invest(*key)
for item in data:
inv = Investment()
inv.code = item['isin']
inv.label = item['name']
inv.portfolio_share = item['share']
inv.valuation = account.balance * inv.portfolio_share
yield inv
示例3: iter_investment
# 需要导入模块: from weboob.capabilities.bank import Investment [as 别名]
# 或者: from weboob.capabilities.bank.Investment import portfolio_share [as 别名]
def iter_investment(self):
cleaner = CleanText().filter
for line in self.doc.xpath('//div[@class="supportTable"]//table/tbody/tr'):
tds = line.findall('td')
if len(tds) < 4:
continue
inv = Investment()
if self.doc.xpath('//div[@id="table-evolution-contrat"]//table/tbody/tr[1]/td[1]'):
inv.vdate = Date(dayfirst=True).filter(CleanText().filter(
self.doc.xpath('//div[@id="table-evolution-contrat"]//table/tbody/tr[1]/td[1]')))
else:
inv.vdate = NotAvailable
inv.label = cleaner(tds[self.COL_LABEL])
inv.code = cleaner(tds[self.COL_CODE])
inv.valuation = Decimal(FrenchTransaction.clean_amount(
cleaner(tds[self.COL_VALUATION])))
inv.portfolio_share = Decimal(FrenchTransaction.clean_amount(
cleaner(tds[self.COL_PORTFOLIO_SHARE]))) / 100
yield inv