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!
Best Answer
-
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'})1
Answers
-
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')
dfAnd:
df = ek.get_timeseries('AAPL.O', start_date='2020-01-01', end_date='2021-04-20', interval = 'daily', corax='adjusted')
df0 -
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.
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛