#The dataset contains 606809 entries, many of which appear to be duplicates.  They are not.
#They are sequential entries.  In order to generate a unique index, after reading in the file, be sure to run the line zc=make.index.unique (zc) as in this script

library("quantmod")
ds = options(digits.secs=6) #needed to make index unique

ticks.csv= "ZCK4-CornMay2014-Ticks.csv"
zc =  as.xts(read.zoo(ticks.csv, header = T, sep = ",", format = "%Y/%m/%d %H:%M:%S", tz=""))

isOrdered( .index(zc) )  #evaluates to FALSE
zc = make.index.unique (zc)
isOrdered( .index(zc) )  #evaluates to TRUE

#Note: numbers after the decimal point are not real time. They only create the index. Some will appear as duplicates, though internally they are unique.

colnames(zc)
nrow(zc) # should be 606809

head(zc,25)

#session starts at 17:00:00, breaks at 05:45:00, resumes at 6:30:00, ends at 11:15:00
nrow(zc["2014-04-10 17:00:00/2014-04-11 11:15:00"]) #full session
nrow(zc["2014-04-11 06:30:00/2014-04-11 11:15:00"]) #day session
head(zc["2014-04-11 06:30:00/2014-04-11 11:15:00"]$Price) #day session

max(zc["2014-04-10 17:00:00/2014-04-11 11:15:00"]$Price) #full session
max(zc["2014-04-10 17:00:00/2014-04-11 05:45:00"]$Price) #night session
max(zc["2014-04-11 06:30:00/2014-04-11 11:15:00"]$Price) #day


hist(zc$Price)
zc[zc$Volume>50]
hist(zc[zc$Volume>150]$Volume)

hist(zc["2014-04-10 17:00:00/2014-04-11 11:15:00"]$Price) #full session
hist(zc["2014-04-10 17:00:00/2014-04-11 05:45:00"]$Price) #night session
hist(zc["2014-04-11 06:30:00/2014-04-11 11:15:00"]$Price) #day

#write.zoo(zc, file="ticks.csv", sep=",")

