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.