Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 2

Retrieve some chemistry industry companies' data using API

I want to pull some time series metrics (Revenue, Market Cap, P/E, Interest Costs, Earnings, etc.) for the top 25 chemicals business (by market cap as of Sep 2022) in several different regions. How to get these data through API? Someone helps me to download the data in excel, but load of human Erros. Think if I can use Refinitiv API may ensure the accuracy of data retrieved. Thank you

refinitiv-dataplatform-eikon#technologyapi#content
icon clock
10 |1500

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

hi @sarah.liu ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text on the left side of the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

@sarah.liu

Hi,

Please be informed that a reply has been verified as correct in answering the question, and marked as such.

Thanks,

AHS

Thank you!
Upvote
Accepted
78.8k 250 52 74

@sarah.liu

The function returns a Python dataframe so you can save it to a CSV file by using the following code.

rics.to_csv("output.csv")

You can also specify date fields in the field list, as shown below.

rics, err = ek.get_data(screener_exp, fields = ['TR.Revenue.Date','TR.Revenue','TR.PE.Date','TR.PE','EARNINGS'])

The output is:

1667895456174.png


1667895456174.png (43.4 KiB)
icon clock
10 |1500

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

Thank you so much for your help! Appreciated.
Upvote
78.8k 250 52 74

@sarah.liu

Sorry about the issue that you are facing.

You can use a screener expression with Eikon Data API to get the required RICs. Then, use the retrieved RICS to get the required data.

The code looks like this:

screener_exp = 'SCREEN(U(IN(Equity(active,public,primary))), IN(TR.HeadquartersRegion,"Asia"), IN(TR.GICSIndustryCode,"151010"), TOP(TR.CompanyMarketCap(SDate=2022-09-30), 25, nnumber), CURN=USD)'


rics, err = ek.get_data(instruments=[screener_exp], fields = ['TR.Revenue','TR.PE','EARNINGS'])
rics

The screener expression gets the top 25 chemicals business (IN(TR.GICSIndustryCode,"151010")) by market cap as of Sep 2022 (TOP(TR.CompanyMarketCap(SDate=2022-09-30)) in Asia (IN(TR.HeadquartersRegion,"Asia")).

Then, use the retrieved items to get TR.Revenue, TR.PE and EARNINGS.

The output is:

1667796573392.png

You can use the screener app to generate screener expressions and use the Data Item Browser to search for available fields.

I hope that this information is of help


1667796573392.png (35.6 KiB)
icon clock
10 |1500

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

Thank you so much @Jirapongse on your comments, it really helps. I am not familiar with the platform. Do you know after I get the retrieve data table results, how to save it in the format I want (e.g. csv, excel etc.) and download to my local desktop? And also do you know how to show the date column corresponding to metrics in the data results? Thanks for your time and help in advance!

@Jirapongse thanks for your response to my questions earlier. I'm now want to normalise the timeseries dataset, (get rid of some obvious outliers), do you know is there a function/way I can do that in the codebook or the Refinitiv workplace? Many thanks for your time in advance.

@sarah.liu

The output is in Pandas Dataframe. You can use the Dataframe functions to manage the data. You can find a lot of examples via Google, such as Remove outliers from Pandas DataFrame.


Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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