我从quantmod软件包下载了R中股票的日回报率。我看到AT&T的每日最低回报率是-77%,这是很难相信的。我查了一下历史价格,发现这可能是因为分红或分红。我如何调整或纠正我的回报是我的问题。提前谢谢。
发布于 2014-11-08 23:44:09
真的吗?当我这样做的时候,我每天的最低回报是-7.7%。
library(quantmod)
ATT <- getSymbols("T",auto.assign=FALSE)
min(dailyReturn(ATT))
# [1] -0.07721139的确,分裂可能是一个问题:
AAPL <- getSymbols("AAPL",auto.assign=FALSE)
min(dailyReturn(AAPL)) # reflects 7:1 split
# [1] -0.8548569
x <- which.min(dailyReturn(AAPL))
AAPL[(x-1):x]
# AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
# 2014-06-06 649.9 651.26 644.47 645.57 87484600 91.37
# 2014-06-09 92.7 93.88 91.75 93.70 75415000 92.83但这就是“调整关闭”的目的:
min(dailyReturn(Ad(AAPL)))
# [1] -0.1792507
y <- which.min(dailyReturn(Ad(AAPL)))
AAPL[(y-1):y]
# AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
# 2008-09-26 124.91 129.80 123.00 128.24 281612800 17.35
# 2008-09-29 119.62 119.68 100.59 105.26 655514300 14.24https://stackoverflow.com/questions/26823068
复制相似问题