question

Upvotes
Accepted
0 0 0 4

Getting daily historical data at a fixed timestamp

Hi,


Does anyone know how to get the bid/ask at a specific time every day? Eg. ESc1 at 6:00am UTC time for the past 2 years. There has to be a better way than to get hourly data and filter it. I am currently using the refinitiv data library in python.


Thanks

pythonrdp-apihistoricaltime-series
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
2.3k 16 2 2

Hi @D ,


You mentioned that the issue with using start and end arguments in the rd function is that it requires pulling unnecessary data.

If you only want one result, you can choose the count:


import refinitiv.data as rd
rd.open_session()
IntradayTimeSeriesDf = rd.get_history(
    universe=['ESc1'],
    fields=['BID'],
    interval="1min",  # The consolidation interval. Supported intervals are: tick, tas, taq, minute, 1min, 5min, 10min, 30min, 60min, hourly, 1h, daily, 1d, 1D, 7D, 7d, weekly, 1W, monthly, 1M, quarterly, 3M, 6M, yearly, 1Y.
    start="2022-05-06T06:00:00",
    end="2022-05-06T06:01:00",
    count=1
)
IntradayTimeSeriesDf


1661858613165.png


1661858613165.png (4.7 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.

Again, this is inefficient because I would have to call the API 250 times to get 1 years worth of data.
Hi @D,

That's quite right, I'm afraid that an API call for every date in question will be needed in your use case. I'd advise embedding it in a loop.
I let our developers know of this python capability demand, and I hope we can add it to our roadmap to implement it natively in RD.

Upvotes
2.3k 16 2 2

Hi @D,


I'd advise looking into the RD library, as exemplified here:

https://github.com/Refinitiv-API-Samples/Example.DataLibrary.Python/blob/main/Examples/2-Content/2.01-HistoricalPricing/EX-2.01.01-HistoricalPricing.ipynb


e.g.:


import refinitiv.data as rd
rd.open_session()
IntradayTimeSeriesDf = rd.get_history(
    universe=['ESc1'],
    fields=['TRDPRC_1'],
    interval="1min",  # The consolidation interval. Supported intervals are: tick, tas, taq, minute, 1min, 5min, 10min, 30min, 60min, hourly, 1h, daily, 1d, 1D, 7D, 7d, weekly, 1W, monthly, 1M, quarterly, 3M, 6M, yearly, 1Y.
    start="2022-05-11T13:00:00",
    end="2022-05-11T13:30:00")
IntradayTimeSeriesDf


1661854609847.png


If you're looking for the data field you need too, please use the DIB:

https://developers.refinitiv.com/en/video-catalog/data-item-browser


1661854609847.png (49.6 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.

Thanks for the response. The issue with this is that it requires pulling unnecessary data. I only need 1 exact point in time for each day which I couldn’t find an example for.