Number Of Analysts Historical Data

output-screenshot.pngI have list of CUSIPS for approx 7000 companies and I want to get the Number Of Analysts of these in a historic perspective over severalt years.I have tried different codes but I can't get the date/month/year in the output. How can I manage to do this?

Here's the code I have tried, it just gives the output of 12 in Period Month, I want to have the month and year as output.


fields = ['TR.CommonName', 'TR.NumberOfAnalysts.periodmonth', 'TR.NumberOfAnalysts']
df_eikon_timeseries = ek.get_data(cusips, fields, {'SDate':'2014-01-01','EDate':'2015-12-31','Frq':'M'})

See screenshot.


Tagged:

Best Answer

  • raksina.samasiri
    Answer ✓

    Hi @ole.a.solberg ,

    You can find the available output parameters of each field in Data Item Browser (DIB) in Eikon/workspace application

    For example, below is the screenshot of the DIB app of the field TR.NumberOfAnalysts, then check the 'Output' dropdown in the 'Parameters' tab to see available parameters, I choose 'date' here.

    1653482177660.png

    then add 'TR.NumberOfAnalysts.date' into the field list as below

    please note that ek.get_data function returns 2 outputs, which are dataframe and error message. so the syntax below assigns an output of this function to 2 variables is recommended

    fields = ['TR.CommonName', 'TR.NumberOfAnalysts.date', 'TR.NumberOfAnalysts.periodmonth', 'TR.NumberOfAnalysts']
    df, err = ek.get_data(['00030710','00036020'], fields, {'SDate':'2014-01-01','EDate':'2015-12-31','Frq':'M'})
    display(df)

    1653482304898.png


Answers

  • raksina.samasiri

    Sorry about the late reply but I haven't had the time to look at before now. Thanks for the help. This led me to the correct solution but I ended up using the parameter 'Calc Date' instead of date.