首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Quantmod中调整日收益

在Quantmod中调整日收益
EN

Stack Overflow用户
提问于 2014-11-08 23:06:31
回答 1查看 2.7K关注 0票数 1

我从quantmod软件包下载了R中股票的日回报率。我看到AT&T的每日最低回报率是-77%,这是很难相信的。我查了一下历史价格,发现这可能是因为分红或分红。我如何调整或纠正我的回报是我的问题。提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-08 23:44:09

真的吗?当我这样做的时候,我每天的最低回报是-7.7%。

代码语言:javascript
复制
library(quantmod)
ATT  <- getSymbols("T",auto.assign=FALSE)
min(dailyReturn(ATT))
# [1] -0.07721139

的确,分裂可能是一个问题:

代码语言:javascript
复制
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

但这就是“调整关闭”的目的:

代码语言:javascript
复制
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.24
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26823068

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档