R语言-股票数据库(1)-股票上市日期
来源:互联网 发布:文化相对主义 知乎 编辑:程序博客网 时间:2024/04/29 04:51
############################################################################################################################################获取股票上市日期#######################################################################################################################################################案例参考地址:http://www.tuicool.com/articles/NFviyym#下载股票上市日期#download the listingdate of one securitylibrary(RCurl)######################################沪市################################################SH <- readLines("E:/.../数据源/沪市代码list.txt")#获取证券代码列表listing.date <- vector(length = length(SH))url.date1 <- "http://quotes.money.163.com/trade/lsjysj_"url.date2 <- ".html#01b07"#用时较久,耐心等待for (i in 1:length(SH)){ #解析网页,得到listingdate cat(i,'\n') #页面打印跟踪循环情况 url.date <- paste(url.date1, SH[i], url.date2, sep="") xx <- getURL(url.date) posi <- regexpr("上市日",xx) listing.date[i] <- substring(xx,posi[1]-13,posi[1]-4)}listing.date.tab <- data.frame(code=SH,listingdate=listing.date,stringsAsFactors=FALSE)#输出write.table(listing.date.tab,file="E:/.../数据源/沪市股票上市日.txt",sep="\t",quote=FALSE,row.name=FALSE)######################################深市################################################SZ <- readLines("E:/.../数据源/深市代码list.txt")#获取证券代码列表listing.date <- vector(length = length(SZ))url.date1 <- "http://quotes.money.163.com/trade/lsjysj_"url.date2 <- ".html#01b07"#用时较久,耐心等待for (i in 1:length(SZ)){ #解析网页,得到listingdate cat(i,'\n') #页面打印跟踪循环情况 url.date <- paste(url.date1, SZ[i], url.date2, sep="") xx <- getURL(url.date) posi <- regexpr("上市日",xx) listing.date[i] <- substring(xx,posi[1]-13,posi[1]-4)}listing.date.tab <- data.frame(code=SZ,listingdate=listing.date,stringsAsFactors=FALSE)#输出write.table(listing.date.tab,file="E:/.../数据源/深市股票上市日.txt",sep="\t",quote=FALSE,row.name=FALSE)
阅读全文
0 0
- R语言-股票数据库(1)-股票上市日期
- R语言--股票数据分析
- R语言-股票数据库(2)-股票日K线信息-未复权
- R语言-股票数据库(3)-股票日K线信息-前复权-Wind
- R语言-股票数据库(4)-股票行业和概念板块数据-Wind
- 证券基础--股票上市
- 量化交易系列--(1)R语言下载股票数据
- 用R语言分析股票指数变化
- R语言中创建股票走势图
- R语言学习笔记4:股票杂谈
- R语言获取历史股票数据
- R语言绘制股票K线图
- 证券基础--股票发行上市
- 股票
- 股票
- 股票
- 股票
- 股票
- 对象,基本类型的比较
- 进销存货物管理系统 论文
- 使用TCP协议的NAT穿透技术
- 蓝桥杯 分解质因数
- Codeforces 400D Dima And Bacteria 暴力+Floyd
- R语言-股票数据库(1)-股票上市日期
- 2014年上午卷错题知识点总结
- 怎样用hibernate实现分页和翻页功能
- ReactNative集成到原生项目
- like查询替换方式
- Echarts图表 饼图中间带文字解决某个值过小导致扇区太小影响交互
- 论文阅读:Dual Supervised Learning
- redis集群搭建笔记
- JS 事件优先级