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"]

Best Answer

  • nick.zincone
    nick.zincone admin
    Answer ✓

    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?

Answers