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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
37 3 3 10

Download Prices adjusted for split but unadjusted for dividends

I am looking for a way to get the total return prices of a stock. I know that with the get_data method and the TR.CLOSEPRICE field, I can set the option Adjusted=0 and obtain unadjusted prices. However, that that one removes both the adjustment for splits and for dividends. And I would like to keep the only dividends unadjusted, so that I can get to the total return price.

The Eikon support told me how to do that in the Excel API and I am looking for a way to replicate that in Python. Would you be able to help me out (preferably by using the get_data method)?

Option 1) Adjusted prices

=@RHistory("AAPL.O","TRDPRC_1.Timestamp;TRDPRC_1.Close","START:01-Jan-2020 END:20-Apr-2021 ADJUSTED:YES INTERVAL:1D",,"TSREPEAT:NO CH:IN;Fd")

Option 2) Prices unadjusted relative to dividend (according to Eikon Support)
=@RHistory("AAPL.O","TRDPRC_1.Timestamp;TRDPRC_1.Close","START:01-Jan-2020 END:20-Apr-2021 ADJUSTED:NO INTERVAL:1D",,"TSREPEAT:NO CH:IN;Fd")


Thank you for your help!

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

@Tulkkas

The answer you received from Eikon support is misleading in the context of your question.
Refinitiv follows market conventions when adjusting stock price history for corporate actions. In most markets including the US the convention is to not adjust stock price history for regular cash dividends. There's no way using Eikon to retrieve price history for US stocks adjusted for regular cash dividends. If you need US stock price history adjusted for dividends, the only way you can get it from Eikon is by retrieving the stock price history, the dividend history and performing the adjustment yourself. Both examples of =RHistory function, that Eikon support gave you, return price history for AAPL.O unadjusted for dividends. With ADJUSTED:YES (or by default) the stock price returned will be adjusted for capital changes like stock splits etc. With ADJUSTED:NO the stock price returned will not be adjusted for anything. The same applies for other methods of retrieving stock price history including get_data method with TR.CLOSEPRICE field and get_timeseries method of Eikon Data APIs. The following calls return the same price history adjusted for capital changes, but not for dividends

=@RHistory("AAPL.O","TRDPRC_1.Timestamp;TRDPRC_1.Close","START:01-Jan-2020 END:20-Apr-2021 ADJUSTED:YES INTERVAL:1D",,"TSREPEAT:NO CH:IN;Fd")
or
=@RHistory("AAPL.O","TRDPRC_1.Timestamp;TRDPRC_1.Close","START:01-Jan-2020 END:20-Apr-2021 INTERVAL:1D",,"TSREPEAT:NO CH:IN;Fd")
ek.get_timeseries('AAPL.O', fields=['CLOSE'], 
                  start_date='2020-01-01', end_date='2021-04-20', 
                  interval = 'daily', corax='adjusted')
or
ek.get_timeseries('AAPL.O', fields=['CLOSE'], 
                  start_date='2020-01-01', end_date='2021-04-20')
ek.get_data('AAPL.O',['TR.CLOSEPRICE.date','TR.CLOSEPRICE'],
            {'SDate':'2020-01-01', 'EDate':'2021-04-20', 'Adjusted':'1'})
or
ek.get_data('AAPL.O',['TR.CLOSEPRICE.date','TR.CLOSEPRICE'],
            {'SDate':'2020-01-01', 'EDate':'2021-04-20'})

And the following calls return the same price history unadjusted for anything

=@RHistory("AAPL.O","TRDPRC_1.Timestamp;TRDPRC_1.Close","START:01-Jan-2020 END:20-Apr-2021 ADJUSTED:NO INTERVAL:1D",,"TSREPEAT:NO CH:IN;Fd")
ek.get_timeseries('AAPL.O', fields=['CLOSE'], 
                  start_date='2020-01-01', end_date='2021-04-20', 
                  interval = 'daily', corax='unadjusted')
ek.get_data('AAPL.O',['TR.CLOSEPRICE.date','TR.CLOSEPRICE'],
            {'SDate':'2020-01-01', 'EDate':'2021-04-20', 'Adjusted':'0'})

If you're looking for total return on a stock, you may want to explore total return ready available from Eikon by using fields like TR.TotalReturn or TR.TotalReturn3Mo. E.g. the following call retrieves total return on a stock between two dates

ek.get_data('AAPL.O', ['TR.TotalReturn'], 
            {'SDate':'2020-01-01', 'EDate':'2021-04-20'})

And the following retrieves daily timeseries of 3 month total return

ek.get_data('AAPL.O', ['TR.TotalReturn3Mo.date','TR.TotalReturn3Mo'], 
            {'SDate':'2020-01-01', 'EDate':'2021-04-20'})
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
18k 21 12 20

Hi @Tulkkas

Please try this code:

df = ek.get_timeseries('AAPL.O', start_date='2020-01-01', end_date='2021-04-20', interval = 'daily', corax='unadjusted')
df

And:

df = ek.get_timeseries('AAPL.O', start_date='2020-01-01', end_date='2021-04-20', interval = 'daily', corax='adjusted')
df
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
37 3 3 10

Thank you very much @chavalit.jintamalit and @Alex Putkov. ! Yeah, in the meantime we figured out that Eikon support did not really understand our question.

Total Return is something we have already looked at, but unfortunately I needed the actual total return price for some backtests in order to know how many shares I buy.


Thank you 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.

Click below to post an Idea Post Idea