[Blotter-commits] r1187 - in pkg/blotter: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Sep 15 18:07:10 CEST 2012


Author: braverock
Date: 2012-09-15 18:07:10 +0200 (Sat, 15 Sep 2012)
New Revision: 1187

Modified:
   pkg/blotter/R/chart.ME.R
   pkg/blotter/R/tradeStats.R
   pkg/blotter/man/tradeStats.Rd
Log:
- add details of coluns included in tradeStats fn
- fix typo


Modified: pkg/blotter/R/chart.ME.R
===================================================================
--- pkg/blotter/R/chart.ME.R	2012-09-15 15:15:57 UTC (rev 1186)
+++ pkg/blotter/R/chart.ME.R	2012-09-15 16:07:10 UTC (rev 1187)
@@ -156,7 +156,7 @@
     # if the last trade is still open, adjust depending on whether wants open trades or not
     if(length(trades$Start)>length(trades$End))
     {
-        if(includeOpenTrades)
+        if(includeOpenTrade)
             trades$End <- c(trades$End,last(index(posPL)))
         else
             trades$Start <- head(trades$Start, -1)

Modified: pkg/blotter/R/tradeStats.R
===================================================================
--- pkg/blotter/R/tradeStats.R	2012-09-15 15:15:57 UTC (rev 1186)
+++ pkg/blotter/R/tradeStats.R	2012-09-15 16:07:10 UTC (rev 1187)
@@ -31,12 +31,46 @@
 #' WARNING: we're not sure this function is stable/complete yet.  If you're using it, please give us feedback!
 #' 
 #' @aliases dailyStats
+#' @seealso \code{\link{chart.ME}} for a chart of MAE and MFE derived from trades, 
+#' and \code{\link{perTradeStats}} for detailed statistics on a per-trade basis
 #' @param Portfolios portfolio string 
 #' @param Symbols character vector of symbol strings, default NULL
 #' @param use for dailyStats, determines whether numbers are calculated from trades or equity curve
 #' @author Lance Levenson
 #' @export
 #' @importFrom zoo as.Date
+#' @return
+#' a \code{data.frame} containing:
+#'  
+#' \describe{
+#'    \item{Portfolio}{ name of the portfolio}
+#'    \item{Symbol}{ symbol name }
+#'    \item{Num.Txns}{ number of transactions produced by \code{\link{addTxn}} }
+#'    \item{Num.Trades}{ number of \emph{flat to flat} trades performed }
+#'    \item{Net.Trading.PL}{ }
+#'    \item{Avg.Trade.PL}{ mean trading P&L per trade }
+#'    \item{Med.Trade.PL}{ median trading P&L per trade}
+#'    \item{Largest.Winner}{ largest winning trade }
+#'    \item{Largest.Loser}{ largest losing trade }
+#'    \item{Gross.Profits}{ gross (pre-fee) trade profits }
+#'    \item{Gross.Losses}{ gross trade losses }
+#'    \item{Std.Dev.Trade.PL}{ standard deviation of trade P&L }
+#'    \item{Percent.Positive}{ percent of trades that end positive }
+#'    \item{Percent.Negative}{ percent of trades that end negative }
+#'    \item{Profit.Factor}{ absolute value ration of gross profits over gross losses }
+#'    \item{Avg.Win.Trade}{ mean P&L of profitabloe trades }
+#'    \item{Med.Win.Trade}{ median P&L of profitable trades }
+#'    \item{Avg.Losing.Trade}{ mean P&L of losing trades }
+#'    \item{Med.Losing.Trade}{ median P&L of losing trades }
+#'    \item{Avg.Daily.PL}{mean daily P&L  }
+#'    \item{Med.Daily.PL}{ median daily P&L }
+#'    \item{Std.Dev.Daily.PL}{ standard deviation of daliy P&L }
+#'    \item{Max.Drawdown}{ max drawdown }
+#'    \item{Avg.WinLoss.Ratio}{ ration of mean winning over mean losing trade }
+#'    \item{Med.WinLoss.Ratio}{ ratio of median winning trade over mean losing trade }
+#'    \item{Max.Equity}{ maximum account equity }
+#'    \item{Min.Equity}{ minimum account equity }
+#' }
 #' @note
 #' TODO document each statistic included in this function, with equations 
 #' 

Modified: pkg/blotter/man/tradeStats.Rd
===================================================================
--- pkg/blotter/man/tradeStats.Rd	2012-09-15 15:15:57 UTC (rev 1186)
+++ pkg/blotter/man/tradeStats.Rd	2012-09-15 16:07:10 UTC (rev 1187)
@@ -16,6 +16,38 @@
   \item{use}{for dailyStats, determines whether numbers are
   calculated from trades or equity curve}
 }
+\value{
+  a \code{data.frame} containing:
+
+  \describe{ \item{Portfolio}{ name of the portfolio}
+  \item{Symbol}{ symbol name } \item{Num.Txns}{ number of
+  transactions produced by \code{\link{addTxn}} }
+  \item{Num.Trades}{ number of \emph{flat to flat} trades
+  performed } \item{Net.Trading.PL}{ } \item{Avg.Trade.PL}{
+  mean trading P&L per trade } \item{Med.Trade.PL}{ median
+  trading P&L per trade} \item{Largest.Winner}{ largest
+  winning trade } \item{Largest.Loser}{ largest losing
+  trade } \item{Gross.Profits}{ gross (pre-fee) trade
+  profits } \item{Gross.Losses}{ gross trade losses }
+  \item{Std.Dev.Trade.PL}{ standard deviation of trade P&L
+  } \item{Percent.Positive}{ percent of trades that end
+  positive } \item{Percent.Negative}{ percent of trades
+  that end negative } \item{Profit.Factor}{ absolute value
+  ration of gross profits over gross losses }
+  \item{Avg.Win.Trade}{ mean P&L of profitabloe trades }
+  \item{Med.Win.Trade}{ median P&L of profitable trades }
+  \item{Avg.Losing.Trade}{ mean P&L of losing trades }
+  \item{Med.Losing.Trade}{ median P&L of losing trades }
+  \item{Avg.Daily.PL}{mean daily P&L } \item{Med.Daily.PL}{
+  median daily P&L } \item{Std.Dev.Daily.PL}{ standard
+  deviation of daliy P&L } \item{Max.Drawdown}{ max
+  drawdown } \item{Avg.WinLoss.Ratio}{ ration of mean
+  winning over mean losing trade }
+  \item{Med.WinLoss.Ratio}{ ratio of median winning trade
+  over mean losing trade } \item{Max.Equity}{ maximum
+  account equity } \item{Min.Equity}{ minimum account
+  equity } }
+}
 \description{
   This function calculates trade-level statistics on a
   symbol or symbols within a portfolio or portfolios.
@@ -74,4 +106,9 @@
 \author{
   Lance Levenson
 }
+\seealso{
+  \code{\link{chart.ME}} for a chart of MAE and MFE derived
+  from trades, and \code{\link{perTradeStats}} for detailed
+  statistics on a per-trade basis
+}
 



More information about the Blotter-commits mailing list