Hi,
I've been having this problem since Monday with the different codes and it used to work properly (Backend error. 400 Bad Request, HTTP request failed: EikonError-Backend error. 400 Bad Request). Is there a problem with the server connection?
Here is an example:
def descargar_info(rics,fecha_inicio,fecha_final, fields_papel, decision, historico,ric_por_llamado, nombre_archivo):
#decision=1 descargar informacion
#decision <> 1 tomar archivo ya descargado
#historico = 0, datos a 1 fecha especifica
#historico <> 0 datos historicos periodicidad diaria
if decision==1:
array_ric_list = []
ric_per_call = ric_por_llamado
h = 0
while h < len(rics)/ric_per_call:
array_ric_list.append(rics[h*ric_per_call:(h+1)*ric_per_call])
h += 1
parametros = pd.DataFrame()
h = 1
for riccodes in array_ric_list:
start_time2 = datetime.now()
print("grupo "+ str(h)+ '/'+str(len(array_ric_list)))
if historico == 0:
ts1,e1 = ek.get_data(riccodes, fields_papel,{'SDate':fecha_final,'EDate':fecha_final,'Frq':'D'})
else:
ts1,e1 = ek.get_data(riccodes,fields_papel,{'SDate':fecha_inicio,'EDate':fecha_final,'Frq':'D','NULL' : 'prev'})
parametros = pd.concat([parametros,ts1], axis=0)
time.sleep(5) #delay between each API call
end_time = datetime.now()
print('Duration: {}'.format(end_time - start_time2))
h = h+1
parametros.reset_index(drop=True, inplace=True)
parametros.to_csv(nombre_archivo, index=False)
else:
parametros = pd.read_csv(nombre_archivo)
return parametros
fields_papel = ["TR.MODIFIEDDURATION","TR.FiFitchsRating",
"TR.FiMoodysRating", "TR.RiskCountryCode",
"TR.FiMaturityDate", "TR.TRBCEconomicSector", "TR.CommonName"]
parametros=descargar_info(rics,today,today, fields_papel, descargar, 0,15, "parametros.csv")