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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 1

How to query Earnings WTD from SPX and MSCI BRAZIL by year

On Excel I use DSGRID("S&PCOMP";"afcmn2019;afcmn2020;afcmn2021;afcmn2022") and

DSGRID("msbrazl";"afcmn2019;afcmn2020;afcmn2021;afcmn2022"). How to query on python using ek.get_data?

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikon
icon clock
10 |1500

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

1 Answer

Upvotes
Accepted
39.2k 75 11 27

This data comes from Datastream Web Service. To retrieve it you need to use DatastreamDSWS library. For documentation see Getting Started Guide. You may also want to check out the video titled Build Financial Models in Python using Datastream Web Service.
Here's the code snippet that retrieves the data you're interested in

import DatastreamDSWS as dsws
ds = dsws.Datastream(username='my_username', password='my_password')
ds.get_data (tickers='S&PCOMP, MSBRAZL', 
             fields=['AFCMN2019','AFCMN2020','AFCMN2021','AFCMN2022'])
icon clock
10 |1500

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

Click below to post an Idea Post Idea