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
3 0 0 1

PERCENT_CHG function not working

I'm using the Percent_chg function in TR excel formula. It's working fine in excel, but it's not available in python. How can I solve this? Is there a workaround for this?

df, err = ek.get_data("AAL.V",
['TR.PriceClose.date','TR.PriceClose','TR.COMPANYSHARESOUTSTANDING','TR.COMPANYMARKETCAP','TR.TOTALRETURN1D','PERCENT_CHG(TR.PriceClose,lag=-1D)'
],{'Sdate':'2020-01-01','Edate':'2020-05-01','FRQ':'D','CURN':'USD','SORTA':'TR.PriceClose.date'})
df

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-api
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.

Hello @Patricia.Pascual

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If yes, please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

AHS

Upvote
Accepted
39.4k 77 11 27

@Patricia.Pascual, @chavalit.jintamalit
PERCENT_CHG and other functions found under Parameters & Quick Functions in Formula Builder wizard in Eikon Excel can indeed be used with Eikon Data APIs.
@Patricia.Pascual, I'm not sure what you mean when you say it's not available in Python. The exact expression you put on this thread works for me and returns the same data as the equivalent expression in Eikon Excel. What does it return for you?
P.S. Make sure you use the latest version of EDAPI for Python library.

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.

Upvote
18.2k 21 13 21

Hi @Patricia.Pascual

The excel build-in function is not available on API.

You can calculate the change in your program from the PriceClose field.


ahs.png (73.2 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.

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.