info=read.table("clipboard",header=T)
code=paste0(info[,1],".ss")
Z=paste0("A",1:length(code))
for(i in 1:length(code)){
name=code[i]
from=info[i,2]
setSymbolLookup(STOCK=list(name=name,src='yahoo'))
getSymbols("STOCK",from=from,to="2020-01-01")
assign(paste0(Z[i]),monthlyReturn(Cl(na.approx(STOCK))))
}
data=merge.xts(A1,A2,join="outer") weekprices=list()code=paste0(data[,1],".ss")Z=paste0("A",1:length(code))Z=paste0("A",data[,1])for(i in 1:length(code)){ name=code[i] from=data[i,2] setSymbolLookup(STOCK=list(name=name,src='yahoo')) getSymbols("STOCK",from=from,to="2020-01-01") assign(paste0(Z[i]),Cl(na.approx(STOCK))) weekprices[[i]]=Z[i]}
|