Last active
June 8, 2016 20:37
-
-
Save tomas-rampas/7d9795e297075c4e9b2e009731a8c6a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this gist anticipates following: | |
# existence of GBPJPY.csv with OHLC series in g:\TickData directory | |
# time series having date time in format %d.%m.%Y %H:%M:%S | |
# update above assumptions in accordance with your dataset | |
library(blotter) | |
symbol = "GBPJPY" | |
dtfun <- function(x) as.POSIXct(strptime(x, format = "%d.%m.%Y %H:%M:%S", tz = "UTC")) | |
pair <- as.xts(read.zoo(file = paste0("g:/tickdata/",symbol,".csv"), header=T, sep=',', FUN=dtfun)) | |
assign(symbol, pair, .GlobalEnv) | |
head(GBPJPY) | |
# Open High Low Close Volume | |
#2008-01-01 00:00:00 221.765 221.895 221.666 221.780 74334296875 | |
#2008-01-01 01:00:00 221.803 221.905 221.696 221.791 58417699219 | |
#2008-01-01 02:00:00 221.841 221.863 221.717 221.777 1528300049 | |
#2008-01-01 03:00:00 221.802 221.863 221.742 221.800 1401199951 | |
#2008-01-01 04:00:00 221.818 221.870 221.691 221.803 1499199951 | |
#2008-01-01 05:00:00 221.783 221.858 221.707 221.800 1385599976 | |
summary(GBPJPY) | |
# Index Open High Low Close Volume | |
# Min. :2008-01-01 00:00:00 Min. :117.0 Min. :117.1 Min. :116.8 Min. :116.9 Min. :0.000e+00 | |
# 1st Qu.:2009-12-16 05:45:00 1st Qu.:131.8 1st Qu.:132.0 1st Qu.:131.7 1st Qu.:131.8 1st Qu.:0.000e+00 | |
# Median :2011-12-01 11:30:00 Median :148.4 Median :148.6 Median :148.2 Median :148.4 Median :4.776e+09 | |
# Mean :2011-12-01 11:29:46 Mean :154.5 Mean :154.6 Mean :154.3 Mean :154.5 Mean :6.725e+09 | |
# 3rd Qu.:2013-11-15 17:15:00 3rd Qu.:173.4 3rd Qu.:173.5 3rd Qu.:173.3 3rd Qu.:173.4 3rd Qu.:9.356e+09 | |
# Max. :2015-10-31 22:00:00 Max. :222.2 Max. :222.7 Max. :222.1 Max. :222.2 Max. :4.113e+11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment