R quantmod:如何获得> 10年的数据?

R quantmod: how to get >10 years of data?

我正在尝试获取超过 10 年的数据,但我无法找到如何使用 getSymbols() 或 chartSeries() 来执行此操作。

https://www.quantmod.com/documentation/getSymbols.html https://www.quantmod.com/documentation/chartSeries.html

或者 Yahoo 是否只有自 2007 年 1 月 3 日以来的数据?

library(quantmod)
getSymbols("AAPL")
chartSeries(AAPL, type="line", subset="last 15 years")

Warning message:
In last.xts(c(13.702, 13.346, 13.619, 13.65, 13.727, 15.045, 15.234,  :
  requested length is greater than original

chartSeries(AAPL, type="line", subset="last 11 years") # this works

您需要将 from 设置为默认值 2007-01-01 以外的值。

library(quantmod)
getSymbols("AAPL", from = "1990-01-01")
chartSeries(AAPL, type="line", subset="last 15 years")