Client is facing the issue while running these code

Options

I am always encountering a timeout error when running this code:

# Define the start and end dates (go two years by two years)

start_date = '2025-01-01'

end_date = '2025-06-30'

# Generate a list of dates between the start and end dates

date_range = pd.date_range(start=start_date, end=end_date)

# Convert to a list of strings if needed

date_list_as_strings = [date.strftime('%Y-%m-%d') for date in date_range]

df_tot = []

for t in date_list_as_strings:

try:

response = search.Definition(

view = search.Views.GOV_CORP_INSTRUMENTS,

top = 10000,

#filter = "((DbType eq 'CORP') and RCSAssetCategory eq 'A:J' and ((IssueDate ge 2020-02-16 and IssueDate le "+t+")))",

filter = "((DbType eq 'CORP') and RCSAssetCategory eq 'A:J' and ((IssueDate ge "+t+" and IssueDate le "+t+")))",

navigators = "IssueDate(calc:sum_FaceIssuedUSD,calc:sum_FaceOutstandingUSD,calc:sum_FaceIssuedTotal,type:histogram,buckets:100)",

select = "IssuerOrgid,RIC,EJVAssetID,DTSubjectName,BusinessEntity,PI,FaceIssuedUSD,"\

"FaceOutstandingUSD,IssueDate,CouponRate,MaturityDate,ISIN,RCSDomicileLeaf,RCSCountryOfIncorporationLeaf,DBSTicker,RCSDomicileGenealogy"\

"IsESGBond,KPITypeDescription,IsGreenBond,MaturityStandardYield,InstrumentTypeDescription,IssuePrice,FaceIssuedTotal,CouponFrequencyDescription,RCSCurrencyLeaf"\

"RCSBondGradeLeaf,RCSCoveredBondGenealogy,IsCallable,IsPutable,RCSUseOfProceedsLeaf,RCSCurrencyLeaf"

#RCSDomicileGenealogy

).get_data()

df=response.data.df

#print(df.shape[0])

if t == start_date:

df_tot = df

else:

df_tot = df_tot.append(df)

#if t[8:10]=='01':

# print(t)

print(t)

#response.data.raw["Navigators"]["RIC"]["Buckets"]

#except rd.EikonError as e:

# raise Exception(f'Eikon error {e.code}\n{e.args}\n{e.message}')

except rd.errors.RDError as e:

print("RDError code :", e.code)

print("RDError message:", e.message)

df_tot.shape[0]

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @Karanam_12

    Thank you for reaching out to us.

    It is about the HTTP timeout. You can increase the timeout value by running the following code before opening a session.

    rd.get_config()["http.request-timeout"] = 120
    rd.open_session()