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?
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 RICsdata_set = Nonecount = 0error_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.