这似乎应该是常见的事情,但我所有的搜索都会提出一半或未完成的答案。
我在csv中有一组数据。但是数据的设置是时间,价格,数量。为了正确分析我的数据,我需要OHLCV格式:打开,高,低,关闭,音量。
有没有人知道如何重新格式化为OHLCV?
time,price,volume,
7/18/10 0:09,0.04951,20,
7/18/10 4:43,0.05941,50.01,
7/18/10 18:48,0.0808,5,
7/18/10 22:44,0.08585,10,
7/18/10 23:00,0.08584,5,
7/18/10 23:00,0.08584,5,
7/19/10 4:53,0.0909,5,
7/19/10 17:24,0.09307,80,
7/19/10 18:03,0.08911,100,
7/19/10 18:07,0.08752,100,
7/19/10 18:12,0.09109,90,
7/19/10 21:44,0.08416,20,
7/19/10 21:55,0.07921,100,
7/19/10 21:56,0.07921,10,
7/19/10 21:57,0.07723,20,
7/19/10 22:02,0.0808,49
7/20/10 3:36,0.08181,100
7/20/10 4:54,0.0818,12
7/20/10 13:48,0.08119,4
7/20/10 13:50,0.07921,10
7/20/10 15:37,0.07822,10
7/20/10 15:39,0.07723,10
7/20/10 16:01,0.07624,10
7/20/10 18:08,0.07723,10
7/20/10 18:09,0.07723,10
7/20/10 18:09,0.07723,20
7/20/10 21:09,0.07426,4.5
7/20/10 21:38,0.07426,5.5
7/20/10 21:38,0.07426,4.5
7/20/10 21:41,0.07426,45.5
7/20/10 22:24,0.07472,3
7/20/10 22:28,0.07472,1
7/20/10 22:29,0.07474,1
7/20/10 22:29,0.07474,1
7/21/10 3:27,0.07425,60
7/21/10 3:30,0.07327,10
7/21/10 3:41,0.07228,10
7/21/10 3:41,0.07129,10
7/21/10 15:11,0.0703,10
7/21/10 15:45,0.06931,10
7/21/10 15:56,0.06832,10
7/21/10 19:58,0.06733,10
7/21/10 20:26,0.06634,10
7/21/10 20:35,0.06634,70
7/22/10 0:02,0.07171,100
7/22/10 0:02,0.07171,10
7/22/10 0:02,0.07272,10
7/22/10 0:02,0.07373,10
7/22/10 0:02,0.07425,40
7/22/10 0:02,0.07474,10
7/22/10 0:02,0.07575,20
7/22/10 0:02,0.07575,10
7/22/10 0:04,0.07676,10
7/22/10 0:04,0.07777,10
7/22/10 0:04,0.07878,5
7/22/10 0:33,0.07921,10
7/22/10 0:53,0.07921,20
7/22/10 0:53,0.07921,20
7/22/10 0:54,0.07921,20
7/22/10 0:54,0.07921,20
7/22/10 0:54,0.07921,20
7/22/10 0:54,0.07921,20
7/22/10 1:16,0.07921,65
7/22/10 1:50,0.07979,5
7/22/10 1:51,0.0808,20
7/22/10 1:51,0.0808,5
7/22/10 1:51,0.08181,5
7/22/10 5:20,0.07878,30
7/22/10 5:21,0.07878,3
7/22/10 10:28,0.06931,100
7/22/10 10:53,0.06535,10
7/22/10 10:53,0.06436,10
7/22/10 10:53,0.06436,45
7/22/10 10:54,0.06337,10
7/22/10 10:54,0.06238,10
7/22/10 10:54,0.06139,10
7/22/10 11:43,0.06138,605
7/22/10 11:59,0.06436,10
7/22/10 16:14,0.06436,10
7/22/10 16:14,0.06436,1
7/22/10 16:15,0.06436,1
7/22/10 16:15,0.06436,1
7/22/10 16:15,0.06436,1
7/22/10 16:15,0.06436,1
7/22/10 16:18,0.06436,85
7/22/10 16:18,0.06337,10
7/22/10 16:18,0.06238,5
7/22/10 16:33,0.06238,1
7/22/10 16:33,0.06238,1
7/22/10 16:33,0.06238,1
7/22/10 16:33,0.06238,1
7/22/10 16:33,0.06238,1
7/22/10 16:33,0.06238,1
7/22/10 16:33,0.06238,1
7/22/10 16:34,0.06238,1
7/22/10 16:34,0.06238,1
7/22/10 16:34,0.06238,1
7/22/10 16:34,0.06139,1
7/22/10 16:34,0.06139,1
7/22/10 16:34,0.06139,1
7/22/10 16:34,0.06139,1
7/22/10 16:34,0.06139,1
7/22/10 16:34,0.06139,1
7/22/10 16:34,0.06139,1
7/22/10 16:34,0.06139,1
7/22/10 16:34,0.06139,1
7/22/10 16:34,0.06139,1
7/22/10 16:34,0.0604,1
7/22/10 16:34,0.0604,1
7/22/10 16:34,0.0604,1
7/22/10 16:34,0.0604,1
7/22/10 16:34,0.0604,1
7/22/10 16:34,0.0604,1
7/22/10 16:34,0.0604,1
7/22/10 16:34,0.0604,1
7/22/10 16:34,0.0604,1
7/22/10 16:34,0.0604,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:34,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 16:35,0.05941,1
7/22/10 18:38,0.0604,10
7/22/10 18:39,0.05941,10
7/22/10 18:39,0.05842,10
7/22/10 18:39,0.05743,10
7/22/10 18:39,0.05644,10
7/22/10 18:39,0.05594,20
7/22/10 18:39,0.05584,250
7/22/10 18:39,0.05545,10
7/22/10 18:39,0.05446,500
7/22/10 18:46,0.05446,90
7/22/10 20:18,0.05446,3
7/22/10 20:18,0.05446,10
7/22/10 22:48,0.06363,1
7/23/10 0:55,0.05941,10
7/23/10 0:56,0.05842,10
7/23/10 0:56,0.05743,10
7/23/10 0:56,0.05644,10
7/23/10 0:56,0.05545,10
7/23/10 0:56,0.05446,10
7/23/10 0:56,0.05347,10
7/23/10 0:56,0.05248,10
7/23/10 0:56,0.05149,10
7/23/10 0:56,0.0505,10
7/23/10 1:13,0.0505,804.23
7/23/10 1:14,0.0505,95.77
7/23/10 1:15,0.06358,30
7/23/10 1:15,0.06358,5
7/23/10 1:15,0.06358,1
7/23/10 2:53,0.06358,100
7/23/10 3:19,0.06358,100
7/23/10 3:19,0.06358,100
7/23/10 3:20,0.06363,199
7/23/10 3:20,0.06565,10
7/23/10 5:03,0.06535,100
7/23/10 5:20,0.06555,88
7/23/10 5:20,0.06666,10
7/23/10 5:21,0.06767,84.29
7/23/10 5:25,0.06767,10
7/23/10 5:25,0.06767,90
7/23/10 8:24,0.06767,9
7/23/10 12:05,0.06161,0.1
7/23/10 13:38,0.05545,10
7/23/10 15:23,0.0606,10
7/23/10 16:55,0.06161,10
7/23/10 17:03,0.06161,1
7/23/10 17:21,0.06262,10
7/23/10 17:42,0.06262,4.74
7/23/10 19:08,0.06262,1.71
7/23/10 19:46,0.06262,140
7/23/10 19:58,0.06262,10
7/23/10 20:14,0.06262,4
7/23/10 20:35,0.06262,250
7/23/10 21:13,0.06161,0
7/23/10 21:37,0.06161,10
7/23/10 22:32,0.06162,5
7/23/10 23:29,0.05545,10
7/23/10 23:29,0.05446,10
7/23/10 23:29,0.05446,5
7/23/10 23:29,0.05347,10
7/23/10 23:30,0.05248,5.66
7/23/10 23:30,0.05248,4.34
7/23/10 23:30,0.05248,5.66
7/23/10 23:40,0.06161,10
7/23/10 23:40,0.06262,35
7/23/10 23:40,0.06262,4
7/24/10 1:16,0.06161,0.32
7/24/10 1:16,0.06161,0
7/24/10 6:53,0.05149,10
7/24/10 8:06,0.05858,50
7/24/10 9:26,0.05941,106
7/24/10 12:55,0.05248,0.57
7/24/10 12:55,0.05149,20.43
7/24/10 14:08,0.05149,10
7/24/10 14:08,0.05149,79.57
7/24/10 14:08,0.0505,10
7/24/10 14:08,0.0505,150
7/24/10 14:08,0.05049,29.43
7/24/10 14:08,0.05049,0
7/24/10 15:03,0.05757,10
7/24/10 15:04,0.05858,10
7/24/10 16:49,0.05454,10
7/25/10 1:59,0.05545,1
7/25/10 5:29,0.05555,10
7/25/10 5:29,0.05757,10
7/25/10 5:29,0.05858,10
7/25/10 5:33,0.05941,95.5
7/25/10 17:01,0.05693,441
7/25/10 17:03,0.05446,114.29
7/25/10 17:49,0.05446,578.71
7/25/10 20:12,0.05248,10
7/25/10 20:12,0.05149,10
7/25/10 20:12,0.05149,20
7/25/10 20:13,0.05099,53
7/25/10 20:13,0.0505,187
7/25/10 20:13,0.0505,10
7/25/10 20:58,0.0505,0.98
7/26/10 11:53,0.05,1
7/26/10 14:29,0.05,119
7/26/10 14:29,0.05,10
7/26/10 20:27,0.052,0.96
7/26/10 20:53,0.052,20
7/26/10 20:53,0.052,199.04
7/26/10 20:53,0.053,10
7/26/10 20:53,0.054,200
7/26/10 20:53,0.055,100
7/26/10 20:53,0.055,10
7/26/10 20:53,0.0559,50
7/26/10 20:53,0.056,2
7/26/10 20:53,0.056,8.96
7/26/10 20:54,0.056,100
7/26/10 20:54,0.056,1.04
7/26/10 20:54,0.056,18
7/26/10 20:54,0.056,0.96
7/26/10 21:03,0.056,26.04
7/27/10 5:02,0.053,100
7/27/10 5:02,0.054,100
7/27/10 5:02,0.055,100
7/27/10 5:02,0.0559,50
7/27/10 5:02,0.056,10
7/27/10 5:02,0.056,40
7/27/10 5:06,0.056,110
7/27/10 5:06,0.057,50
7/27/10 5:06,0.057,10
7/27/10 5:06,0.0575,65.98
7/27/10 5:06,0.0575,68.04
7/27/10 5:06,0.0579,200
7/27/10 5:06,0.058,10
7/27/10 5:06,0.058,450
7/27/10 5:06,0.058,53
7/27/10 5:06,0.059,2
7/27/10 5:06,0.059,10
7/27/10 5:06,0.0599,200
7/27/10 5:06,0.06,100
7/27/10 5:06,0.06,10
7/27/10 5:06,0.06,35
7/27/10 5:06,0.06,639
7/27/10 5:07,0.0605,50
7/27/10 16:23,0.055,100
7/27/10 16:39,0.058,10
7/27/10 16:41,0.0589,100
7/27/10 16:42,0.0589,100
7/27/10 16:43,0.059,10
7/27/10 16:45,0.0594,100
7/27/10 16:45,0.0594,100
7/27/10 16:45,0.0599,100
7/27/10 16:45,0.0599,100
7/27/10 16:46,0.06,100
7/27/10 16:46,0.06,50
7/27/10 16:46,0.06,30
7/27/10 16:46,0.06,10
7/27/10 16:47,0.06,0.67
7/28/10 5:19,0.06,309
7/28/10 5:30,0.06,0.33
7/28/10 5:30,0.061,10
7/28/10 5:31,0.0615,200
7/28/10 12:21,0.0582,400
7/28/10 12:21,0.058,551.72
7/28/10 12:58,0.057,300
7/28/10 12:58,0.056,200
7/28/10 12:59,0.055,127.27
7/28/10 12:59,0.055,10
7/28/10 12:59,0.055,200
7/28/10 12:59,0.054,211.01
7/28/10 19:34,0.058,50
7/28/10 20:07,0.054,10
7/28/10 22:37,0.0574,160
7/28/10 22:51,0.0574,260
7/28/10 22:52,0.058,50
7/28/10 22:52,0.058,185
7/28/10 23:03,0.058,15
7/28/10 23:03,0.059,10
7/28/10 23:04,0.0595,300
7/28/10 23:05,0.06,500
7/28/10 23:05,0.061,10
7/28/10 23:05,0.061,127
7/28/10 23:06,0.062,160
7/28/10 23:41,0.0589,33.96
7/29/10 5:04,0.0597,230
7/29/10 10:02,0.0571,37.4
7/29/10 15:33,0.05789,2
7/29/10 17:05,0.05789,2
7/29/10 19:04,0.05789,76
7/29/10 19:05,0.058,20
7/29/10 19:06,0.05939,100
7/29/10 19:06,0.05939,100
7/29/10 19:06,0.0599,100
7/29/10 19:06,0.0599,60
7/29/10 19:06,0.06,1
7/29/10 19:11,0.06,29
7/29/10 19:45,0.0614,9.61
7/29/10 20:44,0.0614,410.39
7/29/10 21:01,0.0619,96
7/29/10 21:05,0.05991,23.31
7/29/10 21:14,0.0599,16.69
7/29/10 21:14,0.0619,104
7/29/10 21:14,0.062,900
7/29/10 21:14,0.062,100
7/29/10 21:14,0.062,400
7/29/10 21:19,0.062,305.72
7/29/10 21:19,0.0631,100
7/29/10 21:19,0.06311,50
7/29/10 21:20,0.0635,65
7/29/10 21:20,0.064,7
7/29/10 21:20,0.064,10
7/29/10 21:20,0.064,5
7/29/10 21:20,0.065,116
7/29/10 21:20,0.065,100
7/29/10 21:20,0.06501,200
7/29/10 21:21,0.067,10
7/29/10 21:21,0.067,216.71
7/29/10 21:21,0.0678,900
7/29/10 21:21,0.06701,159.68
7/29/10 21:22,0.06699,20
7/29/10 21:23,0.05799,4.01
7/29/10 21:28,0.0678,5
7/29/10 21:31,0.0678,95
7/29/10 21:31,0.068,100
7/29/10 21:31,0.0689,16.97
7/29/10 21:31,0.0699,900
7/29/10 21:31,0.0699,900
7/29/10 21:32,0.0699,73.24
7/29/10 21:46,0.065,13
7/29/10 21:49,0.069,5
7/29/10 21:50,0.0699,73
7/29/10 22:25,0.0699,64.37
7/29/10 22:30,0.065,12
7/29/10 22:37,0.0639,30
7/29/10 22:41,0.0639,16
7/29/10 22:45,0.06499,70
7/30/10 0:07,0.0685,16
7/30/10 0:07,0.0699,582.39
7/30/10 2:24,0.0698,50
7/30/10 4:55,0.062,715
7/30/10 4:55,0.0602,200
7/30/10 4:55,0.06,1
7/30/10 4:55,0.06,50
7/30/10 4:55,0.0582,34
7/30/10 9:00,0.06,1
7/30/10 9:00,0.0669,0.9
7/30/10 11:01,0.06,1.09
7/30/10 11:02,0.06,1.09
7/30/10 11:12,0.06,1.09
7/30/10 11:12,0.06,1.09
7/30/10 11:28,0.0669,49.1
7/30/10 11:29,0.0674,215
7/30/10 11:30,0.0684,298
7/30/10 13:33,0.06741,0.89
7/30/10 16:10,0.061,49.11
7/30/10 22:31,0.0681,20
7/30/10 22:31,0.0684,42
7/30/10 22:31,0.069,140
7/30/10 22:31,0.069,5.49
7/30/10 22:31,0.069,354.51
7/30/10 22:31,0.069,360.49
7/30/10 22:31,0.069,50
7/30/10 22:32,0.0692,50
7/30/10 23:25,0.0692,100
7/31/10 0:41,0.067,25
7/31/10 0:42,0.06315,150
7/31/10 0:43,0.0627,55
7/31/10 4:40,0.065,20
7/31/10 4:40,0.0621,150
7/31/10 4:40,0.062,20
7/31/10 4:40,0.0612,200
7/31/10 4:41,0.061,100.89
7/31/10 4:41,0.061,18
7/31/10 4:41,0.06,25
7/31/10 4:41,0.06,4.64
7/31/10 4:41,0.06,100
7/31/10 4:41,0.0582,360
7/31/10 4:41,0.0582,1.47
7/31/10 5:07,0.0662,50
7/31/10 5:07,0.0687,44
7/31/10 15:49,0.0605,1
7/31/10 15:53,0.0605,30
7/31/10 15:53,0.06,60
7/31/10 15:53,0.06,150
7/31/10 15:53,0.06,1
7/31/10 15:54,0.059,340
7/31/10 15:56,0.05823,419
7/31/10 16:20,0.06889,20
7/31/10 17:53,0.05823,81
7/31/10 17:53,0.0582,4.53
7/31/10 17:59,0.0582,25
7/31/10 18:33,0.058,130
7/31/10 18:33,0.058,100
7/31/10 18:33,0.058,60.52
7/31/10 18:33,0.0568,9.48
7/31/10 18:40,0.0582,89.47
7/31/10 23:35,0.056,10
7/31/10 23:58,0.06,800
8/1/10 0:00,0.064,20
8/1/10 0:12,0.06401,4
8/1/10 0:18,0.065,20
8/1/10 0:18,0.066,56
8/1/10 0:18,0.066,10.25
8/1/10 0:18,0.066,20
8/1/10 0:18,0.067,300
8/1/10 0:18,0.067,20
8/1/10 0:28,0.067,73.75
8/1/10 0:28,0.061,64.25
8/1/10 0:55,0.06785,5
8/1/10 0:57,0.06785,4
8/1/10 3:21,0.061,0.75
8/1/10 3:21,0.0601,36
8/1/10 3:53,0.06,20
8/1/10 4:19,0.06,20
8/1/10 7:26,0.06,75.8
8/1/10 11:01,0.06,80
8/1/10 13:03,0.06,804.2
8/1/10 13:04,0.06009,13.25
8/1/10 13:10,0.06001,5
8/1/10 14:11,0.061,20
8/1/10 14:11,0.062,20
8/1/10 14:11,0.063,100
8/1/10 14:11,0.0636,240
8/1/10 14:11,0.0639,36
8/1/10 14:11,0.064,84
8/1/10 14:12,0.064,166
8/1/10 14:12,0.065,334
8/1/10 14:17,0.065,500
8/1/10 18:36,0.0602,6
8/2/10 0:01,0.0611,40
8/2/10 4:23,0.0627,200
8/2/10 4:23,0.0625,128
8/2/10 6:22,0.0625,872
8/2/10 6:22,0.0615,128
8/2/10 6:23,0.0615,872
8/2/10 6:23,0.0611,128
8/2/10 10:42,0.0611,166
8/2/10 19:13,0.0633,80
8/2/10 19:23,0.0611,5
8/2/10 19:28,0.0611,20
8/2/10 22:55,0.0611,21
8/2/10 22:55,0.061,20
8/2/10 22:55,0.0604,86
8/2/10 22:55,0.0602,136.36
8/2/10 22:55,0.06001,90.8
8/2/10 22:55,0.06,20
8/2/10 22:55,0.06,111.82
8/2/10 22:55,0.06,514.02
8/3/10 1:01,0.06,10
8/3/10 2:49,0.06,30
8/3/10 3:00,0.061,20
8/3/10 3:17,0.0619,86
8/3/10 3:17,0.062,324
8/3/10 6:54,0.062,11.13
8/3/10 6:57,0.062,300
8/3/10 10:23,0.06,65
8/3/10 10:23,0.06,20
8/3/10 10:23,0.06,237.33
8/3/10 10:23,0.0591,90
8/3/10 10:23,0.059,621.67
8/3/10 12:41,0.059,178.33
8/3/10 12:53,0.06,40
8/3/10 13:02,0.062,100
8/3/10 13:02,0.062,100
8/3/10 13:02,0.062,100
8/3/10 13:02,0.062,64.87
8/3/10 13:02,0.062,20
8/3/10 13:02,0.0625,100
8/3/10 13:03,0.0625,100
8/3/10 13:03,0.0625,100
8/3/10 13:03,0.0625,100
8/3/10 13:03,0.0625,100
8/3/10 13:03,0.0625,100
8/3/10 13:04,0.0625,100
8/3/10 13:04,0.0625,92.79
8/3/10 14:07,0.061,20
8/3/10 14:07,0.0625,207.21
8/3/10 14:08,0.0633,12
8/3/10 14:08,0.0635,1000
8/3/10 14:25,0.06331,988
8/3/10 14:25,0.06251,12
8/3/10 14:55,0.065,5
8/3/10 14:55,0.065,15
8/3/10 15:53,0.06251,3
8/3/10 15:55,0.06251,3
8/3/10 15:56,0.06251,3
8/3/10 19:48,0.06251,779
8/3/10 21:06,0.06201,15.1
8/3/10 21:07,0.06201,0.03
8/3/10 21:08,0.061,69
8/3/10 21:12,0.0605,1000
8/3/10 22:17,0.0605,1000
8/3/10 22:19,0.062,69
8/3/10 22:19,0.0629,90
8/3/10 22:19,0.063,100
8/3/10 22:20,0.063,100
8/3/10 22:20,0.063,100
8/3/10 22:20,0.063,100
8/3/10 22:20,0.063,100
8/3/10 22:20,0.063,100
8/3/10 22:20,0.063,100
8/3/10 22:20,0.063,100
8/3/10 22:31,0.061,70
8/3/10 23:21,0.0601,94
8/3/10 23:32,0.06,356
8/4/10 1:39,0.06229,94
8/4/10 1:39,0.0623,135.5
8/4/10 2:02,0.0623,264.5
8/4/10 3:02,0.06231,985.5
8/4/10 3:02,0.0601,14.5
8/4/10 11:57,0.0601,83.36
8/4/10 12:29,0.06,23.56
8/4/10 12:29,0.06,20
8/4/10 12:29,0.06,373.08
8/4/10 18:04,0.06,626.92
8/4/10 18:04,0.06,20
8/4/10 18:04,0.0591,12
8/4/10 18:05,0.059,16
8/4/10 18:05,0.059,20
8/4/10 18:05,0.058,20
8/4/10 18:05,0.0578,182
8/4/10 18:05,0.057,20
8/4/10 18:05,0.057,583.08
8/5/10 2:24,0.0581,316.92
8/5/10 2:25,0.058,53.24
8/5/10 4:04,0.0603,10
8/5/10 6:14,0.0603,5
8/5/10 12:58,0.0603,1
8/5/10 12:58,0.06,1
8/5/10 14:18,0.06,600
8/5/10 17:43,0.06,1000
8/5/10 20:10,0.0603,584
8/5/10 20:11,0.0604,190
8/5/10 20:35,0.0608,321
8/5/10 20:35,0.0609,911.91
8/5/10 20:35,0.0609,117.09
8/5/10 20:42,0.0609,882.91
8/5/10 20:42,0.061,20
8/5/10 21:22,0.061,20
8/6/10 5:30,0.062,20
8/6/10 5:34,0.0624,100
8/6/10 5:55,0.0624,100
8/6/10 5:56,0.0624,100
8/6/10 7:38,0.0624,100
8/6/10 7:49,0.0624,25
8/6/10 9:52,0.0624,12
8/6/10 16:01,0.0619,100
8/6/10 20:39,0.0614,188
8/7/10 0:09,0.0607,500
8/7/10 0:49,0.0614,10
8/7/10 0:52,0.0619,50
8/7/10 0:53,0.0623,90
8/7/10 4:48,0.0608,200
8/7/10 6:06,0.06079,100
8/7/10 14:16,0.06079,200
8/7/10 14:23,0.0622,19
8/7/10 14:56,0.06081,50
8/7/10 16:27,0.0609,50
8/7/10 20:58,0.061,263
8/7/10 20:59,0.0609,175
8/7/10 20:59,0.0608,200
8/7/10 20:59,0.0606,200
8/7/10 20:59,0.06,20
8/7/10 20:59,0.06,1
8/7/10 20:59,0.05975,141
8/7/10 23:04,0.05975,15
8/7/10 23:05,0.059,20
8/7/10 23:05,0.059,20
8/7/10 23:05,0.059,445
8/7/10 23:05,0.059,500
8/8/10 4:14,0.059,25
8/8/10 16:07,0.06,1000
8/8/10 16:07,0.0604,1000
8/8/10 16:08,0.061,20
8/8/10 23:24,0.0609,156
8/9/10 2:01,0.06091,158.25
8/9/10 2:01,0.0595,1000
8/9/10 2:01,0.0593,841.75
8/9/10 3:23,0.061,20
8/9/10 3:23,0.0615,521.94
8/9/10 3:31,0.062,4.52
8/9/10 4:18,0.0615,389
8/9/10 4:22,0.0615,0.81
8/9/10 4:31,0.0615,432.44
8/9/10 4:31,0.0615,231.35
8/9/10 9:54,0.0615,19.94
8/9/10 9:54,0.062,20
8/9/10 9:54,0.0624,148.71
8/9/10 9:54,0.0629,922.91
8/9/10 9:55,0.063,40
8/9/10 9:55,0.063,20
8/9/10 9:55,0.063,10
8/9/10 9:55,0.063,20
8/9/10 9:55,0.064,20
8/9/10 9:55,0.064,20
8/9/10 9:55,0.064,55
8/9/10 9:55,0.064,50
8/9/10 9:55,0.0644,198.04
8/9/10 9:55,0.0644,301.96
8/9/10 9:55,0.065,20
8/9/10 9:55,0.065,100
8/9/10 9:55,0.065,142.36
8/9/10 9:55,0.065,35
8/9/10 9:55,0.066,265.26
8/9/10 12:59,0.063,300
8/9/10 13:20,0.062,10
8/9/10 15:06,0.063,10
8/9/10 15:06,0.065,50
8/9/10 16:22,0.065,189
8/9/10 16:43,0.065,500
8/9/10 16:43,0.065,500
8/9/10 16:43,0.065,300.23
8/9/10 18:00,0.066,34.74
8/9/10 18:00,0.0675,100
8/9/10 18:00,0.0675,50
8/9/10 18:00,0.068,1.15
8/9/10 18:00,0.068,12.5
8/9/10 18:00,0.068,20
8/9/10 18:00,0.06887,100
8/9/10 18:00,0.06887,100
8/9/10 18:00,0.06887,100
8/9/10 18:00,0.06887,100
8/9/10 18:00,0.06887,100
8/9/10 18:01,0.06887,100
8/9/10 18:01,0.06887,100
8/9/10 18:01,0.06887,100
8/9/10 18:01,0.06887,100
8/9/10 18:01,0.06887,100
8/9/10 18:01,0.06887,100
8/9/10 18:01,0.06887,100
8/9/10 18:01,0.06887,100
8/9/10 18:01,0.06887,100
8/9/10 18:01,0.06887,100
8/9/10 18:01,0.06887,100
8/9/10 18:01,0.06887,400
8/9/10 18:01,0.069,20
8/9/10 18:01,0.069,210
8/9/10 18:01,0.0695,1000
8/9/10 18:01,0.0695,500
8/9/10 18:01,0.0695,124
8/9/10 18:01,0.0699,100
8/9/10 18:06,0.0646,2
8/9/10 18:07,0.0646,2
8/9/10 18:35,0.07,20
8/9/10 18:35,0.07,10
8/9/10 18:35,0.071,48
8/9/10 18:35,0.073,10
8/9/10 18:35,0.0735,29.25
8/9/10 18:37,0.0735,15
8/9/10 19:38,0.06624,705
8/9/10 20:47,0.0714,46
8/9/10 21:36,0.06651,1.98
8/9/10 21:39,0.06651,1
8/9/10 21:51,0.06651,500
8/9/10 22:42,0.0704,100
8/9/10 22:42,0.071,100
8/10/10 3:40,0.068,1
8/10/10 3:42,0.068,1
8/10/10 12:22,0.0708,7
8/10/10 12:58,0.0708,134
8/10/10 13:35,0.0681,100
8/10/10 13:35,0.068,18
8/10/10 13:36,0.0666,400
8/10/10 13:38,0.06651,149.11
8/10/10 19:02,0.0708,10
8/10/10 19:02,0.0708,4.1
8/10/10 20:05,0.0708,44.9
8/10/10 20:05,0.0709,19
8/10/10 20:11,0.07081,0.28
8/10/10 21:24,0.0709,71
8/10/10 23:51,0.0672,300
8/11/10 0:29,0.06711,50
8/11/10 0:58,0.07,1
8/11/10 1:07,0.06,1
8/11/10 1:16,0.06,1
8/11/10 1:16,0.06,2
8/11/10 1:16,0.06,3
8/11/10 1:16,0.06,1
8/11/10 1:17,0.06,1
8/11/10 1:17,0.06,1
8/11/10 1:18,0.07,50
8/11/10 1:27,0.068,2
8/11/10 2:16,0.068,49
8/11/10 2:17,0.06711,1
8/11/10 2:17,0.06711,1
8/11/10 2:17,0.06711,1
8/11/10 2:17,0.06711,1
8/11/10 2:17,0.06711,1
8/11/10 2:17,0.06711,1
8/11/10 2:18,0.06711,5
8/11/10 2:18,0.06711,140
8/11/10 3:02,0.07,9
8/11/10 3:03,0.07019,50
8/11/10 3:03,0.0702,10
8/11/10 3:03,0.0703,65
8/11/10 11:40,0.069,70
8/11/10 14:51,0.0691,1000
8/11/10 15:10,0.069,5
8/11/10 15:10,0.069,9
8/11/10 15:45,0.07029,151
8/11/10 15:45,0.0703,335
8/11/10 15:46,0.071,6.72
8/11/10 15:46,0.071,3
8/11/10 15:46,0.0711,100.33
8/11/10 15:47,0.07148,771.68
8/11/10 16:28,0.069,3.77
8/11/10 16:28,0.0683,46.23
8/11/10 16:42,0.0684,100
8/11/10 16:53,0.06839,200
8/11/10 16:58,0.07,64.99
8/11/10 17:40,0.07,1
8/11/10 17:40,0.07,35.01
8/11/10 17:40,0.0714,100
8/11/10 17:47,0.0714,200
8/11/10 17:47,0.07148,29.32
8/11/10 17:47,0.07149,602
8/11/10 17:47,0.0715,1000
8/11/10 17:47,0.0715,11.77
8/11/10 17:47,0.0715,1
8/11/10 17:47,0.072,50
8/11/10 17:47,0.07248,116.12
8/11/10 18:02,0.07248,699.88
8/11/10 18:02,0.073,300
8/11/10 18:02,0.073,20.01
8/11/10 18:02,0.0735,134
8/11/10 18:02,0.0735,55.75
8/11/10 18:02,0.07479,500
8/11/10 18:08,0.07494,240
8/11/10 18:14,0.07491,2
8/11/10 18:14,0.07491,2
8/11/10 18:14,0.07491,1.74
8/11/10 18:15,0.07,2
8/11/10 18:22,0.073,2
8/11/10 18:22,0.07489,0.26
8/11/10 18:23,0.07494,1170
8/11/10 18:24,0.075,10
8/11/10 18:24,0.075,30
8/11/10 18:24,0.075,50
8/11/10 18:24,0.075,100
8/11/10 18:25,0.07541,400
8/11/10 18:25,0.07541,150
8/11/10 18:29,0.07541,1799.12
8/11/10 18:29,0.07541,450.88
8/11/10 18:35,0.0751,2
8/11/10 18:48,0.0751,1.73
8/11/10 18:50,0.07001,1506.27
8/11/10 19:58,0.0711,37
8/11/10 19:58,0.071,2
8/11/10 19:58,0.0701,50
8/11/10 19:59,0.07,857.71
8/11/10 21:00,0.069,66.52
8/11/10 22:53,0.067,9.37
8/12/10 2:55,0.068,40
8/12/10 6:56,0.067,20.31
8/12/10 8:48,0.067,10.32
8/12/10 8:49,0.06624,1000
8/12/10 8:49,0.06624,10.32
8/12/10 8:49,0.06624,9.32
8/12/10 8:50,0.06624,275.36
8/12/10 8:50,0.0649,73.5
8/12/10 8:50,0.0648,189.5
8/12/10 8:50,0.063,150
8/12/10 8:51,0.06141,281.68
8/12/10 22:28,0.0665,1
8/12/10 23:20,0.07,1
8/13/10 6:37,0.0665,147
8/13/10 6:38,0.066,15
8/13/10 6:38,0.065,638
8/13/10 14:36,0.0679,86.77
8/13/10 14:39,0.068,14
8/13/10 20:26,0.0652,312.112
8/13/10 20:26,0.0652,312.112
8/13/10 20:26,0.0652,375.776
8/13/10 20:34,0.065,300
8/13/10 21:37,0.0651,15
8/13/10 21:38,0.065,185
8/13/10 21:38,0.06509,1
8/13/10 22:44,0.065,366.38
8/13/10 22:49,0.0645,200
8/13/10 22:51,0.06499,33.62
8/13/10 23:40,0.0645,128.53
8/13/10 23:40,0.0645,45.735
8/13/10 23:40,0.0645,10.23
8/13/10 23:40,0.0645,300
8/13/10 23:40,0.0645,105.505
8/14/10 10:20,0.0655,45
8/14/10 13:58,0.0655,1
8/14/10 16:18,0.065,35.077
8/14/10 16:18,0.0645,0.003
8/14/10 16:51,0.0655,154
8/14/10 16:51,0.066,200
8/14/10 16:51,0.067,40
8/14/10 16:57,0.0673,400
8/14/10 16:58,0.0675,1000
8/14/10 17:06,0.0685,100
8/14/10 17:06,0.06879,50
8/14/10 17:06,0.069,5.2
8/14/10 17:06,0.0695,100
8/14/10 17:06,0.0695,49
8/14/10 17:13,0.069,300
8/14/10 21:03,0.06587,924.92
8/14/10 21:42,0.067,1000
8/15/10 2:09,0.067,1000
8/15/10 20:01,0.0667,155
8/15/10 20:26,0.06644,414.7
8/15/10 20:28,0.066,571.061
8/15/10 20:33,0.06579,400
8/15/10 20:34,0.06579,1000
8/15/10 20:35,0.06579,92
8/15/10 20:36,0.0655,150
8/15/10 20:45,0.06526,5
8/15/10 20:45,0.06526,300
8/15/10 20:45,0.06526,300
8/15/10 20:53,0.06526,2
8/15/10 22:09,0.06529,5
8/15/10 22:51,0.06529,10.106
8/15/10 23:22,0.06529,9.799
8/16/10 0:47,0.065,1
8/16/10 0:47,0.065,4
8/16/10 0:56,0.06529,9
8/16/10 0:57,0.06529,9
8/16/10 0:58,0.06529,7.6
8/16/10 0:58,0.06529,17.6
8/16/10 3:52,0.06319,83.2
8/16/10 4:04,0.06529,547
8/16/10 4:10,0.06529,0.001
8/16/10 4:17,0.0678,35
8/16/10 4:17,0.0678,35
8/16/10 5:11,0.0652,2.7
8/16/10 5:28,0.066,23
8/16/10 5:28,0.067,13
8/16/10 5:28,0.067,17
8/16/10 5:28,0.067,10
8/16/10 5:28,0.0678,120
8/16/10 5:30,0.0679,264
8/16/10 6:01,0.0676,75
8/16/10 10:36,0.066,50
8/16/10 10:56,0.066,221.667
8/16/10 10:56,0.0652,161
8/16/10 10:57,0.065,145
8/16/10 10:57,0.065,20
8/16/10 10:59,0.063,50
8/16/10 10:59,0.063,36.03
8/16/10 10:59,0.063,150
8/16/10 15:53,0.06337,52
8/16/10 17:41,0.063,20
8/16/10 17:41,0.0629,100
8/16/10 17:41,0.062,200
8/16/10 17:41,0.062,80
8/16/10 18:21,0.0668,1000
8/16/10 19:17,0.0639,1000
8/16/10 19:17,0.064,1000
8/16/10 19:58,0.0644,2.26
8/16/10 20:32,0.0644,500
8/16/10 20:32,0.0644,500
8/16/10 20:32,0.0644,500
8/16/10 20:32,0.0644,500
8/16/10 20:32,0.0644,500
8/16/10 20:33,0.0644,497.74
8/16/10 20:33,0.0645,500
8/16/10 20:33,0.0645,218
8/16/10 20:33,0.0669,161
8/16/10 20:33,0.067,100
8/16/10 20:33,0.067,100
8/16/10 20:33,0.067,100
8/16/10 20:45,0.0655,102.29
8/16/10 20:45,0.0655,102.29
8/16/10 20:45,0.0655,95.42
8/16/10 21:58,0.0655,6.87
8/16/10 22:48,0.06549,693.13
8/16/10 22:49,0.0665,35
答案 0 :(得分:4)
x <- read.csv(header=TRUE, stringsAsFactor=FALSE,
text="time,price,volume,
7/18/10 0:09,0.04951,20,
7/18/10 4:43,0.05941,50.01,
7/18/10 18:48,0.0808,5,
7/18/10 22:44,0.08585,10,
7/18/10 23:00,0.08584,5,
7/18/10 23:00,0.08584,5,
7/19/10 4:53,0.0909,5,
7/19/10 17:24,0.09307,80,
7/19/10 18:03,0.08911,100,
7/19/10 18:07,0.08752,100,")
# create an xts object
myxts <- xts(x[, 2:3], order.by=as.POSIXct(x[, 1], format='%m/%d/%y %H:%M'))
myxts
myxts
# price volume
# 2010-07-18 00:09:00 0.04951 20.00
# 2010-07-18 04:43:00 0.05941 50.01
# 2010-07-18 18:48:00 0.08080 5.00
# 2010-07-18 22:44:00 0.08585 10.00
# 2010-07-18 23:00:00 0.08584 5.00
# 2010-07-18 23:00:00 0.08584 5.00
# 2010-07-19 04:53:00 0.09090 5.00
# 2010-07-19 17:24:00 0.09307 80.00
# 2010-07-19 18:03:00 0.08911 100.00
# 2010-07-19 18:07:00 0.08752 100.00
to.minutes(myxts)
# myxts.Open myxts.High myxts.Low myxts.Close myxts.Volume
# 2010-07-18 00:09:00 0.04951 0.04951 0.04951 0.04951 20.00
# 2010-07-18 04:43:00 0.05941 0.05941 0.05941 0.05941 50.01
# 2010-07-18 18:48:00 0.08080 0.08080 0.08080 0.08080 5.00
# 2010-07-18 22:44:00 0.08585 0.08585 0.08585 0.08585 10.00
# 2010-07-18 23:00:00 0.08584 0.08584 0.08584 0.08584 10.00
# 2010-07-19 04:53:00 0.09090 0.09090 0.09090 0.09090 5.00
# 2010-07-19 17:24:00 0.09307 0.09307 0.09307 0.09307 80.00
# 2010-07-19 18:03:00 0.08911 0.08911 0.08911 0.08911 100.00
# 2010-07-19 18:07:00 0.08752 0.08752 0.08752 0.08752 100.00
to.minutes
是to.period
的许多包装器之一。这是等价的,但是
更一般:
to.period(myxts, 'minutes', 1)
答案 1 :(得分:2)
zoo
系列可以使用OHLC
重新标记为class(data) <- c('zoo', 'OHLC', 'some other class')
。
来自?quantmod::quantmod.OHLC
:
‘quantmod.OHLC’
实际上只是对类‘zoo’
的对象进行重命名,列名称的约定为NAME.Open, NAME.High, ...
。
如果您没有音量列,则无法编写可添加该数据的代码。看起来你只是有一系列盘中价格。您仍然可以将这些分类为zoo
或xts
并进行时间序列分析。如果您想降低数据的分辨率,可以随时扫描每天并使用first
,max
,min
,last
这些函数来获取O
1}},H
,L
,C
。
答案 2 :(得分:2)
来自http://r.789695.n4.nabble.com/Convert-tick-data-to-OHLC-td926206.html
ohlc <- function(ttime,tprice,tvolume,fmt) {
ttime.int <- format(ttime,fmt)
data.frame(time = ttime[tapply(1:length(ttime),ttime.int,function(x) {head(x,1)})],
.Open = tapply(tprice,ttime.int,function(x) {head(x,1)}),
.High = tapply(tprice,ttime.int,max),
.Low = tapply(tprice,ttime.int,min),
.Close = tapply(tprice,ttime.int,function(x) {tail(x,1)}),
.Volume = tapply(tvolume,ttime.int,function(x) {sum(x)}),
.Adjusted = tapply(tprice,ttime.int,function(x) {tail(x,1)}))
}