question

Upvotes
Accepted
16 2 5 10

get_history versus get_data (pros and cons)

The 2 scripts below return the same values but use 2 different functions : get_history and get_data. What are the best practices and the pro and cons?


import refinitiv.data as rd
rd.open_session()

universe = ['.MIWOIN090NEU']
fields = ['TRDPRC_1']
start_date = '2000-01-01'
end_date = '2024-01-02'

df = rd.get_history(universe=universe,fields=fields,interval='daily',start=start_date, end=end_date,use_field_names_in_headers=True)

rd.close_session()

and :

import refinitiv.data as rd
rd.open_session()

instruments = ['.MIWOIN090NEU']
fields = ['TR.PriceClose','TR.PriceClose.date']
start_date = '2000-01-01'
end_date = '2024-01-02'

df = rd.get_data(instruments, fields=fields, parameters={'SDate': start_date, 'EDate': end_date, 'DateType': 'ED', 'Adjusted': 'No'})

rd.close_session()
#productrefinitiv-data-platform
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.

Hello @guillaume.lefur

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,
AHS

1 Answer

· Write an Answer
Upvotes
Accepted
5.8k 21 2 6

Hi @guillaume.lefur,


The RD Lib.'s `get_data` function reflects the old Eikon Data API (EDAPI) funciton of the same name. EDAPI is the old version of the RD Lib. and will be deprecated soon, so the `get_data` was created so taht a similar funciton exist for people upgrading today. It is not feature complete yet in replacing EDAPI's function. It is a somewhat 'raw' function that 'simply' collects data from databases as they are with no/few filters or tidying logic.

The RD Lib.'s `get_history` tends to be more useful than the `get_data` function; it presents data in ways that are easier to deal with (removing certain `NA`s when they do not offer more information and presenting field details for RICs of different nature (e.g.: Fixed Income and Equities) in an ergonomic way) in Python.

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.

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.