[Blotter-commits] r477 - pkg/blotter/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Nov 29 20:17:55 CET 2010
Author: braverock
Date: 2010-11-29 20:17:55 +0100 (Mon, 29 Nov 2010)
New Revision: 477
Modified:
pkg/blotter/R/updatePosPL.R
Log:
- adapt patch to take last available price from Valdas Kondrotas related to R-Forge tracker 3697
Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R 2010-11-28 21:34:33 UTC (rev 476)
+++ pkg/blotter/R/updatePosPL.R 2010-11-29 19:17:55 UTC (rev 477)
@@ -42,6 +42,11 @@
Prices<-prices[dateRange]
if(ncol(Prices)>1) Prices=getPrice(prices,Symbol)[dateRange]
+
+ if(nrow(Prices)<1) {
+ Prices=xts(cbind(Prices=as.numeric(last(prices[paste('::',endDate,sep='')]))),as.Date(endDate))
+ warning('no Prices available for ',Symbol,' in ',dateRange,' : using last available price and marking to ', endDate)
+ }
# Prices <- Prices[dateRange][,1] # only take the first column, if there is more than one
More information about the Blotter-commits
mailing list