How to get percent change between two intraday values?

Tim.Diego
Tim.Diego LSEG
edited November 2024 in Eikon Data APIs

Hello Team,

I have syntax below that gets data at exactly 6PM (df) and latest tick of EUR= (df2)

I'd like to get the percentage between the two output.

I tried df3 =((df2-df)/df*100) but it is not working.

Also, how can I set a specific timezone?

import refinitiv.data as rd
rd.open_session()

df = rd.get_history(
universe = ['EUR='],fields=['BID'],interval="tick",end="2024-11-19T19:00:00",count=1
)

df2 = rd.get_history(
universe = ['EUR='],fields=['BID'],interval="tick", count=1
)

df3 =((df2-df)/df*100)

display(df,df2,df3)


Thank you!

Best Answer

  • Gurpreet
    Gurpreet admin
    Answer ✓

    Hello @Tim.Diego,

    The data returned by the API calls will always be in the UTC timezone. You can search other questions in this forum, on how to locally manipulate the time in your application.

    Regarding the percentage calculations - you are trying to subtract non-scaler values (dataframe) - which is giving two data points since the time is the index. Instead you should operate on the scaler value like this -

    image.png

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.