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