How to handle error after transition from Eikon to Workspace

Hi,
I'm pulling data from API on thousands of RIC daily. I may have RIC's that's no longer valid, or with typo.
Under Eikon, my Python code below will return DataFrame containing information with NA for invalid RIC ('BF.B' and 'BONDS') if I simply ignore df_error, when the list RIC are all invalid.
import refinitiv.dataplatform.eikon as ek ek.set_app_key(app_key='APP_KEY') df_eikon, df_error = ek.get_data(
['BONDS', 'BF.B', 'IGUSDD10Y='],
['TR.BIDPRICE.date', 'TR.BIDPRICE', 'CF_DATE', 'TR.CLOSEPRICE', 'CF_LAST'],
{'SDate': 0, 'FRQ': 'D'})
print(df_eikon)
The result is below, which is what I am expecting:
But under Workspace, the rd.get_data won't allow for two DataFrames to house result and error separately any more, and I can only do below to get an error message:
import lseg.data as rd rd.open_session(app_key='APP_KEY') df_workspace = rd.get_data(
['BONDS', 'BF.B'],
['TR.BIDPRICE.date', 'TR.BIDPRICE', 'CF_DATE', 'TR.CLOSEPRICE', 'CF_LAST'],
{'SDate': 0, 'FRQ': 'D'})
print(df_workspace)
I will get below error:
The Workspace code above works fine when I have a mix of valid and invalid RIC, but will not work when all RIC are invalid. I cannot verify the validity of RIC one by one for thousands of RIC. How can I resolve this to avoid getting an error like Eikon? Thank you.
Best Answers
-
Thank you for reaching out to us.
The library will raise the LDError instead of returning the error. Therefore, the code needs to be able to handle the LDError, as shown below.
from lseg.data.errors import LDError try: df_workspace = ld.get_data( ['BONDS', 'BF.B'], ['TR.BIDPRICE.date', 'TR.BIDPRICE', 'CF_DATE', 'TR.CLOSEPRICE', 'CF_LAST'], {'SDate': 0, 'FRQ': 'D'}) print(df_workspace) except LDError as e: print("LDError code :", e.code) print("LDError message:", e.message)
0 -
The output looks like this:
0
Answers
-
Thanks for clarifying. Can you please further confirm that when there's valid and invalid RIC mix to feed into ger_data function, there will not be LDError? My concern is if I do this error handle, valid RIC will be skipped for data downloading.
0 -
Thank you for clarifying.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 249 ETA
- 554 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 643 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 192 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛