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.

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @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


Answers