Missing file
This commit is contained in:
parent
943b0caeb9
commit
9325dd06dc
1 changed files with 56 additions and 0 deletions
56
modules/ing/pages/titre.py
Normal file
56
modules/ing/pages/titre.py
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright(C) 2013 Florent Fourcot
|
||||
#
|
||||
# This file is part of weboob.
|
||||
#
|
||||
# weboob is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# weboob is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
from weboob.capabilities.bank import Account, Investment
|
||||
from weboob.capabilities.base import NotAvailable
|
||||
from weboob.tools.browser import BasePage
|
||||
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
|
||||
|
||||
__all__ = ['TitrePage']
|
||||
|
||||
|
||||
class TitrePage(BasePage):
|
||||
def on_loaded(self):
|
||||
pass
|
||||
|
||||
def iter_investments(self):
|
||||
# We did not get some html, but something like that (XX is a quantity, YY a price):
|
||||
# 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: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&
|
||||
# [...]
|
||||
text = self.parser.tostring(self.document.getroot())
|
||||
lines = text.split("popup=2")
|
||||
lines.pop(0)
|
||||
for line in lines:
|
||||
columns = line.split('#')
|
||||
code = columns[0].split('{')[2]
|
||||
invest = Investment(code)
|
||||
invest.code = code
|
||||
invest.label = columns[0].split('{')[-1]
|
||||
invest.quantity = int(columns[1])
|
||||
invest.unitprice = Decimal(FrenchTransaction.clean_amount(columns[2]))
|
||||
invest.unitvalue = Decimal(FrenchTransaction.clean_amount(columns[3]))
|
||||
invest.valuation = Decimal(FrenchTransaction.clean_amount(columns[4]))
|
||||
invest.diff = Decimal(FrenchTransaction.clean_amount(columns[5]))
|
||||
|
||||
yield invest
|
||||
Loading…
Add table
Add a link
Reference in a new issue