Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Eikon Data APIs /
avatar image
Question by oik22 · Aug 04, 2020 at 08:15 AM · erroreikonapi

Error handling for get_timeseries()

I am using a get_timeseries() function in a loop over a long list of stocks and get different errors depending on context (I am aware of the reasons for the errors):

- No data available for the requested data range.

- Client Error: Too many requests, please try again later

Is there a way to handle these errors differently? For example, I want skip the iteration that returns "no data available" and completely stop the loop execution if "too many requests" error shows, something like this

for ticker in ticker_list:         
        try:
            prices = ek.get_timeseries(ticker, interval = 'daily)         
        except NoDataAvailableError:
            continue
        except ClientError:
            break

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

3 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by chavalit.jintamalit · Aug 04, 2020 at 06:59 PM

Hi @oik22

Eikon Data API raises EikonError error.

This is the sample code to catch it: (I simulated 2 cases, too many ric and invalid ric)

Under the except ek.EikonError, you can handle it according to your requirement.

To either break or continue your loop.



ahs.png (44.5 KiB)
Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
REFINITIV
Answer by chavalit.jintamalit · Aug 04, 2020 at 08:47 AM

Hi @oik22

I think your handles make sense.

Maybe add a few delays between each loop too.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by oik22 · Aug 04, 2020 at 09:06 AM

Thanks @chavalit.jintamalit

I am actually looking for the specific handles or codes for the errors that Eikon API throws in these two cases: (1) "no data available for the data range" (2) "too many requests", so that I can distinguish between them. The exception handles "NoDataAvailableError" and "ClientError" are just some random names I came up with as an example for illustrative purposes. I do not know what the actual Eikon error handles are for these two cases. Like the different Python build-in exceptions such as ValueError or ZeroDivisionError, that's what I am looking for.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
9 People are following this question.

Related Questions

Query to retrieve average FX Rates

Dear all, is it possible to pull data with EIKON API also for DSWS for desktop or do you need two different queries to pull the data (one for EIKON API and one for DSWS for Desktop) ?

EIKON API content guide

Can I use the API key from a different Reuters account?

"Access Denied" for Nasdaq Rics even though permissioned on Eikon

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges