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 1 2 5

Retreive historical data for daily price change percent

Hello,

I tried to retrieve historical data for price change percent and price daily. The price part is ok but just last price change percent shows up.

Code:

1626283410320.png

Result:

1626283453274.png

Thanks in advance,

eikoneikon-data-apirefinitiv-dataplatform-eikonworkspaceworkspace-data-api
1626283410320.png (11.6 KiB)
1626283453274.png (44.5 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.

Upvote
Accepted
39.4k 77 11 27

@Fatemeh

The field TR.PricePctChg1D is not available as timeseries. In other words, it only returns the latest value and does not provide any history. See the answer on this thread for explanation how to check whether a field as available as timeseries or not.

Fortunately it's very easy to calculate percent change from the price history using pandas:

df, err = ek.get_data('.SPX',['TR.PriceCloseDate','TR.PriceClose'],
                     {'SDate':'2019-01-01','EDate':'2019-12-31'})
df['Percent Chg'] = df['Price Close']/df['Price Close'].shift(1) -1
df
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.

Thanks a lot.
Upvotes
10.1k 18 6 9

@Fatemeh you are requesting a daily percentage change with a monthly frequency - please try replacing the field with TR.PricePctChg1M

I hope this can help

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.

Thanks for your time.

It doesn't work. The reason is: "The field TR.PricePctChg1D is not available as timeseries."

you can try CLOSE instead of TR.PricePctChg1D

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.