The python query I'm using to retrieve data is as below. The error message I got is no data for TICK_SZIDX from API.
# The Column name in Data containing the RIC !!!
Ric_Column = "RIC"
# Give the set of FIDs you want to Extract: If you want only PE, you can leave it BLANK as well !!!
FIDs_to_extract = ['TICK_SZIDX']
#Enter your own Eikon Key as generated from Eikon APPKEY Generator
Eikon_Key = '— App Key —'
ek.set_app_key(Eikon_Key)
def call_EIKON_API(data="MyData", col_name="My_Column", Fields_to_extract=['PROD_PERM'], Session_Batch_Size=90000,
Batch_Size=7500):
RIC_All_Vec = data[str(col_name)]
NoOfRICs = len(RIC_All_Vec)
Final_Table = pd.DataFrame()
# Session_Batch_Size = 90000
NoOfSessions = math.ceil(NoOfRICs / Session_Batch_Size)
# Batch_Size = 7500 # Eikon API has a limit of 7500 records !!!!
for j in range(NoOfSessions):
print("SESSION: " + str(j + 1) + " Of " + str(NoOfSessions))
Session_Indexes = range(Session_Batch_Size * j, min(Session_Batch_Size * (j + 1), NoOfRICs))
RIC_Vec = RIC_All_Vec[(Session_Indexes[0]):(Session_Indexes[len(Session_Indexes) - 1] + 1)]
NoOfRecords = len(RIC_Vec)
NoOfIterations = math.ceil(NoOfRecords / Batch_Size)
MyTable = pd.DataFrame()
RIC_Vec = RIC_Vec.tolist()
# Iteration through different RICs:
for i in range(NoOfIterations):
for attempt in range(10):
try:
Indexes = range(Batch_Size * i, min(Batch_Size * (i + 1), NoOfRecords))
print("Iterations: " + str(i + 1) + " Of " + str(NoOfIterations))
# Concatenate all RICs in a String!!
Concat_String = ["'" + str(s) + "'" for s in RIC_Vec[(Indexes[0]):(Indexes[len(Indexes) - 1] + 1)]]
Concat_String = ",".join(Concat_String)
# Run the API calls to Extract Data:
df, err = ek.get_data([Concat_String], Fields_to_extract)
# do thing
except:
# Defining what happens when there is an Error!!
print("Attempt- " + str(attempt + 1) + " Failed!!........ Retrying!!")
# print(attempt + 1)
# Reconnect
else:
# Defining what happens NO ERROR!! Meaning the Block ran successfully !!
# Concatenate within the Session!!
MyTable = pd.concat([MyTable, df])
break
else:
break
# Failed all the attempts
time.sleep(10) # Give a time lag of 10 seconds between sessions
# Concatenate data from different Sessions!!
Final_Table = pd.concat([Final_Table, MyTable])
return Final_Table
Eikon_Data_EU = call_EIKON_API(data = Data_EU,
col_name = Ric_Column,
Fields_to_extract = FIDs_to_extract,
Session_Batch_Size = 90000,
Batch_Size = 5000)