Download the stock daily prices and total return together with date sorted

Hi all,

I am trying to download the daily prices and total return of a list of RICs. However, when I tried by using the following codes, the sorted dates of these two variables are opposite. How to modify the code to combine the date?

Many thanks

ric = df['ric'].astype(str).tolist()

df, e = ek.get_data(ric,
['TR.PriceClose(Curn=USD)','TR.TotalReturn','TR.PriceClose.calcdate','TR.TotalReturn.date'],
{'SDate': '2024-01-01',
'EDate': '2024-02-10','Frq':'D'})
df1710345601429.png

Welcome!

It looks like you're new here. Sign in or register to get started.

Best Answer

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

    Hi @jiayin.meng.20 ,


    I would advise updating to the new library, have you had a look at it?

    import refinitiv.data as rd
    rd.open_session()

    df = rd.get_data(
    universe=["LSEG.L", "VOD.L"],
    fields=['TR.PriceClose(Curn=USD)','TR.TotalReturn','TR.PriceClose.calcdate','TR.TotalReturn.date'],
    parameters={
    "SDate": '2024-01-01',
    "EDate": '2024-02-10', # "Curn": "EUR",
    'Frq':'D'})
    df

    1710347262956.png



    I'd actually advise the get_history function instead.

Answers

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.