Esempio n. 1
0
            def obj_currency(self):
                tablecell = TableCell('balance')(self)[0]
                text = tablecell.xpath('./span/text()')[0]
                regex = '[0-9,.]* (.*)'
                currency = Currency().filter(re.search(regex, text).group(1))

                return currency
Esempio n. 2
0
            def original_unitvalue(self):
                tablecell = TableCell('unitvalue', colspan=True)(self)[0]
                text = tablecell.xpath('./text()')[0]

                regex = '[0-9,]* (.*)'
                currency = Currency().filter(re.search(regex, text).group(1))

                return currency, CleanDecimal(replace_dots=True).filter(text)
Esempio n. 3
0
            def obj_code(self):
                # We try to get the code from <a> div. If we didn't find code in url,
                # we try to find it in the cell text

                tablecell = TableCell('label', colspan=True)(self)[0]
                # url find try
                url = tablecell.xpath('./following-sibling::td[position()=1]/div/a')[0].attrib['href']
                code_match = re.search(r'sico=([A-Z0-9]*)', url)

                if code_match:
                    if is_isin_valid(code_match.group(1)):
                        return code_match.group(1)

                # cell text find try
                text = CleanText(tablecell.xpath('./following-sibling::td[position()=1]/div')[0])(self)

                for code in text.split(' '):
                    if is_isin_valid(code):
                        return code
                return NotAvailable
Esempio n. 4
0
            def obj_code(self):
                # We try to get the code from <a> div. If we didn't find code in url,
                # we try to find it in the cell text

                tablecell = TableCell('label', colspan=True)(self)[0]
                # url find try
                code_match = Regexp(
                    Link(tablecell.xpath('./following-sibling::td[position()=1]/div/a')),
                    r'sico=([A-Z0-9]*)',
                    default=None)(self)
                if is_isin_valid(code_match):
                    return code_match

                # cell text find try
                text = CleanText(tablecell.xpath('./following-sibling::td[position()=1]/div')[0])(self)

                for code in text.split(' '):
                    if is_isin_valid(code):
                        return code
                return NotAvailable
Esempio n. 5
0
            def obj_vdate(self):
                tablecell = TableCell('vdate', colspan=True)(self)[0]
                vdate_scrapped = tablecell.xpath('./preceding-sibling::td[position()=1]//span/text()')[0]

                # Scrapped date could be a schedule time (00:00) or a date (01/01/1970)
                vdate = NotAvailable

                if ':' in vdate_scrapped:
                    today = datetime.date.today()
                    h, m = [int(x) for x in vdate_scrapped.split(':')]
                    hour = datetime.time(hour=h, minute=m)
                    vdate = datetime.datetime.combine(today, hour)

                elif '/' in vdate_scrapped:
                    vdate = datetime.datetime.strptime(vdate_scrapped, '%d/%m/%y')

                return vdate
Esempio n. 6
0
            def obj_vdate(self):
                tablecell = TableCell('vdate', colspan=True)(self)[0]
                vdate_scrapped = tablecell.xpath('./preceding-sibling::td[position()=1]//span/text()')[0]

                # Scrapped date could be a schedule time (00:00) or a date (01/01/1970)
                vdate = NotAvailable

                if ':' in vdate_scrapped:
                    today = datetime.date.today()
                    h, m = [int(x) for x in vdate_scrapped.split(':')]
                    hour = datetime.time(hour=h, minute=m)
                    vdate = datetime.datetime.combine(today, hour)

                elif '/' in vdate_scrapped:
                    vdate = datetime.datetime.strptime(vdate_scrapped, '%d/%m/%y')

                return vdate
Esempio n. 7
0
 def obj_label(self):
     tablecell = TableCell('label')(self)[0]
     label = tablecell.xpath('./div[position()=1]')
     return CleanText(label)(self)
Esempio n. 8
0
 def obj_label(self):
     tablecell = TableCell('label', colspan=True)(self)[0]
     label = CleanText(tablecell.xpath('./following-sibling::td[@class=""]/div/a')[0])(self)
     return label
Esempio n. 9
0
 def obj_quantity(self):
     tablecell = TableCell('quantity', colspan=True)(self)[0]
     return CleanDecimal(tablecell.xpath('./span'), replace_dots=True)(self)
Esempio n. 10
0
 def obj_url(self):
     td = TableCell('id')(self)[0]
     return Link(td.xpath('./a'))(self)
Esempio n. 11
0
 def obj_quantity(self):
     tablecell = TableCell('quantity', colspan=True)(self)[0]
     return CleanDecimal(tablecell.xpath('./span'), replace_dots=True)(self)
Esempio n. 12
0
 def obj_balance(self):
     tablecell = TableCell('balance')(self)[0]
     b = tablecell.xpath('./span[@class="intraday"]')
     balance = CleanDecimal(replace_dots=True).filter(b)
     return Decimal(balance)
Esempio n. 13
0
 def obj_id(self):
     tablecell = TableCell('id')(self)[0]
     id = tablecell.xpath('./div[position()=2]')
     return CleanText().filter(id)
Esempio n. 14
0
 def obj_id(self):
     tablecell = TableCell('id')(self)[0]
     _id = tablecell.xpath('./div[position()=2]')
     return CleanText(_id)(self)
Esempio n. 15
0
 def original_unitvalue(self):
     tablecell = TableCell('unitvalue')(self)[0]
     text = tablecell.xpath('./text()')
     return Currency(
         text, default=NotAvailable)(self), CleanDecimal.French(
             text, default=NotAvailable)(self)
Esempio n. 16
0
 def obj_label(self):
     tablecell = TableCell('label')(self)[0]
     return CleanText(
         tablecell.xpath('./following-sibling::td[@class=""]/div/a')
         [0])(self)
Esempio n. 17
0
 def obj_quantity(self):
     tablecell = TableCell('quantity')(self)[0]
     return CleanDecimal.French(tablecell.xpath('./span'))(self)
Esempio n. 18
0
 def obj_label(self):
     tablecell = TableCell('label', colspan=True)(self)[0]
     label = CleanText(tablecell.xpath('./following-sibling::td[@class=""]/div/a')[0])(self)
     return label
Esempio n. 19
0
 def obj_label(self):
     tablecell = TableCell('label')(self)[0]
     label = tablecell.xpath('./div[position()=1]')
     return CleanText(label)(self)
Esempio n. 20
0
 def obj_balance(self):
     tablecell = TableCell('balance')(self)[0]
     balance = tablecell.xpath('./span[@class="intraday"]')
     return CleanDecimal.French(balance)(self)
Esempio n. 21
0
 def obj_currency(self):
     tablecell = TableCell('balance')(self)[0]
     currency = tablecell.xpath('./span[@class="intraday"]')
     return Currency(currency)(self)
Esempio n. 22
0
 def obj_url(self):
     td = TableCell('id')(self)[0]
     return Link(td.xpath('./a'))(self)