相似文件
换一批
经管之家送您一份
应届毕业生专属福利!
求职就业群
感谢您参与论坛问题回答
经管之家送您两个论坛币!
+2 论坛币
简单下载示例:
- cntrade(c('600000', '002024'), path ='D:/stock', start = 20150101, end = 20151106)
复制代码
可以配合读取csv文件,写入数据库 示例如下 - library(RMySQL)
- filenames <- dir()
- for (y in 1:length(filenames)){
- x <- read.table(filenames[y],header = T,sep = ",")
- names(x) <- c("date","stock_id","stock_name","close","high","low","open","pre_close","zde","zdf","hsl","volume","cjje","zsz","ltje")
- dbWriteTable(con,"day",x,row.names = F, overwrite=TRUE)
- file.remove(filenames[y])
- }
复制代码日线mysql数据库结构如下:
- DROP TABLE IF EXISTS `day`;
- CREATE TABLE `day` (
- `date` date DEFAULT NULL,
- `stock_id` char(10) DEFAULT NULL,
- `stock_name` char(50) DEFAULT NULL,
- `close` decimal(10,2) DEFAULT NULL,
- `high` decimal(10,2) DEFAULT NULL,
- `low` decimal(10,2) DEFAULT NULL,
- `open` decimal(10,2) DEFAULT NULL,
- `pre_close` decimal(10,2) DEFAULT NULL,
- `zde` decimal(10,2) DEFAULT NULL,
- `zdf` decimal(10,2) DEFAULT NULL,
- `hsl` decimal(10,2) DEFAULT NULL,
- `volume` decimal(50,2) DEFAULT NULL,
- `cjje` decimal(50,2) DEFAULT NULL,
- `zsz` decimal(50,2) DEFAULT NULL,
- `ltje` decimal(50,2) DEFAULT NULL
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
复制代码
扫码加我 拉你入群
请注明:姓名-公司-职位
以便审核进群资格,未注明则拒绝
|