3

I need help in explaining a discrepancy in dividend adjusted prices using quantmod::adjustOHLC.

Get adjusted and unadjusted prices for AAPL:

library(quantmod)
getSymbols("AAPL")
AAPL.adjusted <- adjustOHLC(AAPL, adjust=c("dividend"), symbol.name="AAPL")

Last dividend for AAPL was on 2016-08-04 for 0.57 cents.

div <- getDividends("AAPL", from = "1900-01-01")
tail(div)
#            [,1]
# 2015-05-07 0.52
# 2015-08-06 0.52
# 2015-11-05 0.52
# 2016-02-04 0.52
# 2016-05-05 0.57
# 2016-08-04 0.57

For the period 5/5/2016 through 8/3/2016, when adjustOHLC when called to adjust only for dividends my expectation is for it to deduct 0.57 cents from OHLC prices for these dates.

But, I don't see an exact difference of 0.57 cents when computing differences between unadjusted and adjusted closing prices.

div <- coredata(AAPL["2016-05-05/2016-08-03"][,"AAPL.Close"] -
       AAPL.adjusted["2016-05-05/2016-08-03"][,"AAPL.Close"])
hist(div)

In the plotted histogram, most prices are not close to 0.57.

Looking into code of adjustOHLC, computed adjustment factors are identical for the interested date range

div <- getDividends("AAPL", from = "1900-01-01")
splits <- getSplits("AAPL", from = "1900-01-01")
div <- div * 1/adjRatios(splits=merge(splits, index(div)))[, 1]
ratios <- adjRatios(splits, div, Cl(AAPL))
length(ratios["2016-05-05/2016-08-03"][, "Div"])
# [1] 63
table(ratios["2016-05-05/2016-08-03"][, "Div"])
# 0.994611967155573
#                63

Why there is so much variation in differences of unadjusted and adjusted closing prices?

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418
user3477071
  • 194
  • 1
  • 13

2 Answers2

2

The calculation by quantmod::adjustOHLC is correct. The discrepancy is in your assumptions and expectations.

There is no reason to expect the difference between unadjusted and adjusted close prices to be equal to the dividend amount, except on the ex-dividend date and any other dates with an identical close price as the ex-dividend date.

You even note that, "computed adjustment factors are identical for the interested date range" (emphasis added). The adjustment factor will be identical until there is another dividend or split. The adjusted close is calculated by multiplying the adjustment factor and the unadjusted close price.

If you simply subtracted the dividend amount from all prior close prices, you would change the returns and it could possibly even cause the close price to become negative!

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418
  • Thanks, that makes sense. – user3477071 Sep 01 '16 at 13:33
  • @Joshua , there is no right or wrong method.Adjusting for dividends by keeping the the proportions correct means that you loose the correct price structure. ( the abs. diffs of OHLC are not correct anymore). Adjusting for dividends by subtracting the abs. amount of the dividends keeps the price structure but looses the correct proportion.It depends what you want and that you are aware of it. If adjusting by subtracting the dividend no math. transformations that depend on the level ( like calculating returns ) should be made. Same situation with adjusting for rolls concerning futures contracts. – hvollmeier Sep 03 '16 at 14:07
0

Have a look at the adjusted and unadjusted prices:

getSymbols('AAPL',from='2016-08-01',to = '2016-08-06')

[1] "AAPL"
> AAPL
           AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
2016-08-01    104.41    106.15   104.41     106.05    38167900      105.4786
2016-08-02    106.05    106.07   104.00     104.48    33816600      103.9171
2016-08-03    104.81    105.84   104.77     105.79    30202600      105.2200
2016-08-04    105.58    106.00   105.28     105.87    27408700      105.8700
2016-08-05    106.27    107.65   106.18     107.48    40553400      107.4800
> adjustOHLC(AAPL)
           AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
2016-08-01  103.8474  105.5781 103.8474   105.4786    38167900      105.4786
2016-08-02  105.4786  105.4985 103.4396   103.9171    33816600      103.9171
2016-08-03  104.2453  105.2697 104.2055   105.2200    30202600      105.2200
2016-08-04  105.5800  106.0000 105.2800   105.8700    27408700      105.8700
2016-08-05  106.2700  107.6500 106.1800   107.4800    40553400      107.4800

When you compare the net change of the closing prices between 8/3 and 8/4 of the adjusted and unadjusted series you see that there is exactly a difference of 57 cents which is the dividend payout and all the prices prior to the dividend payout are shifted down 57 cents accordingly.

hvollmeier
  • 2,956
  • 1
  • 12
  • 17
  • The differences start out good looking back from 8/3/16 but when you reach 7/26/16, difference narrows to $0.52: > getSymbols('AAPL', from="2016-07-26", to="2016-08-04" > AAPL[,"AAPL.Close"] - adjustOHLC(AAPL, adjust=c("dividend"))[, "AAPL.Close"] And there has been no corporate action between 7/26/16 and 8/4/16. I expect the difference to be very close to 0.57 all the way back to the previous corporate action which was in 5/5/16. – user3477071 Aug 29 '16 at 13:48
  • @user3477071 what is your question? As you can see on 8/3 the series was adjusted for 57 cents representing exactly the dividend payout. – hvollmeier Aug 29 '16 at 13:57
  • Shouldn't the same difference also show up all the way back to the previous dividend payout on 5/5/16? – user3477071 Aug 29 '16 at 14:03
  • Yes, if you check my answer you see that all prices before the dividend payout differ 57 cents.. – hvollmeier Aug 29 '16 at 14:08
  • On 7/26/16, I get difference between unadjusted and adjusted closing price to be $0.52. – user3477071 Aug 29 '16 at 14:09
  • Yes, I see what you mean. I just created a plot showing the differences in the closing prices for the adj. and unadj. closings since 2016-05-02 ( before the May dividend). `adjustOHLC(AAPL)[,4] - AAPL[,4]` . The adjustments just don't make sense to me. I compared the adj. closing against data from CSI and they are different. – hvollmeier Aug 29 '16 at 14:46