question

Upvotes
Accepted
3 0 2 4

Issue when retrieving history using the Access Layer or Content Layer in Python

Hi All,

I recently noticed an issue when retrieving history data through the Access Layer or Content Layer functions of the Data Platform Libraries for a list of RICs. There seems to be an abnormally massive wait time (I stop the application from running after 5 minutes). I am forced to revert back to using the Eikon API since that works and retrieves the data within seconds.

The issue occurs when passing a list of 17 RICs. Even if iterated over individually, it still causes an issue. Below is the code for the Access Layer and Content Layer which does not work, finally followed by the code for the Eikon API which works without any issues.

Package being used: refinitiv-data==1.0.0b16

Connection Type: Desktop Session


Access Layer - Not Working

df_result = rd.get_history(
            universe=ric,
            start=sDate,
            end=eDate,
            interval='tick',
            fields=['TRDPRC_1', 'TRDVOL_1']
        )


Content Layer - Not Working

result = historical_pricing.events.Definition(
         universe=ric,
         start=sDate,
         end=eDate,
         fields=['TRDPRC_1', 'TRDVOL_1']
     ).get_data()


Eikon API - Working Fine

df_result = ek.get_timeseries(
    rics=ric,
    start_date=sDate,
    end_date=eDate,
    interval='tick',
    fields=['Timestamp', 'value', 'Volume'],
    raw_output=True
)


Some help on this would be greatly appreciated. Do let me know if you need anymore information which could help with this.


More Information:

Start/End Date

startDate = '7/14/2022 2:30 PM'
endDate = '7/14/2022 3:01 PM'

startDate = datetime.strptime(startDate , '%m/%d/%Y %I:%M %p')
endDate = datetime.strptime(endDate , '%m/%d/%Y %I:%M %p')

sDate = startDate.astimezone(pytz.UTC).replace(tzinfo=None)
eDate = endDate.astimezone(pytz.UTC).replace(tzinfo=None)

List of RICs

rics_underlying = ["ADCB.AD", "ADNOCDIST.AD", "AIRA.DU", "ALDAR.AD", "ARMX.DU",
                   "DEWAA.DU", "DFM.DU", "DISB.DU", "DINV.DU", "DU.DU", "EMAR.DU", "EMAARDEV.DU",
                   "ENBD.DU", "ETISALAT.AD", "FAB.AD", "GFH.DU", "SHUA.DU"]
refinitiv-dataplatform-eikonrefinitiv-dataplatform-libraries
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
19k 85 39 63

Hi @prasad.acharya1

When you loop, does each individual request take more than 5 minutes? Did you test a single request?

I just performed a test that covers a minute and the total number of events/rows returned is over 117,000! It's also worth noting that each RIC within the basket will not have matching events so when the final result is put together, the dataframe will have a numerous number of rows.

For example, try this to see the results:

sDate = "2022-07-14T10:30:00.0000000Z"
eDate = "2022-07-14T10:31:00.0000000Z"
rd.get_history(rics_underlying, interval='tick', start=sDate, end=eDate)

Because you are retrieving tick data, you may be better off requesting for individual RICs.

Another thing to consider is whether you need all fields in the response - you may only be looking at a few so this may affect the resulting time it takes and the size of the dataframe returned.

Can you share the code segment you are using to retrieve the same data via the Eikon Data API that only takes seconds?

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.

Yes, I faced the issue also when iterating single requests.


This is the code used through the Eikon Data API:

df_result = ek.get_timeseries(
    rics=ric,
    start_date=sDate,
    end_date=eDate,
    interval='tick',
    fields=['Timestamp', 'value', 'Volume'],
    raw_output=True
)

I shall try out the code mentioned above and get back as soon as I can, thank you!

Hi @nick.zincone ,


Thank you for this, it works well, the only issue seems to be that it takes longer to complete execution.
Runtime using rd.get_history: 50 seconds
Runtime using ek.get_timeseries: 20 seconds

According to the above approximate recorded runtimes, seems like ek.get_timeseries is able to retrieve data alot faster than rd.get_history.

Is there any other way using rdp that I can retrieve historic data atleast at the same speed? Maybe as bulk data for the defined set of RICs?

This would help alot if there are a set of 60 RICs (e.g. equity futures for each of the rics in rics_underlying), and need to get bid and ask historic tick data for it.

Hi @prasad.acharya1

Can you provide the actual ric list you are using for get_timeseries()? According to my tests, most of the RICs you provided do not have data.

Hi @nick.zincone , the RIC list is the same as provided in the question. Probably an issue with the start date and time.

Just tested now and I am able to retrieve the data. Please use the Start/End Date code section mentioned in the question. It converts the timezone to UTC.

Upvotes
19k 85 39 63
Hi @prasad.acharya1

Can you provide more information.

  1. What specific issue are you encountering? Does the call time out - you mention it takes a very long time. Or is the data that does come back incorrect? Are you getting an error message? etc
  2. Can provide the list of 17 RICs? And the start and end dates you are using in your tests?
  3. Can you elaborate on "iterated over individually"? You mean you are passing in a single RIC instead of a batch of 17?

Have you looked at the examples provide within GitHub?

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 @nick.zincone ,

Thank you for responding on this!

1. It just keeps loading, I interrupt the application after 5minutes since that is already too long. No timeout, no error message, no data.

2. Information has been added to the question.

3. Yes, using a for loop for each RIC.

Seen all the examples, but none refer to using historical_pricing.events with multiple RICs and specific fields.

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.