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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 24 18:59:06 CET 2011


Author: braverock
Date: 2011-01-24 18:59:06 +0100 (Mon, 24 Jan 2011)
New Revision: 538

Modified:
   pkg/blotter/R/tradeStats.R
Log:
- handle case of no days with trades/PL

Modified: pkg/blotter/R/tradeStats.R
===================================================================
--- pkg/blotter/R/tradeStats.R	2011-01-24 16:31:59 UTC (rev 537)
+++ pkg/blotter/R/tradeStats.R	2011-01-24 17:59:06 UTC (rev 538)
@@ -78,7 +78,7 @@
             PL.gt0 <- txn$Net.Txn.Realized.PL[txn$Net.Txn.Realized.PL  > 0]
             PL.lt0 <- txn$Net.Txn.Realized.PL[txn$Net.Txn.Realized.PL  < 0]
             PL.ne0 <- txn$Net.Txn.Realized.PL[txn$Net.Txn.Realized.PL != 0]
-            
+            if(!nrow(PL.ne0))next()
             TotalNetProfit <- sum(txn$Net.Txn.Realized.PL)
             
             GrossProfits <- sum(PL.gt0)



More information about the Blotter-commits mailing list