1
我試圖使用quantmod::getSymbols
下載批量Oanda外匯數據。該幫助文件指出,每個請求只能下載500天的數據,而我會收到來自warnings()
的價值5年的數據上限警告。不過,我試圖創建一個從1997年開始下載數據的循環,直到這一天。這是我的代碼:創建循環以通過quantmod軟件包從Oanda下載10年數據
library(xts)
library(quantmod)
date_from = c("1996-01-01", "2001-01-02", "2005-01-03", "2009-01-03", "2013-01-04")
date_to = c("2001-01-01", "2005-01-02", "2009-01-03", "2013-01-03", "2016-01-04")
for (i in 1:5) {
getSymbols("EUR/AUD", src="oanda", from = dates_from[i], to = date_to[i])
forex = for (i=1) EURAUD else NULL
final_Dataset<- rbind(c(forex, EURAUD))
}
我應該執行哪些更改?
編輯1 我做了工作,但它是草率寫的。任何建議的更改將不勝感激。
date_from = c("1996-01-01", "2001-01-02", "2005-01-03", "2009-01-03", "2013-01-04")
date_to = c("2001-01-01", "2005-01-02", "2009-01-03", "2013-01-03", "2016-01-04")
forex = vector(mode = 'list', length = 5)
for (i in 1:5) {
getSymbols("EUR/AUD", src="oanda", from = dates_from[i], to = date_to[i])
forex[[i]] = EURAUD
}
EUR_AUD = Reduce(rbind,forex)
警告不正確。該限制已有500天的歷史[自2009-01-09](https://github.com/joshuaulrich/quantmod/commit/70e06d723eafb365c5830b79ab1298f7e103ebce) –
感謝您的評論。 – Greconomist