Noobie这里的家伙所以请温柔:)
我正在尝试使用quantmod从所有新西兰上市股票中加载yahoo finance的数据。以下是我所拥有的。但是当我试图向内看时,显然数据丢失了。我做错了什么?
library(TTR)
library(quantmod)
install.packages("PerformanceAnalytics")
library(PerformanceAnalytics)
#Make a new environment for quantmod to store data in
stockData <- new.env()
#Specify period of time we are interested in
startDate = as.Date("2009-01-01")
endDate = as.Date("2014-01-30")
#Define the tickers we are interested in
tickers <- > c("ABA.NZ","ACY.NZ","AIA.NZ","AIR.NZ","ALF.NZ","AOR.NZ","ARG.NZ","ATM.NZ","AUG.NZ","AWF.NZ","AWK.NZ","BGR.NZ","BLT.NZ","BRL.NZ","BRM.NZ","CAV.NZ","CDI.NZ","CEN.NZ","CMO.NZ","CNU.NZ","CVT.NZ","DGL.NZ","DIL.NZ","DNZ.NZ","DPC.NZ","EBO.NZ","FBU.NZ","FIN.NZ","FPH.NZ","FRE.NZ","FSF.NZ","GMT.NZ","GXH.NZ","HBY.NZ","HLG.NZ","HNZ.NZ","IFT.NZ","KFL.NZ","KIP.NZ","KMD.NZ","KRK.NZ","LPC.NZ","MCK.NZ","MELCA.NZ","MET.NZ","MFT.NZ","MGL.NZ","MHI.NZ","MLN.NZ","MOA.NZ","MOW.NZ","MRP.NZ","MVN.NZ","NPT.NZ","NPX.NZ","NTL.NZ","NWF.NZ","NZF.NZ","NZO.NZ","NZR.NZ","NZX.NZ","OIC.NZ","PCT.NZ","PEB.NZ","PFI.NZ","PGC.NZ","PGW.NZ","PIL.NZ","POT.NZ","PPG.NZ","PPL.NZ","RAK.NZ","RBC.NZ","RBD.NZ","RNS.NZ","RYM.NZ","SAN.NZ","SCT.NZ","SCY.NZ","SEA.NZ","SEK.NZ","SKC.NZ","SKL.NZ","SKT.NZ","SLG.NZ","SLI.NZ","SML.NZ","SPN.NZ","SPY.NZ","STU.NZ","SUM.NZ","TEN.NZ","THL.NZ","TIL.NZ","TME.NZ","TPW.NZ","TRS.NZ","TTK.NZ","TUA.NZ","TUR.NZ","TWR.NZ","VCT.NZ","VHP.NZ","VIL.NZ","WDT.NZ","WHS.NZ","WYN.NZ","XRO.NZ","ZEL.NZ")
#Download the stock history (for all tickers)
sdata <- getSymbols(tickers, env = stockData, src = "yahoo", from = startDate, to = endDate)
stockinf <- stockData$sdata
head(stockinf)
答案 0 :(得分:0)
检索到的符号位于stockData
环境中。默认情况下,getSymbols
仅返回自动收报机名称并将对象保存在指定的环境中。
sdata
## [1] "ABA.NZ"
ls(stockData)
## [1] "ABA.NZ"
head(stockData$ABA.NZ)
## ABA.NZ.Open ABA.NZ.High ABA.NZ.Low ABA.NZ.Close ABA.NZ.Volume ABA.NZ.Adjusted
## 2009-01-01 4.55 4.55 4.55 4.55 0 3.73
## 2009-01-02 4.55 4.55 4.55 4.55 0 3.73
## 2009-01-05 4.52 4.52 4.52 4.52 0 3.70
## 2009-01-06 5.05 5.05 5.05 5.05 9000 4.14
## 2009-01-07 4.66 4.66 4.66 4.66 300 3.82
## 2009-01-08 4.67 4.67 4.67 4.67 0 3.83