I can't retrieve data any more via EIKON python API. For example time series data (prices) for .5...

I can't retrieve data any more via EIKON python API. For example time series data (prices) for .5SP20 leads into "Server returns error. Please try again" or "Insufficient data".

Best Answer

Answers

  • The following code can help you to reproduce the error messages

    import eikon as ek
    from datetime import date, datetime, timedelta
    import dateutil.relativedelta as dateutil
    from sqlalchemy import create_engine
    from sqlalchemy.sql import select
    import numpy
    import time

    ek.set_app_key('YourAppKey')
    retrials = 0;

    starting = datetime.now()

    print('Gestartet: ' + starting.strftime("%H:%M:%S"))

    # input Parameter ANFANG
    table_name = "dbName"
    table_mode = "replace"
    max_retries = 50
    rrg_index = [
        [".IXIC", ".5SP10", ".5SP15", ".5SP20", ".5SP25", ".5SP30", ".5SP35", ".5SP40", ".5SP45", ".5SP50", ".5SP55", ".5SP60"],
        [".SPX", ".5SP10", ".5SP15", ".5SP20", ".5SP25", ".5SP30", ".5SP35", ".5SP40", ".5SP45", ".5SP50", ".5SP55", ".5SP60"],
        [".E1DOW", ".E1TEC", ".E1IDU", ".E1NCY", ".E1FIN", ".E1TLS", ".E1UTI", ".E1HCR", ".E1ENE", ".E1CYC", ".E1BSC"]
        ]
    # input Parameter ENDE

    print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
    print('Tabelle:       ' + table_name)
    print('Modus:         ' + table_mode)
    print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++')

    try:
        retrials_1 = 0
        con = engine.connect()

        end = datetime.now() - timedelta(days=1)
        start = end - timedelta(weeks=40)

        start_string = start.strftime("%Y-%m-%d")
        end_string = end.strftime("%Y-%m-%d")

        print(start_string)
        print(end_string)

        for row in rrg_index:
            main_index = row[0]
            print(main_index)

            i = 0
            while (i < len(row)):
                aRIC = row[i]
                print("Load " + aRIC)
                time.sleep(2);
                try:
                    req = ek.get_timeseries(aRIC, start_date=start_string , end_date=end_string, interval='weekly', corax='adjusted')
                    print('Ergänzung um Datum und Index und speichern.')
                    # do some database work

                    table_mode = "append"
                    i = i + 1
                    retrials_1 = 0

                except Exception as anExc:
                    print('Exception:')
                    print(anExc)
                    print('### RIC ###')
                    print(aRIC)
                    if retrials_1 > max_retries:
                        i = i + 1
                        print("ACHTUNG:", aRIC)

                    retrials_1 = retrials_1 + 1
                    time.sleep(3);

            retrials = 0

    except Exception as anExc:
        print('Exception:')
        print(anExc)
                
    print('Beendet.')
  • Hi Sven adding my comment here if this may help on the issue. Upon further investigation. "Server returns error and Insufficient data" might be related to Eikon data limitation when retrieving time series data. For <.5SP20>, please note that for retrieving intraday data (like for end-of-day RICs) it is only limited to 3 months.

  • Hi Sven glad to know it is now working on your end. I have monitored the instrument as well but has not recorded any issue. Not just sure with the API server itself.