Hi all, I have a few python models that have ran into updating issues in the past three weeks or so. On some days the models update just fine, but on other days (like today) I keep getting either an 500 Internal Server Error or a Gateway Time-out error.
----------------------------------------------------------------------------------------------
Here is a quick example of the code I am using to pull in the data:
lookback_days = 240 # You can change this number
today = dt.datetime.today()
start_date = (today - dt.timedelta(days=lookback_days)).strftime('%Y-%m-%d')
end_date = (today - dt.timedelta(days=1)).strftime('%Y-%m-%d') # Adjusted to get yesterday's date
pairs_rics = ['AUDCAD=R' , 'AUDCHF=R' , 'AUDNZD=R' , 'AUDJPY=R' , 'AUD=' ,
'CADCHF=R' , 'CADJPY=R' ,
'NZDCAD=R' , 'NZDCHF=R' , 'NZDJPY=R' , 'NZD=' ,
'EURAUD=R' , 'EURCAD=R' , 'EURCHF=R' , 'EURJPY=R' , 'EURNZD=R' , 'EURGBP=R' , 'EUR=' ,
'GBPAUD=R' , 'GBPCAD=R' , 'GBPCHF=R' , 'GBPJPY=R' , 'GBPNZD=R' , 'GBP=' ,
'CHFJPY=R' ,
'CHF=' , 'JPY=' , 'CAD=',
'US2YT=RR', 'DE2YT=RR', 'GB2YT=RR', 'JP2YT=RR', 'AU2YT=RR', 'NZ2YT=RR', 'CA2YT=RR', 'CH2YT=RR',
'US10YT=RR', 'DE10YT=RR', 'GB10YT=RR', 'JP10YT=RR', 'AU10YT=RR', 'NZ10YT=RR', 'CA10YT=RR', 'CH10YT=RR']
final_data = pd.DataFrame()
for pair in pairs_rics:
data = ek.get_timeseries(pair,
fields=["CLOSE"],
start_date=start_date,
end_date=today, # use end_date instead of today
interval='daily')
----------------------------------------------------------------------------------------------
I was told that I needed to reduce the amount of RICs and the lookback period, but even after limiting it to one RIC and just 5 lookback days I still got the same error.
Is there any advice on how I can solve this?
Someone told me I should consider moving away from the ek.get_timeseries and rather using rd.get_history but am struggling to find the same output compared to the other.
Any advice would be appreciated.
Regards.