[R-SIG-Finance] Blotter package - problem with example.

kafkaz kafka at centras.lt
Mon Mar 1 14:03:16 CET 2010


Could you explain, why equity goes down calling these functions:
equity=getEndEq('acc',as.character(currentDate))
print(paste('equity ',equity, ' date ',currentDate,' Spy ', SPY.monthly[i]))
updatePortf(Portfolio = "prtf", Dates = as.character(currentDate))
updateAcct("acc", Dates = as.character(currentDate))
updateEndEq("acc", as.character(currentDate))

[1] "equity  10000  date  1995-01-31  Spy  37.02"
[1] "upAcc 1995-01-31"
[1] "upEnd 1995-01-31"
[1] "equity  10000  date  1995-02-28  Spy  38.54"
[1] "upAcc 1995-02-28"
[1] "upEnd 1995-02-28"
[1] "equity  0  date  1995-03-31  Spy  39.64"
[1] "upAcc 1995-03-31"
[1] "upEnd 1995-03-31"
[1] "equity  0  date  1995-04-28  Spy  40.81"
[1] "upAcc 1995-04-28"
[1] "upEnd 1995-04-28"
[1] "equity  0  date  1995-05-31  Spy  42.43"
[1] "upAcc 1995-05-31"
[1] "upEnd 1995-05-31"
[1] "equity  0  date  1995-06-30  Spy  43.29"
[1] "upAcc 1995-06-30"
[1] "upEnd 1995-06-30"
[1] "equity  0  date  1995-07-31  Spy  44.68"
[1] "upAcc 1995-07-31"
[1] "upEnd 1995-07-31"
[1] "equity  0  date  1995-08-31  Spy  44.88"
[1] "upAcc 1995-08-31"
[1] "upEnd 1995-08-31"
[1] "equity  0  date  1995-09-29  Spy  46.77"
[1] "upAcc 1995-09-29"
[1] "upEnd 1995-09-29"
[1] "equity  0  date  1995-10-31  Spy  46.64"
[1] "buy"
[1] "1995-10-31 SPY 0 @ 46.64"
[1] "upAcc 1995-10-31"
[1] "upEnd 1995-10-31"

Latter on, it fails on updateEndEq("acc", as.character(currentDate))

Error in if (length(c(year, month, day, hour, min, sec)) == 6 && c(year,  : 
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In as_numeric(YYYY) : NAs introduced by coercion
2: In as_numeric(YYYY) : NAs introduced by coercion

Thank you.

-- 
View this message in context: http://n4.nabble.com/Blotter-package-problem-with-example-tp1018634p1573514.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list