- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的代码没有给我预期的输出。
我将股票市场数据切成 30 分钟。预期输出:
Date open high low close totalVolume totalTraded
但实际输出:
Date open high low close totalVolume
我的数据的最后一列没有显示在最终输出中。 TotalTraded 为交易总量:Volume*Price
我已将代码与数据集一起包含在内。
谢谢你的帮助。
我的代码:
#load data
data1<-read.table("EKSO.txt",header=T,sep=",",stringsAsFactors=F)
#Change the name the column Size to Volume
colnames(data1)[4]<-"Volume"
#calculate total traded
data1["TT"]<-data1$Price*data1$Volume
#combine and convert date and time
data1$Date <- strptime(paste(data1$Date, data1$Time), "%m/%d/%Y %H:%M:%S")
#remove Time columns
data1<-data1[-2]
#load xts and zoo library
library(xts)
library(zoo)
#create an xts object
myxts<-xts(data1[,2:4],order.by=as.POSIXct(data1[,1]))
#slice dataset by 30 minutes interval
myxts30<-to.period(myxts,'minutes',30)
实际输出:
> head(myxts30)
myxts.Open myxts.High myxts.Low myxts.Close myxts.Volume
2014-02-07 09:42:11 3.00 3.20 3.00 3.2 80422014-02-07 10:07:33 3.00 3.20 3.00 3.2 72472014-02-07 10:54:13 3.24 3.40 3.24 3.4 37002014-02-07 11:29:58 3.35 3.35 3.10 3.1 35832014-02-07 11:55:11 3.19 3.20 3.15 3.2 17602014-02-07 12:17:32 3.20 3.20 3.20 3.2 1500
数据集:
Date,Time,Price,Size
02/07/2014,09:30:01,3,500
02/07/2014,09:30:29,3,42
02/07/2014,09:35:56,3,100
02/07/2014,09:37:17,3,100
02/07/2014,09:37:28,3.2,900
02/07/2014,09:37:35,3.2,4900
02/07/2014,09:37:51,3.2,1000
02/07/2014,09:42:11,3.2,500
02/07/2014,10:00:31,3,2400
02/07/2014,10:00:37,3.2,500
02/07/2014,10:00:44,3.2,3347
02/07/2014,10:07:33,3.2,1000
02/07/2014,10:31:42,3.24,1000
02/07/2014,10:33:44,3.24,200
02/07/2014,10:40:28,3.25,300
02/07/2014,10:49:57,3.25,600
02/07/2014,10:53:16,3.25,100
02/07/2014,10:53:32,3.4,1000
02/07/2014,10:54:13,3.4,500
02/07/2014,11:05:37,3.35,1000
02/07/2014,11:11:29,3.25,600
02/07/2014,11:15:26,3.3,60
02/07/2014,11:19:16,3.3,23
02/07/2014,11:21:14,3.25,100
02/07/2014,11:21:22,3.25,100
02/07/2014,11:21:30,3.2,500
02/07/2014,11:21:35,3.2,500
02/07/2014,11:21:43,3.2,500
02/07/2014,11:29:58,3.1,200
02/07/2014,11:35:42,3.19,360
02/07/2014,11:39:51,3.19,1000
02/07/2014,11:52:39,3.15,200
02/07/2014,11:53:51,3.15,100
02/07/2014,11:55:11,3.2,100
02/07/2014,12:17:32,3.2,1500
02/07/2014,12:35:42,3.24,1200
02/07/2014,12:37:53,3.24,100
02/07/2014,12:38:02,3.24,3500
02/07/2014,12:53:57,3.24,400
02/07/2014,13:10:57,3.239,100
02/07/2014,13:11:35,3.24,800
02/07/2014,13:13:41,3.24,1000
02/07/2014,13:39:40,3.24,450
02/07/2014,13:56:04,3.24,500
02/07/2014,14:09:49,3.24,600
02/07/2014,14:11:25,3.24,1000
02/07/2014,14:25:53,3.24,25
02/07/2014,14:30:58,3.24,30
02/07/2014,14:31:36,3.24,30
02/07/2014,14:32:12,3.24,30
02/07/2014,14:33:00,3.24,100
02/07/2014,14:34:49,3.24,1100
02/07/2014,14:36:02,3.24,2000
02/07/2014,14:37:07,3.22,1500
02/07/2014,14:42:30,3.22,3300
02/07/2014,14:42:46,3.22,100
02/07/2014,14:42:54,3.2,1000
02/07/2014,14:53:13,3.23,240
02/07/2014,14:53:27,3.24,500
02/07/2014,14:53:59,3.24,60
02/07/2014,14:54:46,3.2,1500
02/07/2014,14:57:45,3.2,160
02/07/2014,14:57:46,3.2,125
02/07/2014,14:57:54,3.2,100
02/07/2014,15:05:56,3.19,100
02/07/2014,15:22:21,3.19,300
02/07/2014,15:22:28,3.18,150
02/07/2014,15:23:09,3.19,2000
02/07/2014,15:35:23,3.18,1500
02/07/2014,15:44:36,3.18,600
02/10/2014,09:30:02,3.25,100
02/10/2014,09:30:02,3.25,25
02/10/2014,09:30:24,3.25,150
02/10/2014,09:30:40,3.25,100
02/10/2014,09:31:11,3.25,650
02/10/2014,09:35:32,3.24,200
02/10/2014,09:37:59,3.19,100
02/10/2014,09:38:01,3.2,2000
02/10/2014,09:38:09,3.18,185
02/10/2014,09:38:36,3.18,500
02/10/2014,09:39:13,3.18,1042
02/10/2014,09:39:18,3.18,156
02/10/2014,09:39:18,3.17,20
02/10/2014,09:41:24,3.15,100
02/10/2014,09:42:28,3.15,1000
02/10/2014,09:42:28,3.15,1000
02/10/2014,09:42:41,3.15,500
02/10/2014,09:42:57,3.15,100
02/10/2014,09:43:24,3.12,500
02/10/2014,09:43:29,3.12,100
02/10/2014,09:43:32,3.1,5000
02/10/2014,09:44:02,3.1,500
02/10/2014,09:44:19,3.1,500
02/10/2014,09:44:22,3.09,100
02/10/2014,09:44:22,3.09,96
02/10/2014,09:44:55,3.05,100
02/10/2014,09:45:11,3.05,676
02/10/2014,09:45:23,3,150
02/10/2014,09:45:44,2.95,1000
02/10/2014,09:45:53,2.95,1500
02/10/2014,09:47:17,2.95,100
02/10/2014,09:47:46,2.9,100
02/10/2014,09:48:24,2.9,500
02/10/2014,09:48:50,2.9,100
02/10/2014,09:49:11,2.85,386
02/10/2014,09:49:13,2.85,100
02/10/2014,09:49:14,2.8,200
02/10/2014,09:49:15,2.7,100
02/10/2014,09:49:22,2.7,100
02/10/2014,09:49:32,2.7,100
02/10/2014,09:50:09,2.65,2500
02/10/2014,09:50:44,2.66,2500
02/10/2014,09:50:49,2.6,100
02/10/2014,09:50:53,2.7,240
02/10/2014,09:50:54,2.61,1000
02/10/2014,09:50:58,2.65,414
02/10/2014,09:55:24,2.95,100
02/10/2014,09:57:22,2.95,400
02/10/2014,10:07:21,2.95,400
02/10/2014,10:16:28,2.95,250
02/10/2014,10:21:20,2.85,300
02/10/2014,10:32:40,2.94,100
02/10/2014,10:33:18,2.95,426
02/10/2014,10:33:38,2.95,70
02/10/2014,10:33:39,2.94,1900
02/10/2014,10:43:46,2.95,4500
02/10/2014,10:44:00,2.99,200
02/10/2014,10:44:20,2.99,505
02/10/2014,10:49:30,2.96,500
02/10/2014,10:57:22,2.95,2500
02/10/2014,10:57:25,2.95,500
02/10/2014,10:57:40,2.95,500
02/10/2014,11:38:29,3,500
02/10/2014,11:38:35,3.05,500
02/10/2014,11:38:45,3.1,1000
02/10/2014,11:45:08,3.05,100
02/10/2014,11:49:55,3.01,100
02/10/2014,11:50:14,3,1900
02/10/2014,11:50:18,3,100
02/10/2014,12:07:51,3,1000
02/10/2014,12:33:26,3,400
02/10/2014,13:57:20,3.1,150
02/10/2014,13:57:34,3,42
02/10/2014,14:21:42,3.15,500
02/10/2014,14:23:35,3.15,1000
02/10/2014,14:25:40,3.05,200
02/10/2014,14:26:01,3.15,100
02/10/2014,14:50:50,3.15,100
02/10/2014,14:51:00,3.1,100
02/10/2014,14:51:09,3.1,100
02/10/2014,14:51:24,3.05,500
02/10/2014,14:51:43,3,100
02/10/2014,14:52:04,2.95,100
02/10/2014,14:52:15,2.99,25
02/10/2014,14:52:17,2.95,100
02/10/2014,14:52:33,2.9,500
02/10/2014,14:52:47,2.95,600
02/10/2014,14:52:49,2.85,100
02/10/2014,14:52:51,2.85,1000
02/10/2014,14:53:08,2.82,500
02/10/2014,14:53:24,2.85,500
02/10/2014,14:53:43,2.84,5400
02/10/2014,14:53:48,2.85,100
02/10/2014,15:00:48,2.99,64
02/10/2014,15:04:08,2.99,412
02/10/2014,15:11:42,2.99,100
02/10/2014,15:11:46,2.99,100
02/10/2014,15:12:06,2.99,100
02/10/2014,15:20:35,3.04,500
02/10/2014,15:30:28,3,500
02/10/2014,15:36:58,2.95,2000
02/10/2014,15:38:09,3,550
02/10/2014,15:39:48,2.97,2000
02/11/2014,09:30:04,3.2,100
02/11/2014,09:30:18,3.2,2000
02/11/2014,10:03:07,3.18,1000
02/11/2014,10:21:35,3.18,26
02/11/2014,10:27:09,3.15,500
02/11/2014,10:37:22,3.15,1108
02/11/2014,10:37:22,3.15,1054
02/11/2014,10:37:23,3.1,100
02/11/2014,10:42:26,3.05,1000
02/11/2014,10:42:57,3.02,1000
02/11/2014,10:43:29,3.02,1000
02/11/2014,10:48:27,3.02,100
02/11/2014,10:50:36,3.01,1000
02/11/2014,10:51:33,3.01,1000
02/11/2014,10:51:43,3.01,1000
02/11/2014,10:52:17,3.01,1000
02/11/2014,10:53:55,3.01,500
02/11/2014,10:54:31,3.05,40
02/11/2014,10:55:41,3.01,100
02/11/2014,10:55:44,3,3300
02/11/2014,10:55:44,3,100
02/11/2014,10:55:44,3,5000
02/11/2014,10:55:44,3,230
02/11/2014,10:56:21,3,100
02/11/2014,11:01:20,3,100
02/11/2014,11:01:21,3,50
02/11/2014,11:17:30,2.99,600
02/11/2014,11:17:34,3,500
02/11/2014,11:18:49,2.99,3000
02/11/2014,11:25:55,3.03,500
02/11/2014,11:29:59,2.99,400
02/11/2014,11:30:08,2.99,100
02/11/2014,11:30:18,2.99,100
02/11/2014,11:30:46,2.99,200
02/11/2014,11:38:48,2.95,100
02/11/2014,11:44:55,2.98,325
02/11/2014,12:32:09,3,500
02/11/2014,12:32:55,3,50
02/11/2014,13:15:49,3.1,1000
02/11/2014,14:16:16,3.05,350
02/11/2014,14:29:12,2.99,650
02/11/2014,14:32:23,2.99,335
02/11/2014,14:32:29,2.99,500
02/11/2014,15:25:01,3,1000
02/11/2014,15:49:37,3,500
02/11/2014,15:51:08,2.98,300
02/12/2014,08:46:23,3,1500
02/12/2014,09:10:01,3,2000
02/12/2014,09:21:31,3.1,1500
02/12/2014,09:26:33,3.2,2000
02/12/2014,09:27:58,3.2,2500
02/12/2014,09:30:00,3.2,2000
02/12/2014,09:30:00,3.2,10000
02/12/2014,09:30:01,3.2,500
02/12/2014,09:30:02,3.2,30
02/12/2014,09:30:18,3.2,30
02/12/2014,09:40:51,3.05,100
02/12/2014,09:40:52,3.05,1250
02/12/2014,09:41:01,3.05,806
02/12/2014,09:41:11,3,100
02/12/2014,09:43:48,2.98,1000
02/12/2014,09:44:22,3,4000
02/12/2014,09:44:27,2.98,1000
02/12/2014,09:44:31,2.98,2900
02/12/2014,09:47:43,2.98,110
02/12/2014,09:50:49,2.96,100
02/12/2014,09:50:51,2.8,750
02/12/2014,09:51:11,2.95,100
02/12/2014,09:55:35,2.95,1050
02/12/2014,09:55:56,2.95,100
02/12/2014,09:56:29,3,100
02/12/2014,09:56:43,3,100
02/12/2014,09:57:33,3.05,100
02/12/2014,10:04:50,2.85,2073
02/12/2014,10:09:33,3,500
02/12/2014,10:10:57,3.05,1000
02/12/2014,10:14:16,3.015,1500
02/12/2014,10:15:30,3,100
02/12/2014,10:15:38,2.85,2567
02/12/2014,10:27:05,2.85,2000
02/12/2014,11:02:02,2.9,32
02/12/2014,11:02:50,2.9,200
02/12/2014,11:03:14,2.89,100
02/12/2014,11:07:02,2.9,5000
02/12/2014,11:19:11,2.88,200
02/12/2014,11:19:31,2.88,1000
02/12/2014,11:19:36,2.8,1000
02/12/2014,11:19:40,2.8,1000
02/12/2014,11:19:40,2.86,100
02/12/2014,11:19:48,2.81,100
02/12/2014,11:20:04,2.8,1000
02/12/2014,11:20:05,2.8,1000
02/12/2014,11:20:22,2.76,100
02/12/2014,11:20:25,2.76,100
02/12/2014,11:22:32,2.86,1000
02/12/2014,11:31:36,2.85,1000
02/12/2014,11:42:08,2.85,10000
02/12/2014,11:59:29,2.86,1000
02/12/2014,12:01:34,2.86,1500
02/12/2014,12:01:45,2.85,1500
02/12/2014,12:12:42,2.86,1500
02/12/2014,12:30:57,2.9,400
02/12/2014,12:36:53,2.88,5000
02/12/2014,13:00:25,2.9,500
02/12/2014,15:26:05,3,1000
02/12/2014,15:36:19,3,1800
02/12/2014,15:36:27,3,12260
02/12/2014,15:39:15,3,200
02/12/2014,15:48:51,3,100
02/12/2014,15:48:53,3,500
02/13/2014,09:30:02,3,30
02/13/2014,09:34:31,3,100
02/13/2014,09:34:56,3,100
02/13/2014,09:47:57,2.9,1000
02/13/2014,09:51:42,2.91,3000
02/13/2014,09:59:59,2.92,500
02/13/2014,10:01:48,2.91,1000
02/13/2014,10:08:39,2.92,500
02/13/2014,11:05:38,3,100
02/13/2014,11:12:53,3,100
02/13/2014,11:14:56,3,1000
02/13/2014,11:17:59,3,772
02/13/2014,11:18:07,3,100
02/13/2014,11:18:10,3,500
02/13/2014,11:18:11,2.92,4000
02/13/2014,12:46:55,2.92,500
02/13/2014,13:58:38,3,6128
02/13/2014,14:02:03,3,1000
02/13/2014,14:30:38,3,3500
02/13/2014,14:58:47,3.05,500
02/13/2014,15:10:13,3,100
02/13/2014,15:10:18,3,300
02/13/2014,15:10:18,3,300
02/13/2014,15:10:20,3,10
02/13/2014,15:10:20,3,72
02/13/2014,15:33:25,3,27
02/13/2014,15:39:31,2.85,1000
02/13/2014,15:40:46,3,191
02/13/2014,15:41:06,3,100
02/14/2014,09:36:10,3,2200
02/14/2014,09:38:31,3.05,100
02/14/2014,09:42:42,3.15,350
02/14/2014,09:50:56,3.15,100
02/14/2014,09:50:57,3.2,100
02/14/2014,09:51:02,3.2,1532
02/14/2014,09:58:04,3.24,100
02/14/2014,09:58:09,3.24,1000
02/14/2014,09:58:27,3.24,100
02/14/2014,09:58:29,3.25,100
02/14/2014,09:58:31,3.25,4674
02/14/2014,09:59:17,3.29,1000
02/14/2014,09:59:28,3.25,50
02/14/2014,09:59:31,3.29,1000
02/14/2014,09:59:58,3.29,100
02/14/2014,10:00:02,3.3,3300
02/14/2014,10:02:48,3.35,10
02/14/2014,10:04:54,3.35,100
02/14/2014,10:05:05,3.3,500
02/14/2014,10:05:21,3.4,1000
02/14/2014,10:06:05,3.44,1000
02/14/2014,10:06:19,3.44,1000
02/14/2014,10:06:23,3.45,1000
02/14/2014,10:09:52,3.49,500
02/14/2014,10:10:13,3.47,300
02/14/2014,10:10:32,3.45,100
02/14/2014,10:10:33,3.4,1530
02/14/2014,10:12:49,3.26,500
02/14/2014,10:12:57,3.26,4400
02/14/2014,10:18:09,3.3,303
02/14/2014,10:20:06,3.3,400
02/14/2014,10:23:23,3.22,250
02/14/2014,10:23:37,3.24,2000
02/14/2014,10:23:38,3.22,500
02/14/2014,10:23:43,3.24,400
02/14/2014,10:23:50,3.2,1500
02/14/2014,10:24:08,3.2,100
02/14/2014,10:24:36,3.15,300
02/14/2014,10:25:08,3.14,50
02/14/2014,10:26:25,3.1,150
02/14/2014,10:27:48,3.15,1000
02/14/2014,10:27:54,3.1,100
02/14/2014,10:27:54,3.06,200
02/14/2014,10:27:58,3,100
02/14/2014,10:28:09,3,300
02/14/2014,10:28:29,2.95,100
02/14/2014,10:28:41,2.95,100
02/14/2014,10:29:19,2.85,350
02/14/2014,10:29:31,2.8,1077
02/14/2014,10:38:21,2.9,100
02/14/2014,11:01:07,2.95,1500
02/14/2014,11:13:54,2.99,2000
02/14/2014,11:15:14,2.99,1000
02/14/2014,11:44:57,2.95,500
02/14/2014,11:45:07,2.91,100
02/14/2014,11:45:18,2.9,5100
02/14/2014,11:45:29,2.86,3000
02/14/2014,11:45:48,2.86,1000
02/14/2014,11:49:44,2.9,700
02/14/2014,13:15:36,2.9,2000
02/14/2014,14:32:36,2.9,500
02/14/2014,14:32:39,2.89,200
02/14/2014,14:35:37,2.95,100
02/14/2014,14:35:41,2.95,100
02/14/2014,14:35:58,2.95,100
02/14/2014,14:35:58,2.95,73
02/14/2014,14:52:46,2.92,3000
02/14/2014,15:12:38,2.99,650
02/14/2014,15:13:22,2.9,1000
02/14/2014,15:41:52,3,3000
02/14/2014,15:47:11,2.95,100
02/14/2014,15:47:20,2.9,100
02/14/2014,15:47:24,2.9,1000
02/14/2014,15:47:28,2.89,1000
02/14/2014,15:47:35,2.88,300
02/14/2014,15:48:05,2.85,1000
02/14/2014,15:51:44,2.85,2000
02/18/2014,09:29:21,3.1,1000
02/18/2014,09:30:01,3.25,500
02/18/2014,09:30:46,3.25,1000
02/18/2014,09:30:57,3.1,100
02/18/2014,09:31:16,3.25,1500
02/18/2014,09:32:43,3.25,1000
02/18/2014,09:33:22,3.25,2620
02/18/2014,09:34:04,3.1,200
02/18/2014,09:34:12,3.05,100
02/18/2014,09:34:42,3.05,100
02/18/2014,09:51:08,2.95,100
02/18/2014,09:51:23,2.95,100
02/18/2014,09:52:56,2.9,1000
02/18/2014,09:53:27,2.9,100
02/18/2014,09:53:37,2.9,900
02/18/2014,09:58:02,2.92,1000
02/18/2014,09:59:29,2.92,100
02/18/2014,10:00:01,2.92,100
02/18/2014,10:00:08,2.92,100
02/18/2014,10:00:34,2.92,100
02/18/2014,10:00:37,2.95,2000
02/18/2014,10:00:37,2.95,100
02/18/2014,10:00:37,2.95,3500
02/18/2014,10:00:45,2.92,100
02/18/2014,10:01:34,2.9,100
02/18/2014,10:03:58,2.92,150
02/18/2014,10:04:39,2.95,1500
02/18/2014,10:04:41,2.92,100
02/18/2014,10:11:35,2.92,350
02/18/2014,10:15:04,2.92,100
02/18/2014,10:15:06,2.92,900
02/18/2014,10:20:41,2.92,100
02/18/2014,10:21:02,2.9,1000
02/18/2014,10:21:22,2.9,1000
02/18/2014,10:28:02,2.95,500
02/18/2014,10:33:05,2.95,200
02/18/2014,10:41:41,2.95,300
02/18/2014,10:42:33,2.99,130
02/18/2014,10:49:03,2.92,340
02/18/2014,10:49:04,2.95,2000
02/18/2014,10:53:34,2.9,1000
02/18/2014,10:53:37,2.9,3660
02/18/2014,10:53:53,2.9,100
02/18/2014,10:53:58,2.89,1000
02/18/2014,10:54:06,2.85,3000
02/18/2014,10:54:08,2.85,500
02/18/2014,10:54:10,2.85,100
02/18/2014,10:54:33,2.85,100
02/18/2014,10:55:00,2.894,100
02/18/2014,10:55:04,2.9,900
02/18/2014,11:04:31,2.9,3500
02/18/2014,11:10:05,2.9,200
02/18/2014,11:11:08,2.9,100
02/18/2014,11:18:37,2.93,1000
02/18/2014,11:24:51,2.93,500
02/18/2014,11:35:00,2.93,5000
02/18/2014,11:48:00,2.91,5000
02/18/2014,11:53:04,2.94,2500
02/18/2014,11:54:35,2.94,2500
02/18/2014,11:58:40,2.95,2000
02/18/2014,12:03:45,3,1333
02/18/2014,12:07:17,3,100
02/18/2014,12:15:41,2.94,100
02/18/2014,12:15:55,2.93,2900
02/18/2014,12:18:40,2.95,1800
02/18/2014,12:19:01,2.99,250
02/18/2014,12:19:18,2.92,3200
02/18/2014,12:27:55,2.99,200
02/18/2014,12:44:24,2.99,1000
02/18/2014,12:44:57,2.99,500
02/18/2014,12:53:41,3.05,1000
02/18/2014,12:54:22,2.99,320
02/18/2014,12:54:34,2.99,100
02/18/2014,13:06:06,2.99,1000
02/18/2014,13:16:41,2.92,1000
02/18/2014,13:22:07,2.99,88
02/18/2014,13:31:57,3,10
02/18/2014,13:38:23,3,500
02/18/2014,13:47:55,3,125
02/18/2014,13:56:42,3,1365
02/18/2014,13:57:06,3,100
02/18/2014,13:57:40,3.05,100
02/18/2014,13:57:49,3.06,1200
02/18/2014,13:59:37,3.2,500
02/18/2014,14:01:01,3.2,400
02/18/2014,14:01:18,3.15,100
02/18/2014,14:01:49,3.16,1000
02/18/2014,14:02:03,3.16,2500
02/18/2014,14:02:06,3.15,1000
02/18/2014,14:03:59,3.24,1000
02/18/2014,14:05:42,3.18,200
02/18/2014,14:06:24,3.24,1000
02/18/2014,14:08:26,3.24,1800
02/18/2014,14:09:41,3.2,800
02/18/2014,14:09:41,3.2,500
02/18/2014,14:09:46,3.18,600
02/18/2014,14:09:58,3.15,100
02/18/2014,14:11:06,3.1,3000
02/18/2014,14:11:09,3.15,82
02/18/2014,14:11:59,3.1,400
02/18/2014,14:12:37,3.01,1000
02/18/2014,14:25:13,3.15,100
02/18/2014,14:25:21,3.15,100
02/18/2014,14:25:34,3.2,50
02/18/2014,14:25:50,3.2,100
02/18/2014,14:27:20,3.2,100
02/18/2014,14:28:10,3.2,300
02/18/2014,14:29:47,3.2,100
02/18/2014,14:31:39,3.21,1000
02/18/2014,14:31:43,3.24,100
02/18/2014,14:32:53,3.25,100
02/18/2014,14:33:30,3.24,700
02/18/2014,14:34:36,3.2,400
02/18/2014,14:34:46,3.1,295
02/18/2014,14:34:53,3.05,100
02/18/2014,14:35:09,3.02,1000
02/18/2014,14:35:29,3.05,150
02/18/2014,14:37:02,3.05,327
02/18/2014,14:37:26,3.05,4423
02/18/2014,14:37:41,3.1,305
02/18/2014,14:44:08,3.15,100
02/18/2014,14:44:09,3.24,900
02/18/2014,14:46:11,3.24,200
02/18/2014,14:46:32,3.1,500
02/18/2014,14:46:44,3.1,500
02/18/2014,14:51:05,3.2,200
02/18/2014,14:52:27,3.15,100
02/18/2014,14:52:49,3.11,500
02/18/2014,14:53:00,3.1,100
02/18/2014,14:53:59,3.07,100
02/18/2014,14:54:01,3.07,300
02/18/2014,14:54:05,3.05,500
02/18/2014,14:54:07,3.05,40
02/18/2014,14:55:12,3.05,100
02/18/2014,14:57:35,3.05,100
02/18/2014,15:01:09,3.05,250
02/18/2014,15:09:00,3.05,1000
02/18/2014,15:11:51,3.05,2610
02/18/2014,15:14:18,3.1,1000
02/18/2014,15:21:54,3.1,500
02/18/2014,15:22:02,3.1,161
02/18/2014,15:30:10,3.1,1000
02/18/2014,15:31:22,3.1,100
02/18/2014,15:32:08,3.1,500
02/18/2014,15:34:01,3.1,1600
02/18/2014,15:34:15,3.1,75
02/18/2014,15:34:23,3.1,100
02/18/2014,15:34:54,3.14,900
02/18/2014,15:40:50,3.23,100
02/18/2014,15:41:07,3.23,30
02/18/2014,15:46:42,3.15,1000
02/18/2014,15:51:54,3.15,100
02/18/2014,15:52:13,3.15,500
02/18/2014,15:53:06,3.15,900
02/18/2014,15:53:51,3.15,2200
02/18/2014,15:54:42,3.15,500
02/18/2014,15:54:45,3.14,100
02/18/2014,15:54:52,3.14,100
02/18/2014,15:55:34,3.15,25
02/18/2014,15:56:26,3.05,100
02/18/2014,15:56:28,3,10125
02/18/2014,15:56:56,3.01,500
02/18/2014,15:57:05,3.01,500
02/18/2014,15:57:05,3.01,500
02/18/2014,15:57:05,3.01,1000
02/18/2014,15:57:12,3,1000
02/18/2014,15:57:12,3,2500
02/18/2014,15:59:06,3,200
02/18/2014,16:03:16,3.01,675
02/19/2014,09:30:01,3.01,50
02/19/2014,09:30:01,3.01,500
02/19/2014,09:30:33,3.01,100
02/19/2014,09:30:53,3.01,100
02/19/2014,09:30:54,3.01,100
02/19/2014,09:31:44,3.3,50
02/19/2014,09:31:46,3.3,100
02/19/2014,09:31:47,3.3,100
02/19/2014,09:32:51,3.25,800
02/19/2014,09:33:23,3.25,200
02/19/2014,09:33:24,3.29,200
02/19/2014,09:33:26,3.29,800
02/19/2014,09:33:28,3.3,200
02/19/2014,09:33:28,3.3,175
02/19/2014,09:33:57,3.3,200
02/19/2014,09:34:33,3.3,300
02/19/2014,09:36:24,3.24,50
02/19/2014,09:37:50,3.2,600
02/19/2014,09:38:05,3.1,4000
02/19/2014,09:38:51,3.19,700
02/19/2014,09:40:33,3.19,100
02/19/2014,09:40:42,3.19,200
02/19/2014,09:40:49,3.19,1300
02/19/2014,09:41:31,3.15,1500
02/19/2014,09:42:36,3.2,50
02/19/2014,09:45:50,3.15,1000
02/19/2014,09:49:55,3.11,4000
02/19/2014,09:53:22,3.1,800
02/19/2014,09:53:28,3.1,100
02/19/2014,09:54:17,3.14,30
02/19/2014,09:54:17,3.14,1000
02/19/2014,09:54:19,3.1,100
02/19/2014,09:54:19,3.1,2000
02/19/2014,09:56:27,3.14,1000
02/19/2014,10:03:48,3.15,100
02/19/2014,10:03:55,3.2,1487
02/19/2014,10:13:26,3.2,500
02/19/2014,10:13:34,3.25,50
02/19/2014,10:13:34,3.25,200
02/19/2014,10:13:35,3.25,350
02/19/2014,10:13:35,3.25,560
02/19/2014,10:14:26,3.25,1500
02/19/2014,10:15:13,3.25,1500
02/19/2014,10:15:21,3.25,300
02/19/2014,10:15:54,3.25,1300
02/19/2014,10:17:46,3.25,849
02/19/2014,10:22:01,3.25,2000
02/19/2014,10:22:49,3.28,100
02/19/2014,10:25:31,3.28,400
02/19/2014,10:33:12,3.2,500
02/19/2014,10:33:53,3.25,1000
02/19/2014,10:34:30,3.24,42
02/19/2014,10:34:50,3.2,100
02/19/2014,10:34:54,3.18,44
02/19/2014,10:34:54,3.18,100
02/19/2014,10:36:33,3.22,660
02/19/2014,10:41:47,3.2,325
02/19/2014,10:46:23,3.23,200
02/19/2014,10:46:57,3.23,200
02/19/2014,10:59:17,3.2,150
02/19/2014,10:59:23,3.17,300
02/19/2014,10:59:30,3.18,1000
02/19/2014,10:59:31,3.16,550
02/19/2014,11:00:30,3.22,100
02/19/2014,11:03:08,3.2,700
02/19/2014,11:05:06,3.2,100
02/19/2014,11:06:01,3.2,100
02/19/2014,11:06:35,3.19,900
02/19/2014,11:15:14,3.19,100
02/19/2014,11:15:21,3.15,2000
02/19/2014,11:15:25,3.13,1000
02/19/2014,11:15:27,3.22,100
02/19/2014,11:15:49,3.2,100
02/19/2014,11:15:59,3.27,1000
02/19/2014,11:16:00,3.27,1000
02/19/2014,11:16:26,3.23,400
02/19/2014,11:17:06,3.25,100
02/19/2014,11:17:10,3.17,1500
02/19/2014,11:18:38,3.25,14900
02/19/2014,11:19:08,3.27,500
02/19/2014,11:20:26,3.27,1200
02/19/2014,11:21:06,3.27,100
02/19/2014,11:21:09,3.28,630
02/19/2014,11:21:26,3.29,500
02/19/2014,11:29:29,3.25,100
02/19/2014,11:29:39,3.25,100
02/19/2014,11:29:45,3.2,800
02/19/2014,11:41:14,3.24,75
02/19/2014,11:59:44,3.24,1000
02/19/2014,12:01:09,3.2,5000
02/19/2014,12:06:50,3.24,310
02/19/2014,12:12:47,3.24,5000
02/19/2014,12:12:53,3.24,50
02/19/2014,12:13:17,3.24,2500
02/19/2014,12:13:39,3.24,5000
02/19/2014,12:14:11,3.24,2500
02/19/2014,12:15:08,3.24,5300
02/19/2014,12:16:15,3.24,250
02/19/2014,12:20:09,3.25,1000
02/19/2014,12:20:10,3.29,500
02/19/2014,12:20:40,3.29,4000
02/19/2014,12:20:57,3.29,100
02/19/2014,12:20:59,3.3,700
02/19/2014,12:21:32,3.33,500
02/19/2014,12:22:08,3.35,100
02/19/2014,12:22:12,3.34,1054
02/19/2014,12:22:15,3.39,3100
02/19/2014,12:29:13,3.39,100
02/19/2014,12:29:16,3.4,1000
02/19/2014,12:29:36,3.4,100
02/19/2014,12:29:39,3.39,200
02/19/2014,12:29:41,3.31,700
02/19/2014,12:32:42,3.4,100
02/19/2014,12:39:28,3.4,1000
02/19/2014,12:49:33,3.35,200
02/19/2014,12:49:40,3.4,5000
02/19/2014,12:50:00,3.35,1300
02/19/2014,12:52:14,3.4,150
02/19/2014,12:59:59,3.35,100
02/19/2014,13:00:05,3.35,100
02/19/2014,13:06:43,3.35,300
02/19/2014,13:07:14,3.35,10
02/19/2014,13:13:35,3.35,500
02/19/2014,13:22:55,3.35,40
02/19/2014,13:28:01,3.33,400
02/19/2014,13:33:00,3.33,95
02/19/2014,13:33:01,3.33,500
02/19/2014,13:33:25,3.32,100
02/19/2014,13:33:39,3.3,1000
02/19/2014,13:34:58,3.3,2000
02/19/2014,13:39:49,3.3,1050
02/19/2014,13:49:12,3.3,15
02/19/2014,13:51:59,3.3,500
02/19/2014,13:57:03,3.3,500
02/19/2014,13:58:11,3.3,100
02/19/2014,14:18:54,3.3,100
02/19/2014,14:21:53,3.3,500
02/19/2014,14:22:31,3.3,285
02/19/2014,14:22:33,3.3,2000
02/19/2014,14:25:18,3.27,100
02/19/2014,14:25:25,3.25,1000
02/19/2014,14:25:31,3.26,1530
02/19/2014,14:25:40,3.25,2000
02/19/2014,14:25:57,3.25,100
02/19/2014,14:26:10,3.23,100
02/19/2014,14:26:14,3.22,4700
02/19/2014,14:32:48,3.26,92
02/19/2014,14:34:38,3.26,100
02/19/2014,14:34:55,3.26,100
02/19/2014,14:40:19,3.22,1400
02/19/2014,14:42:56,3.26,100
02/19/2014,14:43:15,3.28,100
02/19/2014,14:55:49,3.28,100
02/19/2014,14:55:53,3.31,900
02/19/2014,15:10:20,3.27,1000
02/19/2014,15:10:51,3.31,2000
02/19/2014,15:11:45,3.25,1000
02/19/2014,15:29:55,3.3,100
02/19/2014,15:30:53,3.3,100
02/19/2014,15:42:49,3.3,100
02/19/2014,15:43:05,3.3,500
02/19/2014,15:44:39,3.3,2500
02/19/2014,15:47:23,3.3,1500
02/19/2014,15:47:52,3.3,100
02/19/2014,15:53:53,3.3,1000
02/19/2014,15:55:31,3.3,1400
02/20/2014,09:25:45,3.39,500
02/20/2014,09:27:03,3.39,500
02/20/2014,09:30:01,3.39,450
02/20/2014,09:30:01,3.39,200
02/20/2014,09:30:01,3.39,50
02/20/2014,09:30:04,3.39,100
02/20/2014,09:30:15,3.4,5
02/20/2014,09:30:15,3.4,200
02/20/2014,09:30:15,3.4,235
02/20/2014,09:30:15,3.4,100
02/20/2014,09:30:15,3.4,300
02/20/2014,09:30:15,3.4,60
02/20/2014,09:30:17,3.39,500
02/20/2014,09:30:17,3.39,515
02/20/2014,09:30:21,3.4,2950
02/20/2014,09:30:22,3.4,900
02/20/2014,09:33:10,3.46,500
02/20/2014,09:39:04,3.44,800
02/20/2014,09:39:57,3.46,100
02/20/2014,09:39:58,3.35,1900
02/20/2014,09:40:01,3.5,200
02/20/2014,09:40:12,3.5,1000
02/20/2014,09:40:20,3.54,200
02/20/2014,09:40:23,3.5,1000
02/20/2014,09:43:01,3.5,100
02/20/2014,09:43:19,3.5,250
02/20/2014,09:43:34,3.5,100
最佳答案
您可以向 to.period
传递一个 OHLC 对象(可选择具有 Volume 列),也可以向其传递单变量序列(也可选择具有 Volume 列)。
在 ?to.period
它说 x
应该是“单变量或 OHLC 类型的时间序列对象”
在注释部分它说
In order for this function to work properly on OHLC data, it is necessary that the Open, High, Low and Close columns be names (sic) as such
to.period
并不意味着非常灵活。如果您需要做的不仅仅是创建柱,您可以使用 period.apply
例如,
period.apply(myxts, endpoints(myxts, "minutes", 30), function(x) {
cbind(as.numeric(first(x$Price)),
as.numeric(max(x$Price)),
as.numeric(min(x$Price)),
as.numeric(last(x$Price)),
sum(x$Volume),
sum(x$TT))
})
但是,由于您使用与 Volume 相同的逻辑来计算 TT 列(即求和),您可以重命名列“Volume”并再次使用 to.period
并且然后合并结果。
myxts30<-to.period(myxts,'minutes',30)
cpy <- myxts$Price
cpy$Volume <- myxts$TT
myxts30$TT <- Vo(to.period(cpy, "minutes", 30))
关于R: 股票数据xts数据转换后少了一列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23481607/
我如何使用 apply 系列函数,比如 apply.daily到多元 XTS? 例如: 时间,a,b ... 2012-02-11 16:21:24 4.7258 7.7258 2012-02-11
我有一个 xts 对象列表,这些对象具有共同的索引和列名。 我想按索引进行 rbind 并对列进行平均: dts = seq.POSIXt(from = Sys.time() - days(2), t
我正在使用 xts 时间序列在 R 中工作。 我有什么: 具有不等间隔时间步长的时间序列数据集。 我想得到什么: 具有等距时间步长的时间序列,其值对应于与时间步长重叠的原始值的比例(请参见下面的示例)
this = structure(c(-0.012, -0.028, -0.044, -0.033, -0.039, -0.042), .Dim = c(3L, 2L), .Dimnames
在 xts 对象中是否有一种方法可以执行与下面相同的操作,但对于具有多天盘中数据的 xts 对象?下面的工作就像一个时钟,但一天的数据。如果我从 22 日到 26 日通过 xts,它不会。似乎不可能一
library(xts) set.seed(1) x = xts( cbind(a=1:10,b=20:11) , Sys.Date()+1:10 ) y = xts( runif(10) , Sys
con = gzcon(url('http://www.systematicportfolio.com/sit.gz', 'rb')) source(con) close(con) load.pack
我有一个 list 。列表由 5 个 xts 对象组成。每个对象由 5 个 xts 系列组成。每个系列包含 183 个观察值。我想从所有这些系列中提取一个公共(public)系列。我要减去的系列名为
在将 rowSums 传递给 xts 对象时,是否可以保留 xts 对象的索引? 目前,我将结果重新转换为 xts 对象,但是如果 rowSums 能够简单地返回它的内容,这似乎并没有那么快已通过。
首先让我说一下,我看了一下 ?xts,意识到这是一个与时区相关的问题,似乎已经解决了,但我不明白为什么 它正在发生。所以:我有一个简单的价格数据数据框。当我将它转换为 xts 对象时,xts 对象的第
当我尝试执行以下工作时发生错误: # generate random integrals # data <- xts(floor(runif(100, 1,101)),as.Date("1973-02
这是输出: library(tseries) # for adf.test function adf.test(data) Augmented Dickey-Fuller Test data: da
如何删除 xts 图右上角的日期范围?例如,在下面 xts 图的右上角,我想删除文本“2007-01-02/2007-06-30”。 library(xts) data(sample_matrix)
我有一个不规则的时间序列并且正在使用 xts的 endpoints 获取我的时间序列的每小时索引。 endpoints(data, on="hours") 我正在使用它以这种方式计算每小时 perio
申请 split函数到 xts对象来自 weeks将行分组为每周块。组中的默认天数是 Monday至 Sunday .想要群里的天数来自Sunday怎么办?至 Saturday ? library(x
我在删除 xts 对象中的重复行时遇到问题。我有一个 R 脚本,它将下载货币的刻度财务数据并将其转换为 OHLC 格式的 xts 对象。该脚本还会每 15 分钟提取一次新数据。新数据从今天的第一笔交易
我真的很难在这里找到解决方案。如果您查看最后一行代码,您会明白我想在下次开盘时买入并在 5 天后卖出 (x = 5)。 问题是 xts 索引正在计算周末。因此,例如,您会在 7 月 12 日星期五获得
我有 3 个 xts 对象,它们的标记都是“日期”对象: > a a 1995-01-03 1.76 1995-01-04 1.69
我正在尝试按天比较不同的时间序列。 目前典型的 XTS 对象如下所示: > vwap.crs QUANTITY QUANTITY.1 2014-03-03 13
我在列表中有一些数据,如下所示: > y $ABMD.Rank ABMD.Rank $ATVI.Rank ATVI.Rank $ADBE.Rank ADBE.Rank $
我是一名优秀的程序员,十分优秀!