Esempio n. 1
0
    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&
        # [...]
        lines = self.doc.split("popup=2")
        lines.pop(0)
        for line in lines:
            columns = line.split('#')
            _id = columns[0].split('{')[2]
            invest = Investment(_id)
            invest.label = unicode(columns[0].split('{')[-1])
            invest.code = NotAvailable
            if ':' in _id:
                invest.description = unicode(_id.split(':')[1])
            invest.quantity = Decimal(
                FrenchTransaction.clean_amount(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
Esempio n. 2
0
 def iter_investments(self, data):
     acc = data['acc']
     for disp in self.doc['positionsSalarieDispositifDto']:
         if disp['codeDispositif'] == acc.id:
             for ele in disp['positionsSalarieFondsDto']:
                 if ele['mtBrut']:
                     inv = Investment()
                     inv.label = ele['libelleFonds']
                     inv.code = ele['codeIsin']
                     inv.description = inv.label
                     inv.quantity = Decimal(ele['nbParts'])
                     inv.unitvalue = Decimal(ele['vl'])
                     inv.valuation = inv.unitvalue * inv.quantity
                     inv.diff = Decimal(ele['mtPMV'])
                     yield inv
Esempio n. 3
0
    def iter_investment(self):
        rows = self.document.xpath('//table[@id="mefav_repartition_supports_BPF"]//tr') or \
               self.document.xpath('//tbody[@id="mefav_repartition_supports"]//tr')
        for tr in rows:
            cells = clean_cells(tr.findall('td'))
            cells[3:] = clean_amounts(cells[3:])

            inv = Investment()
            inv.label, _, inv.code, inv.quantity, inv.unitvalue, inv.valuation, _ = cells

            if inv.code:
                inv.id = inv.code
            if not inv.unitvalue:
                # XXX Fonds eu Euros
                inv.code = u'XX' + re.sub(ur'[^A-Za-z0-9]', u'', inv.label).upper()
            inv.description = u''

            yield inv
Esempio n. 4
0
    def iter_investment(self):
        rows = self.document.xpath('//table[@id="mefav_repartition_supports_BPF"]//tr') or \
               self.document.xpath('//tbody[@id="mefav_repartition_supports"]//tr')
        for tr in rows:
            cells = clean_cells(tr.findall('td'))
            cells[3:] = clean_amounts(cells[3:])

            inv = Investment()
            inv.label, _, inv.code, inv.quantity, inv.unitvalue, inv.valuation, _ = cells

            if inv.code:
                inv.id = inv.code
            if not inv.unitvalue:
                # XXX Fonds eu Euros
                inv.code = u'XX' + re.sub(ur'[^A-Za-z0-9]', u'',
                                          inv.label).upper()
            inv.description = u''

            yield inv
Esempio n. 5
0
    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&
        # [...]
        lines = self.doc.split("popup=2")
        lines.pop(0)
        for line in lines:
            columns = line.split('#')
            _id = columns[0].split('{')[2]
            invest = Investment(_id)
            invest.label = unicode(columns[0].split('{')[-1])
            invest.code = _id.split(':')[0]
            if ':' in _id:
                invest.description = unicode(_id.split(':')[1])
            quantity = FrenchTransaction.clean_amount(columns[1])
            if quantity != '':
                invest.quantity = Decimal(quantity)
            else:
                invest.quantity = NotAvailable
            unitprice = FrenchTransaction.clean_amount(columns[2])
            if unitprice != '':
                invest.unitprice = Decimal(unitprice)
            else:
                invest.unitprice = NotAvailable
            unitvalue = FrenchTransaction.clean_amount(columns[3])
            if unitvalue != '':
                invest.unitvalue = Decimal(unitvalue)
            else:
                invest.unitvalue = NotAvailable
            valuation = FrenchTransaction.clean_amount(columns[4])
            if valuation != '':
                invest.valuation = Decimal(valuation)
            else:
                invest.valuation = NotAvailable
            diff = FrenchTransaction.clean_amount(columns[5])
            if diff != '':
                invest.diff = Decimal(diff)
            else:
                invest.diff = NotAvailable

            yield invest
Esempio n. 6
0
    def iter_investment(self):
        table = self.document.xpath('//table[@align="center"]')[4]
        rows = table.xpath('.//tr[@class="hdoc1"]')
        for tr in rows:
            cells = clean_cells(tr.findall('td'))
            cells[2:] = clean_amounts(cells[2:])

            inv = Investment()
            inv.label, _, inv.quantity, inv.unitvalue, inv.valuation = cells

            tr2 = tr.xpath('./following-sibling::tr')[0]
            tr2td = tr2.findall('td')[1]

            inv.id = inv.code = clean_text(tr2.xpath('.//a')[0])
            inv.unitprice = clean_amount(tr2td.xpath('.//td[@class="hdotc1nb"]')[0].text)

            inv.description = u''
            if inv.unitprice:
                inv.diff = inv.quantity * inv.unitprice - inv.valuation

            yield inv
Esempio n. 7
0
    def iter_investment(self):
        table = self.document.xpath('//table[@align="center"]')[4]
        rows = table.xpath('.//tr[@class="hdoc1"]')
        for tr in rows:
            cells = clean_cells(tr.findall('td'))
            cells[2:] = clean_amounts(cells[2:])

            inv = Investment()
            inv.label, _, inv.quantity, inv.unitvalue, inv.valuation = cells

            tr2 = tr.xpath('./following-sibling::tr')[0]
            tr2td = tr2.findall('td')[1]

            inv.id = inv.code = clean_text(tr2.xpath('.//a')[0])
            inv.unitprice = clean_amount(
                tr2td.xpath('.//td[@class="hdotc1nb"]')[0].text)

            inv.description = u''
            if inv.unitprice:
                inv.diff = inv.quantity * inv.unitprice - inv.valuation

            yield inv