Download indices in percentages

Hi,

is it possible to download indices in percentage change as can be seen on all the servers (investing.com and others), even in eikon on list called INOV (INFOV for futures)?

If not, then i understand basic operations, for example for dax this works well


ric_dax='.GDAXI'

dax=ek.get_timeseries(ric_dax,start_date='2019-09-03T07:00:00',interval="daily")

dax_diff=dax['CLOSE'].pct_change()*100


But it doesnt work for longer traded futures. for example for nikkei futures this code


ric_nikkei_futures='JNIc1 '

nikkei_futures=ek.get_timeseries(ric_nikkei_futures,start_date='2020-09-03T07:00:00',interval="daily")

nikkei_futures_diff=nikkei_futures['CLOSE'].pct_change()*100


gives different values than on the eikon window called INFOV. does someone know how to solve it? I am from GMT +1, i think it has something to do with a time zone


Even the us indices futures (nasdaq, sp500) does not give the same results as on INFOV page with the code above


Thanks

Best Answer

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭
    Answer ✓

    @Novotnyja

    If you're looking for the percent change value displayed in "% Chng" column in INFOV app in Eikon, you can get it from the PCTCHNG field of real-time record using for example

    ek.get_data(['.GDAXI','.SPX','JNIc1','SPcv1'], ['PCTCHNG'])

Answers

  • @Novotnyja So your code is correct for a daily close pct value. So for example the Nikkei225 JNIc1 future closed at 07:00 gmt at a value of 29480 which is 1.37% higher than the previous close on the 29 march of 29080. What you are seeing now in the eikon viewer is the live future trading vs the official close of today:

    image

    you can get this information by choosing a different interval: eg daily will give you the daily close for each day - if a future trades after the normal market hours have shut you will not get those. However if you change the interval to hour or minute you can get the latest values:

    df = ek.get_timeseries('JNIc1',start_date='2020-09-03T07:00:00',interval="hour") 
    df

    image

    Our monitors use a steaming live price feed to update in real time. You can find out more about using those here. I hope this can help.

  • Oki, thanks, i know understand the issue, that the percentage is calculated as latest value vs. the official close, which in the case of nikkei is not same as the last value that day in gmt +1

    But unfortunately i still dont know how to deal with it using eikon api, if i want the same percentage value for nikkei futures as on INFOV page

    Thanks :)

  • @Novotnyja here you go you can add any realtime fields from the quote window to these and even build up the same display as you see in infov screen.

    import refinitiv.dataplatform as rdp 
    rdp.open_desktop_session('YOUR APP KEY HERE')
    streaming_prices = rdp.StreamingPrices(universe = ['JNIc1','JNIc2'],      fields= ['NETCHNG_1','PCTCHNG','TRDPRC_1','SALTIM'] )
    df = streaming_prices.get_snapshot() 
    display(df)

    image

    This is the simplest example of synchronous streaming workflow there are also event driven modes with callbacks you could use, I hope this can help.

  • Thank you very much Alex, it shows the values i need! i have the last question, this way is showing data in a unusual format for me. for example i cant do


    nikkei_futures=ek.get_data(['JNIc1'], ['PCTCHNG'])

    new=nikkei_futures['PCTCHNG']+1


    and so on..


    Please how to do it, if i want to get one callable numeric value of the 'PCTCHNG'


    Thank you very much for your help

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭

    @Novotnyja

    get_data method of Eikon Data APIs library returns a tuple containing pandas dataframe with the data payload and the error object. To extract the dataframe from the result returned by get_data method just get the first element of the tuple. Or use the following notation

    nikkei_futures, err = ek.get_data(['JNIc1'], ['PCTCHNG'])
    new=nikkei_futures['PCTCHNG']+1