quantmod adjustOHLC function - dividend adjusted prices

点点圈 提交于 2019-12-14 03:49:42

问题


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?


回答1:


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!




回答2:


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.



来源:https://stackoverflow.com/questions/39195608/quantmod-adjustohlc-function-dividend-adjusted-prices

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!