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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 1

The instrument issue when I fetch historical PE ratio of SPX constituents

I use the following statement to fetch historical PE ratios of SPX constituents.

rcc, err=ek.get_data("0#.SPX(2002-08-09)",fields=["TR.RIC","TR.InstrumentDescription", "TR.RIC.date"])
instruments=rcc['RIC'].tolist()
df,err=ek.get_data(instruments, ['TR.PE', ‘TR.PE.date'], {"SDate": "2002-08-09", "EDate":"2002-08-09"})

Below is the message from Spyder.

 File "C:\Users\xxx\Anaconda3\lib\site-packages\eikon\data_grid.py", line 189, in get_data
    result = eikon.json_requests.send_json_request(_endpoint, payload, debug=debug)

  File "C:\Users\xxx\Anaconda3\lib\site-packages\eikon\json_requests.py", line 127, in send_json_request
    _check_server_error(result)

  File "C:\Users\xxx\Anaconda3\lib\site-packages\eikon\json_requests.py", line 203, in _check_server_error
    raise EikonError(int(server_response['ErrorCode']), error_message)

EikonError: Error code 1422 | Can not process metadata for request: DataGrid_StandardAsync.requests.instruments - non-empty is required

(1) I manually create a subset of the "instruments" and run the get_data statement. And it works fine. But when I include the instrument with the 500 RICs, it reports errors.

(2) Some tickers do not return PE ratio, such as TNB.N^E12. Do you have any other alternative get PE ratio for this RIC?

Can you advise? Thank you.

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonindex
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

Upvotes
Accepted
18k 21 12 20

Hi @ylian

1. The instruments variable contains empty value. So it causes the error.

2. Please contact the Refinitiv Content Helpdesk at https://my.refinitiv.com/ to get help on the field you are interested in.

Or you can use Data Item Browser to explore what field may fit with your requirement.

Data Item Browser tutorial is here.


ahs.jpg (35.2 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.

Hi @chavalit.jintamalit Thank you for your response. That is a typo when I manually typed it in the thread.The quote in my original code is correct. Please advise me how to solve this issue. I try the same code on DJI index, it works. But when try to fetch the data from SPX, it reports error message.


The data item browser I used is from the formula builder in Eikon excel plugin. The TR.PE works for most of the RICs except some of them, I show you one of the RIC I found that have missing PE value, TNB.N^E12. Please advise me this is a glitch of your database or not.

Yili

Hi @ylian

For error in function call, it is because you pass in empty string.

Please try to code I show you so you understand that the instrument list contains an empty string.


For the TR.PE content clarification, please contact Refinitiv Content Helpdesk.

ahs.jpg (307.1 KiB)
ylian avatar image ylian chavalit-jintamalit

Hi @chavalit.jintamalit Thank you for your help. For the empty string, can you recommend a solution so that I can fetch the data for those non-empty RICs and finish my project. Yili

Show more comments
Click below to post an Idea Post Idea