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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 1 2

"GAVG" function in python API

Some of my Excel fromulas used the "GAVG" Function, and it worked really well. an example:

GAVG(TR.HQCountryCode,TR.GICSIndustry,TR.RevenueSmartEstLastYrGrowth,universe="EquityAll"),Curn=USD

This function does not seem to work well in the Python scripting API. sometimes it works, but most of the time it crashes, displaying the error: HTTPError: 400 Bad Request.

Is the GAVG function supported?

eikoneikon-data-apipythonworkspaceworkspace-data-apirefinitiv-dataplatform-eikonexcelerror-400
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.

Upvotes
Accepted
39.3k 76 11 27

While the use of these functions is not yet officially supported through Eikon Python API, this seems to work just dandy for me:
ek.get_data(['TRI.N','IBM.N','AAPL.O'],['GAVG(TR.HQCountryCode,TR.GICSIndustry,TR.RevenueSmartEstLastYrGrowth,universe="EquityAll")'],{'Curn':'USD'})
Would you mind giving me an example, which returns Bad Request for you?

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.

Upvotes
39.3k 76 11 27

I'm afraid the functions such as this one that you can see in Quick Functions section of Parameters & Quick Functions Tab in Formula Builder dialog in Eikon Excel cannot be used in Eikon Python API. At least not today.

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.

Upvotes
1 0 0 0

hi, I tried above and it worked but admit getting HTTPError: 400 Bad Request occasionally.
Also Eikon Excel returns different result:

=TR("TRI.N;IBM.N;AAPL.O","TR.HQCountryCode;TR.GICSIndustry;GAVG(TR.RevenueSmartEstLastYrGrowth,universe=""EquityAll"")","CH=IN;Fd Curn=USD TRANSPOSE:Y",H8)
Apart from that I tried also % change but couldn't get it working and received HTTPError: 400 Bad Request again

ek.get_data('PZU.WA', ['PERCENT_CHG(TR.PriceClose, lag=-12D)']) 

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.