Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Eikon Data APIs /
avatar image
Question by pyquant · Sep 23, 2020 at 02:37 PM · timeseries

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

start-date-eikon.png (120.3 KiB)

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

3 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by jason.ramchandani · Sep 23, 2020 at 03:17 PM

@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.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
REFINITIV
Answer by jason.ramchandani · Sep 23, 2020 at 03:05 PM

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)
Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
Answer by pyquant · Sep 23, 2020 at 03:27 PM

Thanks. I will give it a try.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
10 People are following this question.

Related Questions

Default price for bonds - Python API

Bid and offer prices through the Python API

Delisted warrant price data

Get Historical Prices from Bond ISIN

Historical Time Series API

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges