The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

Commit 7912d37f authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Vincent A

[amundi] Repair SRRI fetching and investment.code check

SRRI values may be '0 - Non disponible' instead of 1 to 7.
parent 4221a3a6
......@@ -28,7 +28,7 @@
from weboob.browser.filters.json import Dict
from weboob.browser.pages import LoggedPage, JsonPage
from weboob.capabilities.bank import Account, Investment, Transaction
from weboob.capabilities.base import NotAvailable
from weboob.capabilities.base import NotAvailable, empty
from weboob.exceptions import NoAccountsException
from weboob.tools.capabilities.bank.investments import is_isin_valid
......@@ -101,15 +101,26 @@ class item(ItemElement):
obj_unitvalue = Dict('vl') & CleanDecimal
obj_quantity = Dict('nbParts') & CleanDecimal
obj_valuation = Dict('mtBrut') & CleanDecimal
obj_code = Dict('codeIsin', default=NotAvailable)
obj_vdate = Date(Dict('dtVl'))
obj_srri = Eval(int, Dict('SRRI'))
def obj_code_type(self):
if is_isin_valid(Field('code')(self)):
return Investment.CODE_TYPE_ISIN
def obj_srri(self):
srri = Dict('SRRI')(self)
# The website displays '0 - Non disponible' when not available
if srri.startswith('0'):
return NotAvailable
return int(srri)
def obj_code(self):
code = Dict('codeIsin', default=NotAvailable)(self)
if is_isin_valid(code):
return code
return NotAvailable
def obj_code_type(self):
if empty(Field('code')(self)):
return NotAvailable
return Investment.CODE_TYPE_ISIN
def obj_performance_history(self):
# The Amundi JSON only contains 1 year and 5 years performances.
# It seems that when a value is unavailable, they display '0.0' instead...
......
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