[R-SIG-Finance] How to read minutes data from csv files with getSymbol in quantmod?

Simon Otziger simon.otziger at active-sync.ch
Mon Nov 24 18:05:48 CET 2008


Hi Wind

Try the following code, you have to adjust the POSIX format. "%Y/%m/%d %H:%M:%S" should suit your case. If anyone knows an easier way I would be glad to know.

library(quantmod)
library(fSeries)
future.csv  = read.csv("C:/Data/BN1MinBar.asc", header = T) 
future.time = paste(future.csv[, "DATE"], future.csv[, "TIME"], sep = " ")
future.xt   = as.xts(timeSeries(future.csv, charvec = future.time, format = "%m/%d/%Y %H:%M:%S"))



Regards
Simon

-----Original Message-----
From: r-sig-finance-bounces at stat.math.ethz.ch [mailto:r-sig-finance-bounces at stat.math.ethz.ch] On Behalf Of Wind
Sent: Monday, November 24, 2008 5:06 PM
To: r-sig-finance
Subject: [R-SIG-Finance] How to read minutes data from csv files with getSymbol in quantmod?

The following code could read the csv file but the time is trimmed to Dates.
Any way we could read minutes data from csv as easy as getSymbols?
Thanks.
 
Codes:
require(quantmod)
getSymbols('EURO1',src="csv",dir="d:/datacenter/dataexchange")

Output:
> EURO1[1:5]
           EURO1.Open EURO1.High EURO1.Low EURO1.Close EURO1.Volume EURO1.Adjusted
2008-11-11    1.25490    1.25495   1.25410     1.25440            0              0
2008-11-11    1.25525    1.25555   1.25490     1.25490            0              0
2008-11-11    1.25665    1.25665   1.25525     1.25525            0              0
2008-11-11    1.25725    1.25725   1.25655     1.25665            0              0
2008-11-11    1.25735    1.25775   1.25715     1.25725            0              0
Warning message:
In zoo(rval, x.index[i]) :
  some methods for "zoo" objects do not work if the index entries in 'order.by' are not unique
> 

Contents of d:/datacenter/dataexchange/EURO1.csv

"","Open","High","Low","Close","Volum","Adjusted"
"2008/11/14 22:57:00",1.272625,1.27345,1.27225,1.272775,0,0
"2008/11/14 22:56:00",1.2709,1.27265,1.27075,1.27265,0,0
"2008/11/14 22:55:00",1.268925,1.27115,1.268925,1.27085,0,0
"2008/11/14 22:54:00",1.269275,1.269375,1.268725,1.268925,0,0
"2008/11/14 22:53:00",1.26975,1.269775,1.26915,1.26925,0,0
"2008/11/14 22:52:00",1.27005,1.27035,1.26955,1.269725,0,0
"2008/11/14 22:51:00",1.27055,1.27055,1.26975,1.270025,0,0
"2008/11/14 22:50:00",1.2704,1.27075,1.270225,1.27055,0,0
"2008/11/14 22:49:00",1.26995,1.27055,1.26965,1.270375,0,0
"2008/11/14 22:48:00",1.26955,1.26995,1.26885,1.269925,0,0
_______________________________________________
R-SIG-Finance at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only.
-- If you want to post, subscribe first.



More information about the R-SIG-Finance mailing list