Algorithmic Trading Group Forum
http://www.algotradinggroup.com/cgi-bin/yabb2/YaBB.pl
Trading Strategies >> Software Infrastructure >> R script to load dukascopy csv files
http://www.algotradinggroup.com/cgi-bin/yabb2/YaBB.pl?num=1352069372

Message started by Z on 11/04/12 at 22:49:31

Title: R script to load dukascopy csv files
Post by Z on 11/04/12 at 22:49:31

Hello fellow group members.

I've been using dukascopy's historical data and wrote an R script to load it in. Putting it here for people's use:


Code:
require("quantmod")

loadData <- function(file) {
 data <- read.csv(file, sep = ",")
 data$Time <- as.POSIXct(strptime(data$Time, format="%d.%m.%Y %H:%M:%OS"))
 data <- as.xts(data[,2:6], order.by=data$Time)
 data[data$Volume != 0,]
}

# Doesn't work on my PC for some reason, think it has to do with Timezone
loadData2 <- function(file) {
 read.zoo(file, header = TRUE, sep = ",", tz = "GMT",
          format = "%d.%m.%Y %H:%M:%OS")
}


Happy modelling!

Algorithmic Trading Group Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.