Python Eikon API - Insufficient Data

Hello,


I also see this issue when inside the codebook.

WARNING:pyeikon:Error with FXDKWEUR17=NPX: Insufficient data
ERROR:pyeikon:FXDKWEUR17=NPX: Insufficient data |


The weird thing is that there is actually no error, i can see the data inside the date frame. Any idea why it is coming up?

Tagged:

Best Answer

  • zoya faberov
    Answer ✓

    Hello @Moody ,

    I have run your code several times, in CodeBook, I have reproduced the issue twice, for different instruments.

    I suspect that the issue is not a specific content issue, as was identified and discussed in the previous discussion thread, but with the tight loop hitting 5 requests per second limit, from time to time, please see Eikon Data API Usage and Limits Guideline for the complete details.

    I have introduced a brief pause after every 4 requests:

    import datetime as dt
    import pytz
    import time

    npast = 20
    sdate = (pd.datetime.now()+pd.DateOffset(days=-npast, normalize=True)).strftime("%Y-%m-%d")

    allHist = pd.DataFrame()

    ricbase = "FXDKWEUR"
    ricend = "=NPX"

    for i in range(1,25):
    ric = ricbase + str(i).zfill(2) + ricend
    print(ric)
    try:
    data = ek.get_timeseries([ric], start_date= sdate, fields="CLOSE").reset_index()
    except:
    print(f"failed for {ric}")
    hour = i-1 #str(i -1)
    dataF = data.rename({"CLOSE": hour}, axis=1)
    dataF_m = dataF.melt(id_vars = ["Date"], var_name = "hour")
    allHist = pd.concat([allHist, dataF_m])
    if (i % 4) == 0:
    print('Sleep 2')
    time.sleep(2)

    On my side, I have tested a couple of times and I am not hitting the issue anymore.

    noissue.gif

    Please test- let us know how this works for you?

Answers

  • Hello @Moody ,

    Thank you.

    To verify, inside CodeBook I run:

    ek.get_timeseries(['FXDKWEUR17=NPX'], start_date = '2020-04-24', end_date = '2020-09-11')

    My result was:

    res-20220509.gif

    I was not able to reproduce this way -

    Is this the exact same request that you run inside CodeBook? Is the error consistent on your side?


    Next, with regard to this related discussion thread, as recommended by @pierre.faurel, if the same issue is reproducible in Eikon Excel, it will need to be approached and addressed, as content issue.

  • hello,

    please try this script:


    import refinitiv.data as rd

    rd.open_session()

    rd.get_history(universe=["FXSE4EUR16=NPX"],

    fields="TRDPRC_1",

    interval="1D",

    start="2021-05-12", end="2022-05-01")


  • import datetime as dt
    import pytz


    npast = 20
    sdate = (pd.datetime.now()+pd.DateOffset(days=-npast, normalize=True)).strftime("%Y-%m-%d")


    allHist = pd.DataFrame()

    ricbase = "FXDKWEUR"
    ricend = "=NPX"

    for i in range(1,25):
    ric = ricbase + str(i).zfill(2) + ricend
    print(ric)
    try:
    data = ek.get_timeseries([ric], start_date= sdate, fields="CLOSE").reset_index()
    except:
    print(f"failed for {ric}")
    hour = i-1 #str(i -1)
    dataF = data.rename({"CLOSE": hour}, axis=1)
    dataF_m = dataF.melt(id_vars = ["Date"], var_name = "hour")
    allHist = pd.concat([allHist, dataF_m])

    hello,


    could you please test this script inside your codebook. You will see an error run here:

    WARNING:pyeikon:Error with FXDKWEUR17=NPX: Insufficient data
    ERROR:pyeikon:FXDKWEUR17=NPX: Insufficient data |


    However the data is in the dateframe.


  • thank you - that works !