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

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

  • 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?

  • we'll check on that, thanks for letting me know

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

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

  • I can't request '/BOc2' item because I don't have permission, but that could be related to the instrument '/BOc2'.
    '/' means the item is requested in delayed mode, so the last data could be ignored.

    I requested 'BOc2' and I retrieved all data, including the actual day:

    >>> ek.get_timeseries('BOc2',start_date=dt.datetime(2018,8,10))
    BOc2 HIGH LOW OPEN CLOSE VOLUME COUNT
    Date
    2018-08-10 28.67 28.00 28.53 28.10 20233.0 -1.0
    2018-08-13 28.40 27.80 28.13 28.36 17984.0 -1.0
    2018-08-14 28.32 28.06 28.30 28.28 17424.0 -1.0
    2018-08-15 28.42 27.86 28.41 28.00 15131.0 -1.0
    2018-08-16 28.36 27.92 28.00 28.28 5205.0 -1.0
    2018-08-17 28.53 28.18 28.33 28.36 3316.0 -1.0
    2018-08-20 28.70 28.53 28.59 28.63 1404.0 177.0
  • 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')