Get historical data (chain) via eikon api (get_timeseries) problem

Im trying to get historical corn data, eg get the historical values for ric chain 0#C: but got an error:

get_timeseries(["0#C:"],start_date="2010-01-01",end_date="2011-01-01")

eikonError.EikonError: Error code Error | 0#C:: Invalid RIC

Best Answer

  • igorg
    Answer ✓

    you have to run chain request first. Then get_timeseries for received RICs

Answers

  • Hi @3352edee-c7b3-42de-95ff-77348a2fc138

    I am not an Eikon API specialist, but I don't believe the get_timeseries method takes a Chain RIC as a valid 1st parameter.

    As per the documentation the first parameter can be 'a string or a list of strings' i.e. Single RIC or List of RICs. Therefore, you would need to extract the RICs from the Chains into a string list before calling the method.

    There is a post here about getting the Chain Constituents using Eikon API - hope this helps.

    IF you are not familiar with Chains, then the intro section of this article may also help.

  • Tnx! And how does the chain request looks like?

  • dataFrame = ek.get_data(['0#C:'], ['RECORDTYPE'])
  • ok, but when i want to get historical data, eg for 2010-10-01 then i need to get the chain first for 2010-10-01 to be able to collect the values (eg settlement) for the items listed that day in the chain.

  • I don't know if it's possible

  • I don't believe you can get historical constituents of a commodity future chain. Depending on what your ultimate objective is, your options are to either construct expired future RICs based on RIC rules or to use continuous future RICs, e.g. Cc1 for the nearest contract, Cc2 for the second nearest etc.