Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 0

get_timeseries() custom function error

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

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apiapi
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @kenan.jouglet

Thank you for your participation in the forum.

Is the reply below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

-AHS

Hello @kenan.jouglet

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

-AHS

1 Answer

· Write an Answer
Upvotes
Accepted
18.2k 21 13 21

Hi @kenan.jouglet

I made 2 sample df_request1 and df_request2

Hope this help !.


df_request1 same with your code:


df_request2, just fixed the API a little.


ahs1.png (71.2 KiB)
ahs2.png (77.2 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.