当我尝试使用 getSymbols() 调整从雅虎下载的历史价格时,我注意到 use.Adjusted=T 或 use.Adjusted=F 存在差异。
差异似乎太大而无法进行十进制进动。
通过运行 adjustOHLC 帮助文件中的示例,
> getSymbols("AAPL", from="1990-01-01", src="yahoo")
[1] "AAPL"
> head(AAPL)
AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
1990-01-02 35.25 37.50 35.00 37.25 6555600 8.46
1990-01-03 38.00 38.00 37.50 37.50 7444400 8.52
1990-01-04 38.25 38.75 37.25 37.63 7928800 8.55
1990-01-05 37.75 38.25 37.00 37.75 4406400 8.58
1990-01-08 37.50 38.00 37.00 38.00 3643200 8.63
1990-01-09 38.00 38.00 37.00 37.63 3096800 8.55
> head(AAPL.a <- adjustOHLC(AAPL))
AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
1990-01-02 32.03023 34.07471 31.80306 33.84755 6555600 8.46
1990-01-03 34.52904 34.52904 34.07471 34.07471 7444400 8.52
1990-01-04 34.75621 35.21054 33.84755 34.19284 7928800 8.55
1990-01-05 34.30188 34.75621 33.62038 34.30188 4406400 8.58
1990-01-08 34.07471 34.52904 33.62038 34.52904 3643200 8.63
1990-01-09 34.52904 34.52904 33.62038 34.19284 3096800 8.55
> head(AAPL.uA <- adjustOHLC(AAPL, use.Adjusted=TRUE))
AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
1990-01-02 8.005772 8.516779 7.948993 8.46 6555600 8.46
1990-01-03 8.633600 8.633600 8.520000 8.52 7444400 8.52
1990-01-04 8.690872 8.804478 8.463659 8.55 7928800 8.55
1990-01-05 8.580000 8.693642 8.409536 8.58 4406400 8.58
1990-01-08 8.516447 8.630000 8.402895 8.63 3643200 8.63
1990-01-09 8.634069 8.634069 8.406856 8.55 3096800 8.55
雅虎调整后的价格和 adjRatios 似乎非常巨大。
getSymbols("AAPL", from="1990-01-01", src="yahoo");
div <- getDividends("AAPL", from="1990-01-01", src="yahoo");
spl <- getSplits("AAPL", from="1990-01-01", src="yahoo");
ratio <- adjRatios(spl, div, Cl(AAPL))
> spl
AAPL.spl
2000-06-21 0.5
2005-02-28 0.5
在苹果股票拆分时检查。
> ratio['2000-06-20/2000-06-23']
Split Div
2000-06-20 1 0.972553
2000-06-21 1 0.972553
2000-06-22 1 0.972553
2000-06-23 1 0.972553
> ratio['2005-02-25/2005-03-01']
Split Div
2005-02-25 1 0.972553
2005-02-28 1 0.972553
2005-03-01 1 0.972553
似乎 adjRatios() 没有返回正确的分流比。
建豪