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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Nov 4 14:32:35 CET 2011


Author: gsee
Date: 2011-11-04 14:32:35 +0100 (Fri, 04 Nov 2011)
New Revision: 830

Modified:
   pkg/blotter/R/tradeStats.R
Log:
 replace deprecated sd(<matrix>) with apply(*, 2, sd)


Modified: pkg/blotter/R/tradeStats.R
===================================================================
--- pkg/blotter/R/tradeStats.R	2011-10-25 21:26:34 UTC (rev 829)
+++ pkg/blotter/R/tradeStats.R	2011-11-04 13:32:35 UTC (rev 830)
@@ -89,7 +89,7 @@
             
             AvgTradePL <- mean(PL.ne0)
             MedTradePL <- median(PL.ne0)
-            StdTradePL <- as.numeric(sd(PL.ne0))   
+            StdTradePL <- as.numeric(apply(PL.ne0, 2, sd))   
             
             NumberOfTrades <- nrow(txn)-1
             
@@ -110,7 +110,7 @@
             DailyPL <- apply.daily(PL.ne0,sum)
             AvgDailyPL <- mean(DailyPL)
             MedDailyPL <- median(DailyPL)
-            StdDailyPL <- as.numeric(sd(DailyPL))
+            StdDailyPL <- as.numeric(apply(DailyPL, 2, sd))
             
             Equity <- cumsum(posPL$Net.Trading.PL)
             if(!nrow(Equity)){
@@ -298,7 +298,7 @@
         
         AvgDayPL <- as.numeric(mean(PL.ne0))
         MedDayPL <- as.numeric(median(PL.ne0))
-        StdDayPL <- as.numeric(sd(PL.ne0))   
+        StdDayPL <- as.numeric(apply(PL.ne0, 2, sd))   
         
         #NumberOfDays <- nrow(txn)
         WinDays <-length(PL.gt0)
@@ -319,7 +319,7 @@
         
         AvgDailyPL <- as.numeric(mean(PL.ne0))
         MedDailyPL <- as.numeric(median(PL.ne0))
-        StdDailyPL <- as.numeric(sd(PL.ne0))
+        StdDailyPL <- as.numeric(apply(PL.ne0, 2, sd))
         
         Equity <- cumsum(x)
         Equity.max <- cummax(Equity)
@@ -372,14 +372,14 @@
     return(ret)
 }
 
-###############################################################################
-# Blotter: Tools for transaction-oriented trading systems development
-# for R (see http://r-project.org/) 
-# Copyright (c) 2008-2011 Peter Carl and Brian G. Peterson
-#
-# This library is distributed under the terms of the GNU Public License (GPL)
-# for full details see the file COPYING
-#
-# $Id$
-#
-###############################################################################
+###############################################################################
+# Blotter: Tools for transaction-oriented trading systems development
+# for R (see http://r-project.org/) 
+# Copyright (c) 2008-2011 Peter Carl and Brian G. Peterson
+#
+# This library is distributed under the terms of the GNU Public License (GPL)
+# for full details see the file COPYING
+#
+# $Id$
+#
+###############################################################################



More information about the Blotter-commits mailing list