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()

Best Answer

  • [Deleted User]
    [Deleted User] Newcomer
    Answer ✓

    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.