Why date dont match with my query?
Yahoo finance has the data from 1998.
For a deeper look into our Eikon Data API, look into:
Overview | Quickstart | Documentation | Downloads | Tutorials | Articles
Why date dont match with my query?
Yahoo finance has the data from 1998.
@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.
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.