[R-SIG-Finance] blotter on 15 min data

kafkaz kafka at centras.lt
Tue Apr 13 23:15:25 CEST 2010


Q: can I use blotter on 5 min. data? 
In my case, equity goes to 0 after first call of:
updatePortf(ltportfolio, Dates = currentDate)
updateAcct(ltaccount, Dates = currentDate)
updateEndEq(ltaccount, Dates = currentDate)

My data looks like this:
> head(eu5min)
                      Open   High    Low  Close
2007-01-02 02:05:00 1.3232 1.3234 1.3230 1.3234
2007-01-02 02:10:00 1.3233 1.3233 1.3230 1.3232
2007-01-02 02:15:00 1.3233 1.3234 1.3232 1.3232
2007-01-02 02:20:00 1.3233 1.3234 1.3229 1.3230
2007-01-02 02:25:00 1.3229 1.3232 1.3229 1.3231
2007-01-02 02:30:00 1.3230 1.3232 1.3229 1.3230

Here is blotter related code:
Sys.setenv(TZ="GMT")
initDate=index(eu5min[1])
rm(list=ls(envir=.blotter),envir=.blotter)
symbols<-c('eu5min')
initPortf(ltportfolio,symbols, initDate=initDate)

initAcct(ltaccount,portfolios=c(ltportfolio),
initDate=initDate,initEq=100000)
currency("USD")
stock('eu5min',currency="USD",multiplier=1)
equity = getEndEq(ltaccount, initDate)
print(paste('equity ',equity))

for(i in 2:length(signal))
{
	currentDate= time(signal)[i]
	print(paste('currentDate ',currentDate))
	updatePortf(ltportfolio, Dates = currentDate)
	updateAcct(ltaccount, Dates = currentDate)
	updateEndEq(ltaccount, Dates = currentDate)
	equity = getEndEq(ltaccount, currentDate)
	
	print(paste('equity ',equity))
}

Output of this code is:
[1] "equity  1e+05"
[1] "currentDate  2007-01-02 02:10:00"
[1] "equity  0"
[1] "currentDate  2007-01-02 02:15:00"
[1] "equity  0"
[1] "currentDate  2007-01-02 02:20:00"
[1] "equity  0"
[1] "currentDate  2007-01-02 02:25:00"
[1] "equity  0"
[1] "currentDate  2007-01-02 02:30:00"
[1] "equity  0"
[1] "currentDate  2007-01-02 02:35:00"
[1] "equity  0"

As you can see, equity goes down without any transaction.

str(eu5min)
An ‘xts’ object from 2007-01-02 02:05:00 to 2007-02-01 23:55:00 containing:
  Data: num [1:6509, 1:4] 1.32 1.32 1.32 1.32 1.32 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:4] "Open" "High" "Low" "Close"
  Indexed by objects of class: [POSIXt,POSIXct] TZ: GMT
  xts Attributes:  
 NULL

str(signal)
An ‘xts’ object from 2007-01-02 02:05:00 to 2007-02-01 23:55:00 containing:
  Data: num [1:6509, 1] 0 0 0 0 0 0 0 0 0 0 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr "Close"
  Indexed by objects of class: [POSIXt,POSIXct] TZ: GMT
  xts Attributes:  
 NULL

Any ideas about this? Thank you in advance.
-- 
View this message in context: http://n4.nabble.com/blotter-on-15-min-data-tp1839017p1839017.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list