get_timeseries function returns with date range loss

Hi there,

I am encountering a problem with <get_timeseries> function when retrieving historical commodity price with Eikon API. pls refer to details below.

If I pass one certain RIC to the rics parameter, like 'SF^1' in screenshot scenario 1, everything works well that historical data is returned from the the first trading day (2015-11-13) to last trading day (2018-01-12) in this example. PS: start_date parameter is set large enough to include the whole date rage.

But if I pass a list of RICs to the rics parameter, like ['SF^1', 'SH8^1', 'SK8^1....'SX8^1'] in screenshot scenario 2, the returned historical data starts from 2016-05-04, which means historical data before this date for some RIC is lost.

Thanks!


scenario 1:

1.png


scenario 2:

2.png

Tagged:

Best Answer

  • raksina.samasiri
    Answer ✓

    hi @gtaxinstitute ,

    There's a limit on data returned from the get_timeseries function, for more detail, please check Eikon Data API Usage and Limits Guideline

    However, to get all of the data available for each RIC, you may call the function on each instrument and then merge them together using Python, for example

    # create a list of RICs
    rics_list = ['SF8^1', 'SH8^1', 'SK8^1', 'SQ8^1', 'SU8^1', 'SX8^1']

    # create Python dictionary to store all output dataframes
    dfs = {}
    i = 0

    # call get_timeseries on each RIC
    for _ in rics_list:
    dfs[i] = ek.get_timeseries(_, 'CLOSE', start_date='2010-01-01')
    i += 1

    # merge the dataframes together and rename the column name to be each RIC instead of CLOSE
    for j in dfs:
    if j == 0:
    df = dfs[j]
    else:
    df = df.merge(dfs[j], how='outer', on='Date
    df.rename(columns = {'CLOSE':dfs[j].columns.name}, inplace = True)
    display(df)

    and here's the output 1657527027528.png

    Hope this helps and please let me know in case you have any further questions

Answers