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

Upvote
Accepted
11.3k 25 9 14

NaN received for PCTCHG_YTD field

I'm trying to use Eikon Data APIs to retrieve the same data as the following Eikon Excel formula.

=TR(".SPX","PCTCHG_YTD")

The get_data() function returns NaN, while Eikon Excel returns value; for example "15.169".

>>> ek.get_data(".SPX","PCTCHG_YTD")
(  Instrument  PCTCHG_YTD
0       .SPX         NaN, [{'code': 251658244, 'col': 1, 'message': "Error: Field 'PCTCHG_YTD' was not found in response for the instrument '.SPX'", 'row': 0}])

Could you please advise?

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.

1 Answer

· Write an Answer
Upvote
Accepted
644 4 7 8

PCTCHG_YTD is a real-time field which is not yet supported in Eikon DAPI. The field you would want to use is TR.PricePctChgYTD


ytd.png (112.3 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.