基于以下两个计算,我得到的数字非常接近,但存在细微差别。这是由于四舍五入吗? (数据从雅虎下载)
getSymbols("0005.hk")
yearlyReturn(Ad(`0005.HK`))
yearly.returns
2007-12-31 -0.06995571
2008-12-31 -0.43571264
2009-12-31 0.22058512
2010-12-31 -0.10458219
2011-12-30 -0.25523618
2012-12-31 0.38690270
2013-12-31 0.04151717
2014-12-31 -0.11737805
2015-12-31 -0.15820108
2016-01-06 -0.04281099
yearlyReturn(adjustOHLC(`0005.HK`))
yearly.returns
2007-12-31 -0.07190533
2008-12-31 -0.43571057
2009-12-31 0.22058133
2010-12-31 -0.10457942
2011-12-30 -0.25523699
2012-12-31 0.38690493
2013-12-31 0.04150802
2014-12-31 -0.11737174
2015-12-31 -0.15820416
2016-01-06 -0.04281099
getSplits("0005.hk")
[1] NA
使用quantmod版本0.4-5 和R版本3.2.3
答案 0 :(得分:2)
是的,这是由于四舍五入。原始Yahoo数据中的调整列只有3位小数的精度。计算出的调整后的价格更加精确。举例说明:
R> head(merge(Ad(`0005.HK`),Cl(adjustOHLC(`0005.HK`))))
X0005.HK.Adjusted X0005.HK.Close
2007-01-01 135.014 135.0135
2007-01-02 135.961 135.9610
2007-01-03 137.098 137.0980
2007-01-04 136.245 136.2452
2007-01-05 135.866 135.8663
2007-01-08 134.824 134.8240