diff --git a/modules/netfinca/pages.py b/modules/netfinca/pages.py index b25cfe5d892469fc5699b55aa38b9d1703dff7bd..8c04576896e7fd42a6977ed23688f0bf12de699f 100644 --- a/modules/netfinca/pages.py +++ b/modules/netfinca/pages.py @@ -160,7 +160,10 @@ def obj_quantity(self): 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 @@ def obj_vdate(self): 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