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

Brian G. Peterson brian at braverock.com
Mon Mar 1 14:48:00 CET 2010


You did not provide a reproducible example, only a slice from some other 
code. 

I do not see the problem you describe in the 'blotter' demos or in any 
of my code. 

Please provide more information, and your name would be nice too.

Regards,

   - Brian

kafkaz wrote:
> 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.
>
>   


-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list