I am wondering what the most elegant way to retrieve a full surface through the Python API is. For example LCOSURF3 contains a lot of RICs like LCO100N1MO=R for which historic as well as live values can be retrieved. Is there another way except pulling the data RIC by RIC?
I can not see any elegant ways to achieve this, moreover, the api does not consider a chain of instruments without 0# as a series, so you will have to extract RICs first with something like this:
import pandas as pd import eikon as tr tr.set_app_id('your_app_id') fields = ['LONGLINK' + str(i) for i in range(1, 14)] + ['LONGNEXTLR'] def expand_chain(ric, fields, data): df, e = tr.get_data([ric], fields) data = data + list(df.iloc)[1:-1] nextlr = df['LONGNEXTLR'] if (pd.isnull(nextlr)): return data else: return expand_chain(nextlr, fields, data) rics = expand_chain('LCOSURF3', fields, )[1:-1]
after this you can get the time series for each RIC.