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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jun 10 01:12:43 CEST 2011


Author: gsee
Date: 2011-06-10 01:12:43 +0200 (Fri, 10 Jun 2011)
New Revision: 619

Modified:
   pkg/blotter/R/chart.Posn.R
   pkg/blotter/R/updatePosPL.R
Log:
-elimnate warnings
-check for null b/f counting rows of Buys/Sells in chart.Posn
-use && instead of & in if statement in updatePosPL


Modified: pkg/blotter/R/chart.Posn.R
===================================================================
--- pkg/blotter/R/chart.Posn.R	2011-06-08 22:31:43 UTC (rev 618)
+++ pkg/blotter/R/chart.Posn.R	2011-06-09 23:12:43 UTC (rev 619)
@@ -65,8 +65,8 @@
     if(!is.null(Dates)) Prices=Prices[Dates]
     
     chart_Series(Prices, name=Symbol, TA=NULL)
-    if(nrow(Buys)>=1) (add_TA(Buys,pch=2,type='p',col='green', on=1));
-    if(nrow(Sells)>=1) (add_TA(Sells,pch=6,type='p',col='red', on=1));
+    if(!is.null(nrow(Buys)) && nrow(Buys) >=1 ) (add_TA(Buys,pch=2,type='p',col='green', on=1));
+    if(!is.null(nrow(Sells)) && nrow(Sells) >= 1) (add_TA(Sells,pch=6,type='p',col='red', on=1));
     if(nrow(Position)>=1) {
         (add_TA(Positionfill,type='l',col='blue', lwd=2))   
         (add_TA(Position,type='p',col='blue', lwd=2, on=2))   

Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R	2011-06-08 22:31:43 UTC (rev 618)
+++ pkg/blotter/R/updatePosPL.R	2011-06-09 23:12:43 UTC (rev 619)
@@ -173,7 +173,7 @@
 		message("no currency set on portfolio, using currency multiplier of 1")
 		CcyMult =1
 	}
-	if(is.na(CcyMult) & !is.na(FXrate)) {
+	if(is.na(CcyMult) && !is.na(FXrate)) {
 		if(inherits(FXrate,'xts')){
 			CcyMult <- FXrate[dateRange]
 			CcyMult <- na.locf(merge(CcyMult,index(TmpPeriods)))



More information about the Blotter-commits mailing list