- quantmod调整hlc函数-股息调整后的价格



我需要帮助来解释使用quantmod::adjustOHLC调整股息价格的差异。

查看调整后和未调整后的苹果股价:

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

苹果最近一次派息为2016年8月4日0.57美分。

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

在2016年5月5日至2016年8月3日期间,当adjustOHLC被要求仅调整股息时,我的预期是从这些日期的OHLC价格中扣除0.57美分。

但是,在计算时,我没有看到0.57美分的确切差异未调整收盘价与调整收盘价之差。

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

在绘制的直方图中,大多数价格都不接近0.57。

查阅adjustOHLC规范,计算出的调整因子为与感兴趣的日期范围

相同
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

为何未调整收盘价与调整收盘价差异如此之大?

quantmod::adjustOHLC的计算是正确的。差异在于你的假设和期望。

没有理由期望未调整收盘价和调整收盘价之间的差额等于股息金额,除息日和与除息日收盘价相同的任何其他日期除外。

您甚至注意到,"计算调整因子对于感兴趣的日期范围是相同的"(强调添加)。调整因素将是相同的,直到有另一个股息或拆分。调整后的收盘价由乘以调整因子和未调整的收盘价计算。

如果你简单地从所有之前的收盘价中减去股息金额,你将改变回报,甚至可能导致收盘价变为负值!

查看调整后和未调整后的价格:

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

当你比较调整和未调整系列的8/3和8/4之间收盘价的净变化时,你会发现有57美分的差异,这是股息支付,股息支付之前的所有价格都相应地下降了57美分。