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
Best Answer
-
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 dfthis 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
Hope this helps and please let me know in case you have any further questions
0
Answers
-
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
Hope this helps
0 -
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
0 -
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
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛