Commit 3105fe4f authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Vincent A

[netfinca] Correct original_unitvalue & quantity for Euro funds

It seems that the display slightly changed for euro funds investments:
now they display a 'percentage' in the 'Cours' column (which usually
contains the unitvalue or the original_unitvalue) and display the
purchased amount in the 'Quantité' column.
We must ignore these values because they do not correspond to the data
usually contained in these columns.
parent 5142a6d7
......@@ -160,7 +160,10 @@ class InvestmentsPage(LoggedPage, HTMLPage):
tablecell = TableCell('quantity', default=NotAvailable)(self)
if empty(tablecell):
return NotAvailable
return CleanDecimal.French(tablecell[0].xpath('./span'))(self)
elif '€' in Base(tablecell, CleanText('./span'))(self):
# Euro funds only have the amount invested (in euros) in this column
return NotAvailable
return Base(tablecell, CleanDecimal.French('./span'))(self)
def obj_label(self):
tablecell = TableCell('label')(self)[0]
......@@ -235,9 +238,16 @@ class InvestmentsPage(LoggedPage, HTMLPage):
def original_unitvalue(self):
tablecell = TableCell('unitvalue', default=NotAvailable)(self)
if empty(tablecell):
return NotAvailable
text = tablecell[0].xpath('./text()')
return Currency(text, default=NotAvailable)(self), CleanDecimal.French(text, default=NotAvailable)(self)
return (NotAvailable, NotAvailable)
text = Base(tablecell, CleanText('.'))(self)
if '%' in text:
# For euro funds, the unit_value is replaced by a diff percentage
return (NotAvailable, NotAvailable)
return (
Base(tablecell, Currency('.', default=NotAvailable))(self),
Base(tablecell, CleanDecimal.French('.', default=NotAvailable))(self)
def get_liquidity(self):
# Not all accounts have a Liquidity element
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment