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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
59 6 13 17

Total Returns and Price Returns over specific periods

Is there a way to get the total return and the price return of an index using the python API? Specifically, i was looking for total return and price return for 5 year periods (2000-01-01 to 2004-12-31, 2005-01-01 to 2009-12-31, 2010-01-01 to 2014-12-31 and 2015-01-01 to 2019-12-31) for STI. i can see the chart/data on .STI TRTR and can pull the timeseries for .STI and .TRISTI (the total return STI) but was looking to write an pythonic query to get the information as a single api request rather than having to get the two series and then compute returns etc separately.

eikoneikon-data-apipythonworkspacerefinitiv-dataplatform-eikonworkspace-data-apidata
icon clock
10 |1500

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

Upvote
Accepted
3.8k 4 4 6

Hi @rajanraju

You can calculate that in a single query.

df,err = ek.get_data(['.TRISTI','.STI'], 'TR.PriceClose(SDate=2004-12-31)/TR.PriceClose(SDate=1999-12-31)-1')


ahs.jpg (87.2 KiB)
icon clock
10 |1500

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

Upvotes
59 6 13 17

Many thanks. Will annualise the formula.

icon clock
10 |1500

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