关于分时数据的快速问题。我有大量采用这种格式的数据,我认为这些数据非常适合我想要实现的目标。我想保持一定的粒度,以便能够在一秒钟内触发买入/卖出信号。
数据
SYMBOL TIMESTAMP STAMP PRICE SIZE EXCHANGE BID BIDEX BIDSIZE ASK ASKEX ASKSIZE
1 SPXU 1330938005 1330938005000000 NA NA 9.99 PSE 5 10.10 PSE 6
2 SPXU 1330938221 1330938221000000 NA NA 9.99 PSE 5 10.19 PSE 1
3 SPXU 1330938221 1330938221000001 10.1000 600 PSE NA NA NA NA
4 SPXU 1330938392 1330938392000000 NA NA 10.00 PSE 174 10.19 PSE 1
5 SPXU 1330938431 1330938431000000 NA NA 10.00 PSE 175 10.19 PSE 1
6 SPXU 1330938468 1330938468000000 NA NA 10.00 PSE 1 10.19 PSE 1
7 SPXU 1330938736 1330938736000000 NA NA 10.04 PSE 46 10.19 PSE 1
8 SPXU 1330938843 1330938843000000 NA NA 10.04 PSE 47 10.19 PSE 1
9 SPXU 1330939576 1330939576000000 NA NA 10.04 PSE 1 10.19 PSE 1
10 SPXU 1330939615 1330939615000000 NA NA 10.05 PSE 100 10.19 PSE 1
11 SPXU 1330939615 1330939615000001 NA NA 10.05 PSE 100 10.19 PSE 101
12 SPXU 1330939621 1330939621000000 NA NA 10.04 PSE 1 10.19 PSE 101
13 SPXU 1330939621 1330939621000001 NA NA 10.04 PSE 1 10.19 PSE 1
14 SPXU 1330939623 1330939623000000 NA NA 10.05 PSE 46 10.19 PSE 1
15 SPXU 1330939623 1330939623000001 NA NA 10.05 PSE 46 10.18 PSE 46
16 SPXU 1330939638 1330939638000000 NA NA 10.04 PSE 1 10.18 PSE 46
17 SPXU 1330939686 1330939686000000 NA NA 10.04 PSE 1 10.19 PSE 1
18 SPXU 1330939825 1330939825000000 NA NA 10.05 PSE 100 10.19 PSE 1
19 SPXU 1330939825 1330939825000001 NA NA 10.05 PSE 100 10.19 PSE 101
20 SPXU 1330939833 1330939833000000 NA NA 10.04 PSE 1 10.19 PSE 101
21 SPXU 1330939833 1330939833000001 NA NA 10.04 PSE 1 10.19 PSE 1
22 SPXU 1330939833 1330939833000002 NA NA 10.04 PSE 101 10.19 PSE 1
23 SPXU 1330939833 1330939833000003 NA NA 10.04 PSE 101 10.19 PSE 101
24 SPXU 1330939941 1330939941000000 NA NA 10.04 PSE 101 10.19 PSE 102
25 SPXU 1330940041 1330940041000000 NA NA 10.04 PSE 1 10.19 PSE 102
我希望能够创建保持毫秒粒度的动物园对象。我无法将“data$STAMP”转换为日期。我怎样才能做到这一点?
在职的:
> as.POSIXlt(data2$TIMESTAMP[3], origin="1970-01-01", tz="EST")
[1] "2012-03-05 04:01:36 EST"
不工作:
> as.POSIXlt(data2$STAMP[3], origin="1970-01-01", tz="EST")
[1] "))0'-06-03 15:45:52 EST"