20 years of total returns

Hi, i need to get 20 year of montly total returns from a little over 5000 Sedols. Right now i'm using this method with the Python API:

aux, err = ek.get_data(list, ['TR.TotalReturn.Date','TR.TotalReturn'], parameters={"Frq": "M",'SDate':'1998-12-31', 'EDate':'2018-12-31'})

but i keep getting this error message:

"headers = [header['displayName'] for header in data_dict['headers'][0]]"

I tried partitioning the the quering on batches of 200, 100 and 50 Sedols, but i still get the same error. Retrying would get more or less iterations randomly (ie, with 100 on my first try i got the first 500 and on the second over a 2000).

Any thoughts?

Best Answer

  • m.bunkowski
    Answer ✓

    Hi @pchauveau

    I have tried with the code below and got the outputs

    instruments, e = ek.get_data('0#.GDAXI', ['Instrument']) 
    instruments=instruments['Instrument'].tolist()
    for ric in instruments:
    tmp_df = ek.get_data(ric, ['TR.TotalReturn.Date','TR.TotalReturn'], parameters={"Frq": "M",'SDate':'1998-12-31', 'EDate':'2018-12-31'})[0]
    df = tmp_df.append(df)
    df

Answers