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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 1 1 1

Unable to retrieve stock prices before 2008 with get_time_series

I'm trying to build a database with the adjusted close prices for all the components of the Stoxx 600, from 2000 to 2020. But I only get data no earlier than 2008, even for those stocks that existed before that year (i.e. volkswagen). I'm using this code and getting the result below.

adjusted_prices = []
for stock in range(len(rics)):
    adjusted_prices.append(ek.get_timeseries(rics[stock], fields='CLOSE', start_date="2000-01-01", end_date="2020-12-30", interval="daily", corax="adjusted")
eikoneikon-data-apipythonworkspaceworkspace-data-apirefinitiv-dataplatform-eikondatatime-seriestrade
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.

Upvote
Accepted
18.1k 21 12 20

Hi @giosue.bruccoleri01

Please review API limitation guideline at https://developers.refinitiv.com/en/api-catalog/eikon/eikon-data-api/documentation

In your case, the API exceeds the maximum data point per API call.

You can reduce the time period and make them into multiple API calls, so the result would not exceed the maximum number of data point.

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
3 1 1 1

Hi, thank you for the help, but there is a problem with it, I downloaded the ric's list of the STOXX 600 components as of today to run this code, the problem is that if I set a range from 2000 to 2008 a lot of these stocks won't have data for the specified range, so python will return an error code -1. Is there a way to get a list of Rics for the period I want? Or maybe a way to create exceptions on python for this error so that ignore that stocks with no data?

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.

Upvote
18.1k 21 12 20

Hi @giosue.bruccoleri01

You can use try/except code block.


ahs.jpg (55.7 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.

I tried with this solution, but it stops until the first error, so I get only the first six stocks, do you know how to make the process skip the error and go on with the other stocks?

Hi @giosue.bruccoleri01

You can arrange your code to be like this:

Note that this is a pseudocode.

for ric in ric_list:
    try:
        df = ek.get_timeseries(ric, xxx, xxx)
        #if you code is here, you get the data successfully
        #process df according to your requirement
    except ek.EikonError as err:
        print(err)
        #if you code is here, you get some error
    #this is end of try/except block, back to for loop


Please also review Python For loop tutorial.