R语言 批量下载财务报表
Posted amosding
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了R语言 批量下载财务报表相关的知识,希望对你有一定的参考价值。
getsheets <- function(symbol,type,file){ pre="http://money.finance.sina.com.cn/corp/go.php/vDOWN_"; mid="/displaytype/4/stockid/"; end="/ctrl/all.phtml"; if(type=="BS"){ url=paste(pre,"BalanceSheet",mid,symbol,end,sep=""); destfile=paste(file,"BS_",symbol,".xls",sep=""); } if(type=="PS"){ url=paste(pre,"ProfitStatement",mid,symbol,end,sep=""); destfile=paste(file,"PS_",symbol,".xls",sep=""); } if(type=="CF"){ url=paste(pre,"CashFlow",mid,symbol,end,sep=""); destfile=paste(file,"CF_",symbol,".xls",sep=""); } download.file(url, destfile); } c=c("600550","600192","600152","600644","600885","600151") for(i in 1:length(c)){ code=c[i] getsheets(code,"BS","D://dataset//") }
以上是关于R语言 批量下载财务报表的主要内容,如果未能解决你的问题,请参考以下文章