Remove hack to convert decimal to int
And better compliance with objects parameters
This commit is contained in:
parent
dfead7e925
commit
46bd54b41c
1 changed files with 8 additions and 7 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
from weboob.capabilities.base import NotAvailable
|
||||||
from weboob.capabilities.bank import Investment
|
from weboob.capabilities.bank import Investment
|
||||||
from weboob.browser.pages import RawPage, HTMLPage, LoggedPage
|
from weboob.browser.pages import RawPage, HTMLPage, LoggedPage
|
||||||
from weboob.browser.elements import ListElement, ItemElement, method
|
from weboob.browser.elements import ListElement, ItemElement, method
|
||||||
|
|
@ -35,19 +36,19 @@ class TitrePage(LoggedPage, RawPage):
|
||||||
def iter_investments(self):
|
def iter_investments(self):
|
||||||
# We did not get some html, but something like that (XX is a quantity, YY a price):
|
# We did not get some html, but something like that (XX is a quantity, YY a price):
|
||||||
# message='[...]
|
# message='[...]
|
||||||
#popup=2{6{E:ALO{PAR{{reel{695{380{ALSTOM REGROUPT#XX#YY,YY €#YY,YY €#1 YYY,YY €#-YYY,YY €#-42,42%#-0,98 %#42,42 %#|1|AXA#cotationValeur.php?val=E:CS&pl=6&nc=1&
|
# popup=2{6{E:ALO{PAR{{reel{695{380{ALSTOM REGROUPT#XX#YY,YY €#YY,YY €#1 YYY,YY €#-YYY,YY €#-42,42%#-0,98 %#42,42 %#|1|AXA#cotationValeur.php?val=E:CS&pl=6&nc=1&
|
||||||
#popup=2{6{E:CS{PAR{{reel{695{380{AXA#XX#YY,YY €#YY,YYY €#YYY,YY €#YY,YY €#3,70%#42,42 %#42,42 %#|1|blablablab #cotationValeur.php?val=P:CODE&pl=6&nc=1&
|
# popup=2{6{E:CS{PAR{{reel{695{380{AXA#XX#YY,YY €#YY,YYY €#YYY,YY €#YY,YY €#3,70%#42,42 %#42,42 %#|1|blablablab #cotationValeur.php?val=P:CODE&pl=6&nc=1&
|
||||||
# [...]
|
# [...]
|
||||||
lines = self.doc.split("popup=2")
|
lines = self.doc.split("popup=2")
|
||||||
lines.pop(0)
|
lines.pop(0)
|
||||||
for line in lines:
|
for line in lines:
|
||||||
columns = line.split('#')
|
columns = line.split('#')
|
||||||
code = columns[0].split('{')[2]
|
_id = columns[0].split('{')[2]
|
||||||
invest = Investment(code)
|
invest = Investment(_id)
|
||||||
invest.code = unicode(code)
|
|
||||||
invest.label = unicode(columns[0].split('{')[-1])
|
invest.label = unicode(columns[0].split('{')[-1])
|
||||||
# XXX sometimes there are decimal (!) quantities
|
invest.code = NotAvailable
|
||||||
invest.quantity = int(columns[1].split(',')[0].replace(' ', ''))
|
invest.description = unicode(_id.split(':')[1])
|
||||||
|
invest.quantity = Decimal(FrenchTransaction.clean_amount(columns[1]))
|
||||||
invest.unitprice = Decimal(FrenchTransaction.clean_amount(columns[2]))
|
invest.unitprice = Decimal(FrenchTransaction.clean_amount(columns[2]))
|
||||||
invest.unitvalue = Decimal(FrenchTransaction.clean_amount(columns[3]))
|
invest.unitvalue = Decimal(FrenchTransaction.clean_amount(columns[3]))
|
||||||
invest.valuation = Decimal(FrenchTransaction.clean_amount(columns[4]))
|
invest.valuation = Decimal(FrenchTransaction.clean_amount(columns[4]))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue