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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvote
Accepted
11.3k 25 8 13

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-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

Upvote
Accepted
629 2 4 7

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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea