Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
26 4 3 4

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-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apitime-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 512.0 KiB each and 1.0 MiB total.

@pyquant

Hello,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query? If yes, please click the 'Accept' text next to the reply.

This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

AHS

Upvotes
Accepted
10.2k 18 6 9

@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 512.0 KiB each and 1.0 MiB total.

Upvotes
10.2k 18 6 9

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 512.0 KiB each and 1.0 MiB total.

Upvotes
26 4 3 4

Thanks. I will give it a try.

icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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