[Blotter-commits] r1641 - pkg/blotter/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 21 04:57:12 CEST 2014
Author: bodanker
Date: 2014-10-21 04:57:11 +0200 (Tue, 21 Oct 2014)
New Revision: 1641
Modified:
pkg/blotter/R/AcctReturns.R
pkg/blotter/R/PortfReturns.R
pkg/blotter/R/extractTests.R
pkg/blotter/R/getEndEq.R
pkg/blotter/R/getPortfAcct.R
pkg/blotter/R/getPortfolio.R
pkg/blotter/R/getTxn.R
pkg/blotter/R/initAcct.R
pkg/blotter/R/initPortf.R
pkg/blotter/R/updateEndEq.R
Log:
- Standardize spacing in account/portfolio messages for
name "already exists"/"not found" errors
Modified: pkg/blotter/R/AcctReturns.R
===================================================================
--- pkg/blotter/R/AcctReturns.R 2014-10-11 21:54:35 UTC (rev 1640)
+++ pkg/blotter/R/AcctReturns.R 2014-10-21 02:57:11 UTC (rev 1641)
@@ -65,8 +65,7 @@
Account <- try(get(aname, envir = .blotter))
}
if(inherits(Account, "try-error")){
- stop(paste("Account ", aname, " not found, use initAcct() to create a new
- account"))
+ stop("Account ", aname, " not found, use initAcct() to create a new account")
}
if(!inherits(Account, "account")){
stop("Account ", aname, " passed is not the name of an account object.")
Modified: pkg/blotter/R/PortfReturns.R
===================================================================
--- pkg/blotter/R/PortfReturns.R 2014-10-11 21:54:35 UTC (rev 1640)
+++ pkg/blotter/R/PortfReturns.R 2014-10-21 02:57:11 UTC (rev 1641)
@@ -29,8 +29,9 @@
else Account<-try(get(aname,envir=.blotter), silent=TRUE)
if(inherits(Account,"try-error"))
- stop(paste("Account ",aname," not found, use initAcct() to create a new account"))
- if(!inherits(Account,"account")) stop("Account ",aname," passed is not the name of an account object.")
+ stop("Account ", aname, " not found, use initAcct() to create a new account")
+ if(!inherits(Account,"account"))
+ stop("Account ", aname, " passed is not the name of an account object.")
if(is.null(Portfolios)) Portfolios = names(Account$portfolios)
Modified: pkg/blotter/R/extractTests.R
===================================================================
--- pkg/blotter/R/extractTests.R 2014-10-11 21:54:35 UTC (rev 1640)
+++ pkg/blotter/R/extractTests.R 2014-10-21 02:57:11 UTC (rev 1641)
@@ -23,7 +23,7 @@
pname <- Portfolio
Portfolio<-get(paste("portfolio",pname,sep='.'),envir=.blotter)
if(inherits(Portfolio,"try-error"))
- stop(paste("Portfolio",pname," not found, use initPortf() to create a new portfolio first"))
+ stop("Portfolio ", pname, " not found, use initPortf() to create a new portfolio first")
out<-NULL
symbolnames<-ls(Portfolio[['symbols']])
for (Symbol in symbolnames) {
Modified: pkg/blotter/R/getEndEq.R
===================================================================
--- pkg/blotter/R/getEndEq.R 2014-10-11 21:54:35 UTC (rev 1640)
+++ pkg/blotter/R/getEndEq.R 2014-10-21 02:57:11 UTC (rev 1641)
@@ -8,7 +8,7 @@
aname<-Account
Account<-try(get(paste("account",aname,sep='.'), envir=.blotter), silent=TRUE)
if(inherits(Account,"try-error"))
- stop(paste("Account",aname," not found, use initAcct() to create a new account"))
+ stop("Account ", aname, " not found, use initAcct() to create a new account")
toDate = paste('::', Date, sep="")
EndEq = as.numeric(tail(Account$summary[toDate,], n=1)[,"End.Eq"])
Modified: pkg/blotter/R/getPortfAcct.R
===================================================================
--- pkg/blotter/R/getPortfAcct.R 2014-10-11 21:54:35 UTC (rev 1640)
+++ pkg/blotter/R/getPortfAcct.R 2014-10-21 02:57:11 UTC (rev 1641)
@@ -7,11 +7,11 @@
{ # @author Brian Peterson
acct<-suppressWarnings(try(get(paste("account",Account,sep='.'),envir=.blotter),silent=TRUE))
if(inherits(acct,"try-error"))
- stop(paste("Account",Account,"not found, use initAcct() to create a new account."))
+ stop("Account ", Account, " not found, use initAcct() to create a new account.")
pname=Portfolio
Portfolio<-suppressWarnings(try(acct[[paste("portfolio",pname,sep='.')]],silent=TRUE))
if(inherits(Portfolio,"try-error"))
- stop(paste("Portfolio",pname,"not found, use initPortf() to create a new portfolio or initAcct() to place it in",Account))
+ stop("Portfolio ", pname, " not found, use initPortf() to create a new portfolio or initAcct() to place it in ",Account)
if(!is.null(Dates)){
Portfolio<-Portfolio[Dates]
Modified: pkg/blotter/R/getPortfolio.R
===================================================================
--- pkg/blotter/R/getPortfolio.R 2014-10-11 21:54:35 UTC (rev 1640)
+++ pkg/blotter/R/getPortfolio.R 2014-10-21 02:57:11 UTC (rev 1641)
@@ -48,8 +48,9 @@
if(!grepl("portfolio\\.",pname)) Portfolio<-suppressWarnings(try(get(paste("portfolio",pname,sep='.'),envir=envir),silent=TRUE))
else Portfolio<-suppressWarnings(try(get(pname,envir=envir),silent=TRUE))
if(inherits(Portfolio,"try-error"))
- stop(paste("Portfolio",pname," not found, use initPortf() to create a new portfolio"))
- if(!inherits(Portfolio,"portfolio")) stop("Portfolio",pname,"passed is not the name of a portfolio object.")
+ stop("Portfolio ", pname, " not found, use initPortf() to create a new portfolio")
+ if(!inherits(Portfolio,"portfolio"))
+ stop("Portfolio ", pname, " passed is not the name of a portfolio object.")
return(Portfolio)
}
Modified: pkg/blotter/R/getTxn.R
===================================================================
--- pkg/blotter/R/getTxn.R 2014-10-11 21:54:35 UTC (rev 1640)
+++ pkg/blotter/R/getTxn.R 2014-10-21 02:57:11 UTC (rev 1641)
@@ -16,7 +16,7 @@
pname<-Portfolio
Portfolio<-get(paste("portfolio",pname,sep='.'), envir=.blotter)
if(inherits(Portfolio,"try-error"))
- stop(paste("Portfolio",pname," not found, use initPortf() to create a new portfolio first"))
+ stop("Portfolio ", pname, " not found, use initPortf() to create a new portfolio first")
TxnData = Portfolio$symbols[[Symbol]]$txn
Txns = TxnData[Dates,c('Txn.Qty', 'Txn.Price', 'Txn.Fees', 'Txn.Value', 'Txn.Avg.Cost', 'Net.Txn.Realized.PL')]
Modified: pkg/blotter/R/initAcct.R
===================================================================
--- pkg/blotter/R/initAcct.R 2014-10-11 21:54:35 UTC (rev 1640)
+++ pkg/blotter/R/initAcct.R 2014-10-21 02:57:11 UTC (rev 1641)
@@ -52,7 +52,7 @@
{ # @author Peter Carl
if(exists(paste("account",name,sep='.'), envir=.blotter,inherits=TRUE))
- stop(paste("Account",name,"already exists, use updateAcct() or create a new account."))
+ stop("Account ", name, " already exists, use updateAcct() or create a new account.")
# FUNCTION
account=list()
Modified: pkg/blotter/R/initPortf.R
===================================================================
--- pkg/blotter/R/initPortf.R 2014-10-11 21:54:35 UTC (rev 1640)
+++ pkg/blotter/R/initPortf.R 2014-10-21 02:57:11 UTC (rev 1641)
@@ -61,7 +61,7 @@
initPortf <- function(name="default", symbols, initPosQty = 0, initDate = '1950-01-01', currency='USD', ...)
{ # @author Peter Carl
if(exists(paste("portfolio",name,sep='.'), envir=.blotter,inherits=TRUE))
- stop(paste("Portfolio",name,"already exists, use updatePortf() or addPortfInstr() to update it."))
+ stop("Portfolio ", name, " already exists, use updatePortf() or addPortfInstr() to update it.")
# FUNCTION
Modified: pkg/blotter/R/updateEndEq.R
===================================================================
--- pkg/blotter/R/updateEndEq.R 2014-10-11 21:54:35 UTC (rev 1640)
+++ pkg/blotter/R/updateEndEq.R 2014-10-21 02:57:11 UTC (rev 1641)
@@ -15,7 +15,7 @@
aname<-Account
Account<-try(get(paste("account",aname,sep='.'), envir=.blotter), silent=TRUE)
if(inherits(Account,"try-error"))
- stop(paste("Account",aname," not found, use initAcct() to create a new account"))
+ stop("Account ", aname, " not found, use initAcct() to create a new account")
if(is.null(Dates)) # if no date is specified, get all available dates
Dates = index(Account$summary)[-1]
More information about the Blotter-commits
mailing list