For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
9 0 0 0

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

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
39.2k 75 11 27

@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'])
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
6.7k 8 6 7

@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:

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

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.


1617108852396.png (126.0 KiB)
1617109185843.png (153.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
9 0 0 0

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
6.7k 8 6 7

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

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.


1617111135594.png (26.0 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
9 0 0 0

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

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
39.2k 75 11 27

@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
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea