从Bloomberg的股票代码中寻找公司名称

时间:2017-05-11 06:25:12

标签: bloomberg

我有一个代码清单,但是当我使用https://www.bloomberg.com/markets/symbolsearch查找公司名称时,它会显示代码不正确。

这是代码:

def check_ticker(soup, ticker_c):
    tables = soup.findAll("table", {"class": "dual_border_data_table"})
    company_name = ""
    if len(tables) > 0:
        bm_table = tables[0]
        rows = bm_table.findAll("tr")
        row = rows[1]
        cells = row.findAll("td")
        if cells[0].get_text() == ticker_c:
            cn = cells[1].get_text()
            company_name = cn
        else:
            company_name = ""
    else:
        b = soup.findAll("div", {"class": "ticker_nomatches"})
        if len(b) > 0:
            company_name = ""
    return company_name

这是没有得到任何匹配的列表:

ESS PW
KKD US
QVCA US
HAR US
LXK US
WWAV US
HEN3 GR
036220 KS
CIG PW
068420 KS
6767 JP
OVTI US
SCTY US
CSC US
STRZA US
ISG LN

有没有API可以做到这一点?

0 个答案:

没有答案
相关问题