API does not return the latest data, seems to be an issue with the API as it does give the correc...

...t and recent data in excel

CBOT_BO_c2 = ek.get_timeseries('/BOc2',start_date=dt.datetime(2018,8,10))

gives me only data untill 16th of Aug, was expecting untill today including the 17th.

This holds for all RICs that I am working with.

Best Answer

  • eddy_de_groot
    eddy_de_groot Explorer
    Answer ✓

    I didnt get an error, I just got too less data.

    I have restarted the python session and now it does give me the correct data.

    The jupyter notebook, where I was working in was open for several days already. I did reset the eikon object and set the API key again, but it did not work. So somehow the end date perceived by the API is not the actual day today, but set somewhere when you start a python session?

Answers

  • Could you please provide with the screenshot or the log of your output?

  • In the meanwhile, maybe you want to set the end date in your code:

    end = datetime.datetime.today().strftime('%Y-%m-%d')

  • We found the root cause. It's related to the default arguments evaluation by Python.

    While plain values are hard-coded, thus needing no evaluation except that made at compilation time, function calls are expected to be executed at run time.
    If we write this:

    import datetime as dt
    deflog_time(message, time=dt.datetime.now()):
    print("{0}: {1}".format(time.isoformat(), message))

    We expect the log_time() function to correctly provide the current time each time we call it. This unfortunately does not work: default arguments are evaluated at definition time (for example when you first import the module), and the result of successive calls is :

    >>> log_time("message 1")<br>2015-02-10T21:20:32.998647: message 1<br>>>> log_time("message 2")<br>2015-02-10T21:20:32.998647: message 2<br>>>> log_time("message 3")<br>2015-02-10T21:20:32.998647: message 3

    This issue will be fixed in the next version.
    In the meanwhile, Joris.Hoendervangers's suggestion is totally appropriate : you can force end_date to dt.datetime.today().strftime('%Y-%m-%d')