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

EikonError: Error code -1

When trying to get monthly close data on a list of rics (600 stocks) by running the following,

I get the following error,

Can anyone help me addressing this error code -1?

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-api
1584100180700.png (24.5 KiB)
1584100256195.png (27.2 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.

Hello @oscar.moegelmose

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.

Thanks,


AHS


Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS


1 Answer

· Write an Answer
Upvote
Accepted
18.2k 21 13 21

Hi @oscar.moegelmose

You can use try / except block.


Here is the modified code:

df,e = ek.get_data('0#.FTAS','TR.RIC')
rics = df['Instrument'].tolist()
# stock_name = 621 RICs

data_set = None
count = 0
error_ric = []
for stock_name in rics:
    count+=1
    try:
        stock_data = ek.get_timeseries(stock_name,start_date='2000-01-01',end_date='2020-01-01',
                                       fields='*',interval='monthly',corax='adjusted')
        stock_data.columns = pd.MultiIndex.from_product([[stock_name], stock_data.columns])
        time.sleep(1.3)
        if data_set is None:
            data_set = stock_data
        else:
            data_set = pd.concat([data_set,stock_data], axis=1)
        print(count,'/',len(rics),' ', stock_name, ' = ', len(stock_data))
    except ek.EikonError as err:
        print(count,'/',len(rics),' ', stock_name, ' = ERROR')
        error_ric.append(stock_name)

And here is the error handling.


ahs.png (83.5 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.

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.