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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

maria.vieira avatar image
27 1 0 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
10 |1500

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

1 Answer

Jirapongse avatar image
45.2k 103 43 60

@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)
1 comment
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!