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
27 3 2 2

get_data not working for historical data for RIC = 'ECBDF=ECBF'

Can someone please help me in fixing the code below to get historical data for RIC = 'ECBDF=ECBF'

df1, err = ek.get_data(instruments = ['ECBDF=ECBF'], fields = ['VALUE_DT1','PRIMACT_1'], parameters = {'SDate':'2022-01-01', 'EDate': str(datetime.date.today())[:10], 'FRQ': 'D'})


I also tried get_timeseries, as shown below, without success.

df1, err = ek.get_timeseries(['ECBDF=ECBF'], ['VALUE_DT1','PRIMACT_1'], start_date = "2022-01-01", end_date = "2022-05-04", interval = "daily" )

I would be happy if either get_data or get_timeseries works.

Thanks.

eikoneikon-data-apipython
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 @maria.vieira

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


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

Thanks,


AHS

1 Answer

· Write an Answer
Upvotes
Accepted
78.8k 249 52 74

@maria.vieira

The 'VALUE_DT1' and 'PRIMACT_1' fields are in the Real-Time category so they don't support historical data. You need to use other fields, such as TR.ClosePrice.

df1, err = ek.get_data(instruments = ['ECBDF=ECBF'], 
                       fields = ['TR.ClosePrice','TR.ClosePrice.Date'], 
                       parameters = {'SDate':'2022-01-01', 'EDate': str(datetime.date.today())[:10], 'FRQ': 'D'})

The output is:

1651724523918.png

The get_timeseries method only supports the following fields ('TIMESTAMP', 'VALUE', 'VOLUME', 'HIGH', 'LOW', 'OPEN', 'CLOSE', 'COUNT'). Therefore, you can use the following code to get the daily close prices.

df2 = ek.get_timeseries(['ECBDF=ECBF'], start_date = "2022-01-01", end_date = "2022-05-04", interval = "daily" )

The output is:

1651724655193.png



1651724523918.png (20.7 KiB)
1651724655193.png (8.0 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.

Thank you!

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.