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?

Best Answer

  • James.Perkins
    Answer ✓

    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

    image