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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 31 21:39:07 CET 2011


Author: braverock
Date: 2011-01-31 21:39:07 +0100 (Mon, 31 Jan 2011)
New Revision: 546

Modified:
   pkg/blotter/R/tradeStats.R
Log:
- minor cleanup to stats

Modified: pkg/blotter/R/tradeStats.R
===================================================================
--- pkg/blotter/R/tradeStats.R	2011-01-28 14:49:53 UTC (rev 545)
+++ pkg/blotter/R/tradeStats.R	2011-01-31 20:39:07 UTC (rev 546)
@@ -195,11 +195,8 @@
         ## Trade Statistics
         for (symbol in symbols){
             txn <- Portfolio$symbols[[symbol]]$txn
-            posPL <- Portfolio$symbols[[symbol]]$posPL
-            posPL <- posPL[-1,]
+            txn <- txn[-1,] # remove initialization row
             
-            #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]
             
             DailyPL <- apply.daily(PL.ne0,sum)
@@ -236,13 +233,9 @@
         
         ## Trade Statistics
         for (symbol in symbols){
-            txn <- Portfolio$symbols[[symbol]]$txn
             posPL <- Portfolio$symbols[[symbol]]$posPL
-            posPL <- posPL[-1,]
+            posPL <- posPL[-1,] # remove initialization row
             
-            #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]
             Equity <- cumsum(posPL$Net.Trading.PL)
             
             #DailyPL <- apply.daily(Equity,last)



More information about the Blotter-commits mailing list