question

Upvotes
Accepted

Historical data for bid/ask price

Hi

I am trying to reload data for fixed income etc bonds in pycharm. Specifically, i would like to retrieve historical data for the bid and ask prices with daily or minute interval. I used the following code :

start_date = datetime.datetime(2023, 3, 1)
end_date = datetime.datetime(2023, 3, 10)


df, err = ek.get_data(
    instruments=['NL188254462='],
    fields=['ASK', 'ASK_YIELD', 'BID_YIELD', 'BID'],
     start_date= 'start_date',
     end_date= 'end_date',
     interval='daily')

however it does not work.


Either when i used this one :

start_date = datetime.datetime(2023, 3, 1)
end_date = datetime.datetime(2023, 3, 10)


df = ek.get_timeseries(['NL188254462='],
                  fields = [ 'ASK', 'BID', 'ASK_YIELD', 'BID_YIELD'],
                  start_date=datetime.timedelta(-20),
                  end_date=datetime.timedelta(0),
                  interval='daily')

The output returns N/A values.

How should i fix this ?

Thank you in advance,

Best,

Kyriakos

eikon-data-api#technologypython apihistorical
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.

Upvotes
Accepted
15.4k 32 5 10

Hi @kyriakos.eleftheriadis ,

Frq of minute is not available, you may use Data Item Browser tool available from Eikon deskop to confirm all available parameters and their respective values:

1681708508261.png

Or you can use use get_timeseries method instead of get_data. For example,

import refinitiv.data.eikon as ek
import datetime

ek.set_app_key('###YOUR_APP_KEY###')

start_date = datetime.datetime(2023, 3, 1).strftime('%Y-%m-%d')
end_date = datetime.datetime(2023, 3, 10).strftime('%Y-%m-%d')

ek.get_timeseries(['NL188254462='], 
                  start_date=start_date, 
                  end_date=end_date, 
                  interval='minute')
1681708480231.png


1681708508261.png (51.1 KiB)
1681708480231.png (43.8 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.

Upvote
15.4k 32 5 10

Hi @kyriakos.eleftheriadis ,

You could use these fields instead, they can be discovered using Data Item Browser

import datetime
start_date = datetime.datetime(2023, 3, 1).strftime('%Y-%m-%d')
end_date = datetime.datetime(2023, 3, 10).strftime('%Y-%m-%d')

df, err = ek.get_data(
    instruments=['NL188254462='],
    fields=['TR.ASKPRICE','TR.ASKYIELD','TR.BIDPRICE','TR.BIDYIELD'],
    parameters={'SDate': start_date, 'EDate': end_date, 'Frq': 'D'})
df

1679997726580.png

If you have any questions regarding the field name or content in Refinitiv, you can raise a ticket in MyRefinitiv as the moderators on this forum are expertise in API usage, not all the content available in Refinitiv.


1679997726580.png (36.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.

Hi,

Thank you for your answer. The same applies when i want to use the frequency as minute?

I tried 'Frq': 'MIN' but i receive NA again.

Kind regards,

Kyriakos

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.