Hello,
I'm trying to create my own function with an Eikon request. The aim of the funciton is to return a dictionnary of DataFrame with tick data. At first the function worked, but suddenly an error strated to appear: " TypeError: get_timeseries() got multiple values for argument 'fields' ". I tried to rebuild it step by step, and it appears that when I use start and en date as function params it starts to bug, here is to code:
def df_request(ric_list, start_date, end_date):
# Datetime format
start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d')
end_date = datetime.datetime.strptime(end_date, '%Y-%m-%d')
# Dict
df_request = {}
# Eikon raw request
raw_request = ek.get_timeseries(
ric_list,
start_date,
end_date,
fields = ['BID','ASK','BIDSIZE','ASKSIZE'],
calendar = 'tradingdays',
interval = 'tas',
raw_output = 'true'
)
# Header
list_fields = []
# Loop to crate the header
for fld in raw_request['timeseriesData'][0]['fields']:
list_fields.append(fld['name'])
# Add key/value pairs
for i in range(len(raw_request['timeseriesData'])):
df_request.update({raw_request['timeseriesData'][i]['ric']:pd.DataFrame(raw_request['timeseriesData'][i]['dataPoints'], columns = list_fields)})
return df_request;
With the test here: data = df_request(['BNPP.PA','MSFT.O'],'2019-11-25','2019-11-28')
I repeat myself but this code used to work 2 days ago...
Thank you in advance for your help