For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
26 1 1 3

Get time series, start dates don't match.

Why date dont match with my query?


Yahoo finance has the data from 1998.

https://finance.yahoo.com/quote/XLU/history?period1=914284800&period2=1600819200&interval=1d&filter=history&frequency=1d

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythontime-series
start-date-eikon.png (120.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
6.7k 8 6 7

@pyquant Here is the generic routine:

from dateutil import parser
from datetime import timedelta
from datetime import datetime
import math
import time
def date_range(start, end, intv):
    start = datetime.strptime(start,"%Y-%m-%d")
    end = datetime.strptime(end,"%Y-%m-%d")
    diff = (end  - start ) / intv
    for i in range(intv):
        yield (start + diff * i).strftime("%Y-%m-%d")
    yield end.strftime("%Y-%m-%d")
def get_daily(rics,fields,start,end):
    for ric in rics:        
        interval = math.ceil((parser.parse(end) - parser.parse(start)).days / 3000)
        l = list(date_range(start,end,interval))
        df1 = pd.DataFrame()
        df = pd.DataFrame()
        for i in range(interval):
            ts = ek.get_timeseries(rics=ric,fields=fields, start_date=l[0+i],end_date=l[1+i], interval='daily')
            df = df.append(ts)
            time.sleep(0.4)

    return df
rics = ['.GDAXI'] # Just for one ric at the moment I will extend this for multi-ric
fields = ['OPEN', 'HIGH', 'LOW', 'CLOSE']
start = '1990-06-04'
end = '2018-06-04'
df = get_daily(rics,fields,start,end)
df

I hope this can help.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
6.7k 8 6 7

Hi @pyquant Thanks for your question - the reason is because the timeseries API is limited to 3000 rows per interday request. You can see the limits for each in this document.

You can of course iterate these calls as you are already doing for each RIC. But you can also achieve this with 2 calls per RIC.

df1 = ek.get_timeseries(i, ['CLOSE'],start_date="1999-01-02", end_date="2008-10-22")
df2 = ek.get_timeseries(i, ['CLOSE'],start_date="2008-10-23")
df = pd.concat([df1, df2], axis=0)

I hope this can help - I have a generic routine for the date calcs somewhere I will add it when i find it.



1600873165273.png (80.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
26 1 1 3

Thanks. I will give it a try.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea