Thanks Joshua, 

I'll give that a go.. 
what i ended up doing was this.

****loaded the bid, ask separately from csv****

#transform form into xts object
outask <- as.xts(read.zoo(BRN.06.15.Ask,
                          tz='',   
                          format='%Y%m%d %H%M%S'))
outbid <- as.xts(read.zoo(BRN.06.15.Bid,
                          tz='',   
                          format='%Y%m%d %H%M%S'))
calask <- as.xts(read.zoo(BRNS12.12.15.Ask,
                          tz='',   
                          format='%Y%m%d %H%M%S'))
calbid <- as.xts(read.zoo(BRNS12.12.15.Bid,
                          tz='',   
                          format='%Y%m%d %H%M%S'))

#make.index.unique(outask)

#merge the xts files into one
strat  <- merge.xts(outask, outbid, calask, calbid)
head(strat)

#rename columns
names(strat)[names(strat)=="V2"] <- "outask"
names(strat)[names(strat)=="V3"] <- "outaskvol"
names(strat)[names(strat)=="V2.1"] <- "outbid"
names(strat)[names(strat)=="V3.1"] <- "outbidVol"
names(strat)[names(strat)=="V2.2"] <- "calask"
names(strat)[names(strat)=="V3.2"] <- "calaskvol"
names(strat)[names(strat)=="V2.3"] <- "calbid"
names(strat)[names(strat)=="V3.3"] <- "calbidVol"
tail(strat)

#fill down rows
strat  <- na.locf(strat)
tail(strat)

#create strat ask and bid
strat$stratask  <-  strat$outask - (strat$calbid*3)
strat$stratbid  <-  strat$outbid - (strat$calask*3)

which gave me a xts object with everything i need.. i haven't got to back
testing yet but i will let you know how it go.. maybe your way is easier
I'll try that too.

*i havn't had any issues with unique fields yet.



--
View this message in context: 
http://r.789695.n4.nabble.com/Quantstrat-for-backtesting-on-tickdata-and-creating-a-spread-from-tick-tp4708020p4708278.html
Sent from the Rmetrics mailing list archive at Nabble.com.

_______________________________________________
R-SIG-Finance@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should 
go.

Reply via email to