[Blotter-commits] r460 - pkg/blotter/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Nov 21 17:32:25 CET 2010
Author: braverock
Date: 2010-11-21 17:32:24 +0100 (Sun, 21 Nov 2010)
New Revision: 460
Modified:
pkg/blotter/R/updatePosPL.R
Log:
- fix to allow explicit passing of Prices into .updatePosPL
+ patch presented by Soren < me <at> censix <dot> com >
Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R 2010-11-21 16:06:45 UTC (rev 459)
+++ pkg/blotter/R/updatePosPL.R 2010-11-21 16:32:24 UTC (rev 460)
@@ -9,7 +9,8 @@
#' @author Peter Carl, Brian Peterson
.updatePosPL <- function(Portfolio, Symbol, Dates=NULL, Prices=NULL, ConMult=NULL, ...)
{ # @author Peter Carl, Brian Peterson
- rmfirst=FALSE
+ rmfirst=FALSE
+ prices=NULL
pname<-Portfolio
Portfolio<-getPortfolio(pname)
p.ccy.str<-attr(Portfolio,'currency')
@@ -21,9 +22,11 @@
if(is.null(Prices)){
prices=getPrice(get(Symbol, envir=as.environment(.GlobalEnv)))
- }
+ } else {
+ prices=Prices
+ }
- if(is.null(Dates)) {# if no date is specified, get all available dates
+ if(is.null(Dates)) {# if no date is specified, get all available dates
Dates = time(prices)
} else if(!is.timeBased(Dates)) Dates = time(prices[Dates])
More information about the Blotter-commits
mailing list