amosding

首先从上交所和深交所整理股票代码和上市时间,整理为下图:

上交所:产品-股票-股票列表-下载(http://www.sse.com.cn/assortment/stock/list/share/)

深交所:市场数据-股票-股票列表-下载(http://www.szse.cn/market/stock/list/index.html)

 

 然后获得全部股票数据

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]
}

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2021-05-24
  • 2021-04-19
  • 2022-01-24
  • 2021-06-07
猜你喜欢
  • 2021-06-15
  • 2021-08-23
  • 2021-08-21
  • 2021-11-28
  • 2021-08-15
  • 2022-12-23
  • 2021-12-26
相关资源
相似解决方案