Time series of data

When I run below it truncates data returned to last 6/7 months only despite my request going back a couple of years. Why does it do this?

df = ek.get_timeseries(['EURCBS3M=ICAP', 'EURCBS6M=ICAP','EURCBS9M=ICAP','EURCBS1Y=ICAP','EURCBS18M=ICAP','EURCBS2Y=ICAP'],
start_date="2016-08-01",
end_date="2020-09-11")

Best Answer

  • @paul67 The reason it is doing this is because of API limits. You can find out more information about API limits here. In the case of get_timeseries the limit is 3000 rows for interday. Hence why your return is being truncated. You can call the service iteratively per RIC or chunk of RICs that conform to the limits. The other thing with your query is that you didn't specify a field so you could get Open, High, Low, Close, Volume by default - if you only want Close - just specify that field.

    Try this:

    start='2016-08-01'
    end='2020-09-11'
    ts = pd.DataFrame()
    df = pd.DataFrame()
    instruments = ['EURCBS3M=ICAP', 'EURCBS6M=ICAP','EURCBS9M=ICAP','EURCBS1Y=ICAP','EURCBS18M=ICAP','EURCBS2Y=ICAP']
    for r in instruments:
        try:
            ts = ek.get_timeseries(r,'CLOSE',start_date=start,end_date=end,interval='daily')
            ts.rename(columns = {'CLOSE': r}, inplace = True)
            if len(ts):
                df = pd.concat([df, ts], axis=1)
            else:
                df = ts
        except:
            pass
        
    df
    image

    I hope this can help.

Answers