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

Upvotes
Accepted
3 1 1 2

Error handling retrieving SERIES (Python)

I probably miss something very simple, but ...

I am retrieving historic financial data by calling .get_data("list_of_rics" , "list_of_Data_Item_Codes")

woks fine UNLESS there is an error in one (or more) of the Data_Item_Codes (a definition in this case)

In that case, no data is returned ... not just for the item with the false definition, but for ALL Codes and ALL RICS

Very short Example:

dfLocal, err = ek.get_data("VIE.PA" , "TR.FwdPE(SDate=0, EDate=-10, Period=NTM, Frq=FY), TR.TOTALDEBTTOEV(SDATE=0, EDATE=-10, FRQ=FY)", parameters=None, field_name=True)

works fine:

dfLocal

Instrument TR.FWDPE(SDATE=0, EDATE=-10, PERIOD=NTM, FRQ=FY) TR.TOTALDEBTTOEV(SDATE=0, EDATE=-10, FRQ=FY)
0 VIE.PA 20.39913 54.602213
1 VIE.PA 15.952721 82.312945
2 VIE.PA 17.118452 62.831281
3 VIE.PA 13.942937 64.641305
4 VIE.PA 17.498481 64.443232
5 VIE.PA 14.068652 66.671251
6 VIE.PA 21.074012 49.891322
7 VIE.PA 19.921223 67.977642
8 VIE.PA 22.737711 85.523073
9 VIE.PA 13.750912 89.49455
10 VIE.PA 10.386236 96.766925



but adding the non recognised Period=FY to TOTALDEBTTOEV not only returns an error for TOTALDEBTTOEV but gives no values for the still correctly defined FwdPE

ek.get_data("VIE.PA" , "TR.FwdPE(SDate=0, EDate=-10, Period=NTM, Frq=FY), TR.TOTALDEBTTOEV(SDATE=0, EDATE=-10, Period=FY, FRQ=FY)", parameters=None, field_name=True)


dfLocal

0 TR.FWDPE(SDATE=0, EDATE=-10, PERIOD=NTM, FRQ=FY), TR.TOTALDEBTTOEV(SDATE=0,Period=NTM, EDATE=-10, FRQ=FY)
0 VIE.PA <NA>

err

[{'code': 207, 'col': 1, 'message': "The 'Period' is unrecognized.", 'row': 0}]

Now, no doubt the codes should be correctly defined (in my DB), but ... how do I get stuff back for the codes that are and catch the errors?


cheers


Alfred

eikon-data-apierrortimeseriesrt-get
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.

hi @the.swiss ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,

AHS

Upvotes
Accepted
14.2k 30 5 10

Hi @the.swiss @the.swiss01 ,

Thank you for your patience, it can be handled by the Python code. For example,

def get_data_check_err(instrument, field):
    df, err = ek.get_data(instrument, field)
    if err is None:
        display(df)
    else:
        raise Exception(err)
    return df

this will return the dataframe as there's no error

df1 = get_data_check_err("VIE.PA", "TR.FwdPE(SDate=0, EDate=-10, Period=NTM, Frq=FY), TR.TOTALDEBTTOEV(SDATE=0, EDATE=-10, FRQ=FY)")

this will return an exception as there's an error returned

df2 = get_data_check_err("VIE.PA" , "TR.FwdPE(SDate=0, EDate=-10, Period=NTM, Frq=FY), TR.TOTALDEBTTOEV(SDATE=0, EDATE=-10, Period=FY, FRQ=FY)")

Below is the output of these codes

1654088376930.png

Hope this helps and please let me know in case you have any further questions


1654088376930.png (69.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.

Thanks that helps and I guess does answer the question implicitly : there is no way to receive the values for correct codes if only one of the codes is incorrect.

Too bad, but I guess one has to make sure they are correct to begin with.

Al

Upvotes
14.2k 30 5 10

hi @the.swiss01 ,

The different parameters are available in the different data item. You can check in Data Item Browser app (DIB) in Eikon/Workspace application. Put instrument > data item name > click on Parameters tab to see available parameters of each field.

You may check this video that demonstrate how to use Data Item Browser

1653330239908.png

1653330298234.png

Hope this helps


1653330239908.png (59.7 KiB)
1653330298234.png (53.1 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.

Upvotes
3 0 1 4

Thanks

I know that, DIB is what I use and, besides the point here, it isn't too user friendly.

DIB doesn't answer the question I have. Despite checking, there will be errors/typos ... whatever in data definitions.

Why does one error in one code of a list of codes make all other data returned NIL (as per my example)?

Is there an error handling process for that?

Best

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.