For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

ole.a.solberg avatar image
1 0 0 1

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.


python api
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

raksina.samasiri avatar image
4.2k 6 5 8

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



1653482177660.png (67.2 KiB)
1653482304898.png (47.3 KiB)
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ole.a.solberg avatar image
1 0 0 1

@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.

10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.