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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 0 1

How do I aggregate with the Python API?

I can aggregate country market capitalization in Excel with:


=TRAggregate("SCREEN(U(IN(EQUITY(Public,Active,Primary))),TR.CompanyMarketCap(CURN=USD)>=50000000)","TR.CompanyMarketCap(Curn=USD)","TR.HQCountryCode")


How do I get this through the Eikon Python API? Here's my best guess, but it is not working:

df, err = ek.get_data("TRAggregate(SCREEN(U(IN(EQUITY(Public,Active,Primary))),TR.CompanyMarketCap(CURN=USD)>=50000000),TR.CompanyMarketCap(Curn=USD),TR.HQCountryCode)","na")


I could retrieve all the data, and aggregate in Python using "df, err = ek.get_data("SCREEN(U(IN(Equity( ..." , but that would be inefficient. Right?


Thanks,

Brent

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
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
38.1k 69 35 53

@Brent Gregory

TRAggregate is an excel function so it could not be used in the ek.get_data method.

Yes, you are correct. You need to retrieve all the data and aggregate it in Python.


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