Example #1
0
    async def __call__(self, ticker: str) -> Optional[pd.DataFrame]:
        """Получение дивидендов для заданного тикера."""
        self._logger(ticker)

        url = _prepare_url(ticker)
        html = await _get_page_html(url)
        cols_desc = _get_col_desc(ticker)

        try:
            df = parser.get_df_from_html(html, TABLE_NUM, cols_desc)
        except description.ParserError:
            return None

        return description.reformat_df_with_cur(df, ticker)
Example #2
0
    async def __call__(self, ticker: str) -> Optional[pd.DataFrame]:
        """Получение дивидендов для заданного тикера."""
        self._logger(ticker)

        cols_desc = get_col_desc(ticker)
        url = _prepare_url(ticker)

        try:
            html = await parser.get_html(url)
        except description.ParserError:
            return None

        try:
            table_index = _find_table_n(html)
        except description.ParserError:
            return None

        try:
            df = parser.get_df_from_html(html, table_index, cols_desc)
        except description.ParserError:
            return None

        return description.reformat_df_with_cur(df, ticker)