[Blotter-commits] r277 - pkg/blotter/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 3 16:21:33 CET 2010


Author: braverock
Date: 2010-03-03 16:21:33 +0100 (Wed, 03 Mar 2010)
New Revision: 277

Modified:
   pkg/blotter/R/getAccount.R
   pkg/blotter/R/getPortfolio.R
Log:
- search for portfolio or account followed by a dot, to allow those words in user-supplied names
- fix for bug 837, reported by Mark Breman

Modified: pkg/blotter/R/getAccount.R
===================================================================
--- pkg/blotter/R/getAccount.R	2010-03-01 16:07:56 UTC (rev 276)
+++ pkg/blotter/R/getAccount.R	2010-03-03 15:21:33 UTC (rev 277)
@@ -1,7 +1,7 @@
 getAccount <- function(Account, Dates=NULL) #should symbol subsets be supported too?  probably not.
 { # @author Brian Peterson
     aname<-Account
-    if(!grepl("account",aname)) Account<-try(get(paste("account",aname,sep='.'),envir=.blotter))
+    if(!grepl("account\\.",aname)) Account<-try(get(paste("account",aname,sep='.'),envir=.blotter))
     else Account<-try(get(aname,envir=.blotter))
     if(inherits(Account,"try-error"))
         stop(paste("Account ",aname," not found, use initAcct() to create a new account"))

Modified: pkg/blotter/R/getPortfolio.R
===================================================================
--- pkg/blotter/R/getPortfolio.R	2010-03-01 16:07:56 UTC (rev 276)
+++ pkg/blotter/R/getPortfolio.R	2010-03-03 15:21:33 UTC (rev 277)
@@ -1,7 +1,7 @@
 getPortfolio <- function(Portfolio, Dates=NULL) #should symbol subsets be supported too?  probably not.
 { # @author Brian Peterson
     pname<-Portfolio
-    if(!grepl("portfolio",pname)) Portfolio<-try(get(paste("portfolio",pname,sep='.'),envir=.blotter))
+    if(!grepl("portfolio\\.",pname)) Portfolio<-try(get(paste("portfolio",pname,sep='.'),envir=.blotter))
     else Portfolio<-try(get(pname,envir=.blotter))
     if(inherits(Portfolio,"try-error"))
         stop(paste("Portfolio",pname," not found, use initPortf() to create a new portfolio"))



More information about the Blotter-commits mailing list