Is it possible to get a company's ticker with just the name enter by an user input?

Here is my code. I want to get the company's ticker when a user input the company name. It seems not bee working as I get NONE

company_name = ['entry2']

company_ticker, err =

ek.get_data(['SCREEN(U(IN(Equity(active,public,primary))),Contains(TR.CommonName,"company_name"))'], ['TR.CommonName'])

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @maxwilliams.boko

    I hope that this is what you are looking for.

    company_name = "Voda"
    screener_exp = 'SCREEN(U(IN(Equity(active,public,primary))),Contains(TR.CommonName,"{}"))'.format(company_name)

    company_ticker, err = ek.get_data(instruments=[screener_exp], fields = ['TR.RIC','TR.CommonName','TR.TickerSymbol'])
    company_ticker

    There are other ways to insert values into strings.

Answers

  • Hi @maxwilliams.boko

    I think you may consider search() from RDP Library.

    Please review this article.

    You can try the RDP Library by launching CODEBOOK app.

    Just type "CODEBOOK" on Eikon Search bar and launch the app.

    Then browse to \Examples\02-Refinitiv Data Platform Library/1-5.0 - Function Search sample notebook.


  • @maxwilliams.boko you should use the RDP search service instead (which you can access via your eikon appkey):

    import refinitiv.dataplatform as rdp
    session = rdp.open_desktop_session('YOUR APPKEY HERE')
    company_name = 'vodafone'
    df = rdp.search(
        view = rdp.SearchViews.Quotes,
        query = company_name
    )

    print(df['RIC'][0])

    image

    I hope this can help.


  • I am getting refinitiv module does not exist

  • @maxwilliams.boko you need to pip install refinitiv.dataplatform from python prompt. You can also check our quickstart guide. I hope this can help

  • @jason.ramchandani Thanks for your help. However, I am sure I can use the first code I provided. However, I don’t know how to pass the user entry into the code. I saw somewhere that’s it is possible to use %s something like that

  • It is still not working. I think there should be a way to pass company_name = ['entry2'] in the code to get the company's name.

    company_name = ['entry2']

    company_ticker, err =

    ek.get_data(['SCREEN(U(IN(Equity(active,public,primary))),Contains(TR.CommonName,"company_name"))'], ['TR.CommonName'])