Suppress warning for no data available for requested period (python API)

When pulling time series with multiple RICs, often there may not be data for some periods requested. Eikon raises the warning:

Error with 'RIC NAME': No data available for the requested date range

For some requests, I'm comfortable with there being no data available and I would like to suppress the warning (albeit possibly not best practice). Is there a way please?

Best Answer

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭
    Answer ✓

    @gthompson6

    To suppress these warnings you can set the logging level for Eikon Data APIs library logger to CRITICAL:

    import logging 
    logger = logging.getLogger('pyeikon')
    logger.setLevel(logging.CRITICAL)

Answers

  • Hi @gthompson6

    You can put the API call in a try block.

    image

  • gthompson6
    gthompson6 Newcomer

    Thanks @chavalit.jintamalit for your suggestion. It's not so much suppressing the error, more the warning marked in red. While the code still executes, as you can imagine with many rics and multiple API calls, a Juypter notebook becomes a sea of red! Thanks

  • gthompson6
    gthompson6 Newcomer

    Thanks Alex!