From noreply at r-forge.r-project.org Fri May 2 17:48:00 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 2 May 2014 17:48:00 +0200 (CEST) Subject: [Blotter-commits] r1606 - pkg/blotter/R Message-ID: <20140502154800.17B01186D5F@r-forge.r-project.org> Author: efmrforge Date: 2014-05-02 17:47:59 +0200 (Fri, 02 May 2014) New Revision: 1606 Modified: pkg/blotter/R/tradeStats.R Log: Fixed typo ( to { at Ann.Sharpe Modified: pkg/blotter/R/tradeStats.R =================================================================== --- pkg/blotter/R/tradeStats.R 2014-04-27 05:26:52 UTC (rev 1605) +++ pkg/blotter/R/tradeStats.R 2014-05-02 15:47:59 UTC (rev 1606) @@ -75,7 +75,7 @@ #' \item{Avg.Daily.PL}{mean daily realized P&L on days there were transactions, see \code{\link{dailyStats}} for all days } #' \item{Med.Daily.PL}{ median daily P&L } #' \item{Std.Dev.Daily.PL}{ standard deviation of daily P&L } -#' \item(Ann.Sharpe){annualized Sharpe-like ratio, assuming no outside capital additions and 252 day count convention} +#' \item{Ann.Sharpe}{annualized Sharpe-like ratio, assuming no outside capital additions and 252 day count convention} #' \item{Max.Drawdown}{ max drawdown } #' \item{Avg.WinLoss.Ratio}{ ratio of mean winning over mean losing trade } #' \item{Med.WinLoss.Ratio}{ ratio of median winning trade over median losing trade } From noreply at r-forge.r-project.org Sat May 3 16:02:38 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 3 May 2014 16:02:38 +0200 (CEST) Subject: [Blotter-commits] r1607 - in pkg/blotter: . R man Message-ID: <20140503140238.5A03818714D@r-forge.r-project.org> Author: gsee Date: 2014-05-03 16:02:37 +0200 (Sat, 03 May 2014) New Revision: 1607 Modified: pkg/blotter/DESCRIPTION pkg/blotter/R/addAcctTxn.R pkg/blotter/man/addAcctTxn.Rd pkg/blotter/man/tradeStats.Rd Log: make docs match usage and roxygenize, bumped to 0.8.19 Modified: pkg/blotter/DESCRIPTION =================================================================== --- pkg/blotter/DESCRIPTION 2014-05-02 15:47:59 UTC (rev 1606) +++ pkg/blotter/DESCRIPTION 2014-05-03 14:02:37 UTC (rev 1607) @@ -2,7 +2,7 @@ Type: Package Title: Tools for transaction-oriented trading systems development. -Version: 0.8.18 +Version: 0.8.19 Date: $Date$ Author: Peter Carl, Brian G. Peterson Maintainer: Brian G. Peterson Modified: pkg/blotter/R/addAcctTxn.R =================================================================== --- pkg/blotter/R/addAcctTxn.R 2014-05-02 15:47:59 UTC (rev 1606) +++ pkg/blotter/R/addAcctTxn.R 2014-05-03 14:02:37 UTC (rev 1607) @@ -2,16 +2,16 @@ #' #' For the specified Account, take in the date, amount, and type of transaction and append it to the correct list in the account object #' -#' @param name Account name, as string +#' @param Account Account name, as string #' @param TxnDate transaction date as ISO 8601, e.g., '2008-09-01' or '2010-01-05 09:54:23.12345' #' @param TxnType string indicating the type of account transaction, only "Addition", "Withdrawal", or "Interest" are currently supported -#' @param amount As of now, the currency of the transaction MUST MATCH the currency of the Account. Patches welcome. +#' @param Amount As of now, the currency of the transaction MUST MATCH the currency of the Account. Patches welcome. #' @param \dots any other passthrough parameters #' @param verbose If TRUE (default) the function prints the elements of the transaction in a line to the screen, e.g., "2007-01-08 Withdrawal 15,012,235". Suppress using FALSE. #' @details #' Adds capital transactions to a rudimentary transactions table in the Account object. This may be useful when tracking the denominator of returns when there are changes to the account's capital or significant interest income. #' In the Account$summary table, there are several placeholder columns that mimic the CFTC's 13-column report. Columns of interest here are "Additions", "Withdrawals", and "Interest". -#' Transactions added with this function will be added into the appropriate one of three slots in the Account object (Account$additions, Account$withdrawals, or Account$Interest), which contains an xts object of individual transactions with a date and amount. The \code{\link{updateAcct}} function will read the transactions from each list in turn, aggregate them by the specified date scope, and slot them into the \code{Account$summary} table as it's built. \code{\link{UpdateEndEq}} should then just work. +#' Transactions added with this function will be added into the appropriate one of three slots in the Account object (Account$additions, Account$withdrawals, or Account$Interest), which contains an xts object of individual transactions with a date and amount. The \code{\link{updateAcct}} function will read the transactions from each list in turn, aggregate them by the specified date scope, and slot them into the \code{Account$summary} table as it's built. \code{\link{updateEndEq}} should then just work. #' #' @seealso \code{\link{initAcct}}, \code{\link{updateAcct}}, \code{\link{updateEndEq}} #' @author Peter Carl @@ -39,4 +39,4 @@ print(paste(format(TxnDate, "%Y-%m-%d %H:%M:%S"), TxnType, Amount, sep=" ")) assign(paste("account",aname,sep='.'), Account, envir=.blotter) -} \ No newline at end of file +} Modified: pkg/blotter/man/addAcctTxn.Rd =================================================================== --- pkg/blotter/man/addAcctTxn.Rd 2014-05-02 15:47:59 UTC (rev 1606) +++ pkg/blotter/man/addAcctTxn.Rd 2014-05-03 14:02:37 UTC (rev 1607) @@ -6,7 +6,7 @@ "Interest"), Amount, ..., verbose = TRUE) } \arguments{ - \item{name}{Account name, as string} + \item{Account}{Account name, as string} \item{TxnDate}{transaction date as ISO 8601, e.g., '2008-09-01' or '2010-01-05 09:54:23.12345'} @@ -15,7 +15,7 @@ transaction, only "Addition", "Withdrawal", or "Interest" are currently supported} - \item{amount}{As of now, the currency of the transaction + \item{Amount}{As of now, the currency of the transaction MUST MATCH the currency of the Account. Patches welcome.} @@ -48,7 +48,7 @@ transactions from each list in turn, aggregate them by the specified date scope, and slot them into the \code{Account$summary} table as it's built. -\code{\link{UpdateEndEq}} should then just work. +\code{\link{updateEndEq}} should then just work. } \author{ Peter Carl Modified: pkg/blotter/man/tradeStats.Rd =================================================================== --- pkg/blotter/man/tradeStats.Rd 2014-05-02 15:47:59 UTC (rev 1606) +++ pkg/blotter/man/tradeStats.Rd 2014-05-03 14:02:37 UTC (rev 1607) @@ -52,7 +52,7 @@ \code{\link{dailyStats}} for all days } \item{Med.Daily.PL}{ median daily P&L } \item{Std.Dev.Daily.PL}{ standard deviation of daily P&L } -\item(Ann.Sharpe){annualized Sharpe-like ratio, assuming no +\item{Ann.Sharpe}{annualized Sharpe-like ratio, assuming no outside capital additions and 252 day count convention} \item{Max.Drawdown}{ max drawdown } \item{Avg.WinLoss.Ratio}{ ratio of mean winning over mean From noreply at r-forge.r-project.org Sun May 4 16:32:35 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 4 May 2014 16:32:35 +0200 (CEST) Subject: [Blotter-commits] r1608 - pkg/quantstrat/src Message-ID: <20140504143235.8A81B18762B@r-forge.r-project.org> Author: bodanker Date: 2014-05-04 16:32:35 +0200 (Sun, 04 May 2014) New Revision: 1608 Modified: pkg/quantstrat/src/firstCross.c Log: - patch firstCross to coerce to numeric, if necessary Modified: pkg/quantstrat/src/firstCross.c =================================================================== --- pkg/quantstrat/src/firstCross.c 2014-05-03 14:02:37 UTC (rev 1607) +++ pkg/quantstrat/src/firstCross.c 2014-05-04 14:32:35 UTC (rev 1608) @@ -3,7 +3,7 @@ SEXP firstCross(SEXP x, SEXP th, SEXP rel, SEXP start) { - int i, int_rel, int_start; + int i, int_rel, int_start, P=0; double *real_x=NULL, real_th; if(ncols(x) > 1) @@ -11,6 +11,7 @@ /* this currently only works for real x and th arguments * support for other types may be added later */ + PROTECT(x = coerceVector(x, REALSXP)); P++; real_th = asReal(th); int_rel = asInteger(rel); int_start = asInteger(start)-1; @@ -49,6 +50,7 @@ default: error("unsupported relationship operator"); } + UNPROTECT(P); /* return number of observations if relationship is never TRUE */ return(ScalarInteger(nrows(x))); } From noreply at r-forge.r-project.org Thu May 8 13:08:00 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 8 May 2014 13:08:00 +0200 (CEST) Subject: [Blotter-commits] r1609 - pkg/quantstrat/src Message-ID: <20140508110800.75DDF1873CC@r-forge.r-project.org> Author: bodanker Date: 2014-05-08 13:08:00 +0200 (Thu, 08 May 2014) New Revision: 1609 Modified: pkg/quantstrat/src/firstCross.c Log: - Fix protect stack imbalance Modified: pkg/quantstrat/src/firstCross.c =================================================================== --- pkg/quantstrat/src/firstCross.c 2014-05-04 14:32:35 UTC (rev 1608) +++ pkg/quantstrat/src/firstCross.c 2014-05-08 11:08:00 UTC (rev 1609) @@ -16,42 +16,54 @@ int_rel = asInteger(rel); int_start = asInteger(start)-1; + /* return number of observations if relationship is never TRUE */ + SEXP result = ScalarInteger(nrows(x)); + switch(int_rel) { case 1: /* > */ real_x = REAL(x); for(i=int_start; i real_th) - return(ScalarInteger(i+1)); + if(real_x[i] > real_th) { + result = ScalarInteger(i+1); + break; + } break; case 2: /* < */ real_x = REAL(x); for(i=int_start; i real_th) { + result = ScalarInteger(i+1); + break; + } break; case 3: /* == */ real_x = REAL(x); for(i=int_start; i real_th) { + result = ScalarInteger(i+1); + break; + } break; case 4: /* >= */ real_x = REAL(x); for(i=int_start; i= real_th) - return(ScalarInteger(i+1)); + if(real_x[i] > real_th) { + result = ScalarInteger(i+1); + break; + } break; case 5: /* <= */ real_x = REAL(x); for(i=int_start; i real_th) { + result = ScalarInteger(i+1); + break; + } break; default: error("unsupported relationship operator"); } UNPROTECT(P); - /* return number of observations if relationship is never TRUE */ - return(ScalarInteger(nrows(x))); + return(result); } From noreply at r-forge.r-project.org Fri May 9 13:23:40 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 9 May 2014 13:23:40 +0200 (CEST) Subject: [Blotter-commits] r1610 - pkg/quantstrat/src Message-ID: <20140509112340.4267618767F@r-forge.r-project.org> Author: bodanker Date: 2014-05-09 13:23:39 +0200 (Fri, 09 May 2014) New Revision: 1610 Modified: pkg/quantstrat/src/firstCross.c Log: - Fix careless copy/paste error from r1609 Modified: pkg/quantstrat/src/firstCross.c =================================================================== --- pkg/quantstrat/src/firstCross.c 2014-05-08 11:08:00 UTC (rev 1609) +++ pkg/quantstrat/src/firstCross.c 2014-05-09 11:23:39 UTC (rev 1610) @@ -31,7 +31,7 @@ case 2: /* < */ real_x = REAL(x); for(i=int_start; i real_th) { + if(real_x[i] < real_th) { result = ScalarInteger(i+1); break; } @@ -39,7 +39,7 @@ case 3: /* == */ real_x = REAL(x); for(i=int_start; i real_th) { + if(real_x[i] == real_th) { result = ScalarInteger(i+1); break; } @@ -47,7 +47,7 @@ case 4: /* >= */ real_x = REAL(x); for(i=int_start; i real_th) { + if(real_x[i] >= real_th) { result = ScalarInteger(i+1); break; } @@ -55,7 +55,7 @@ case 5: /* <= */ real_x = REAL(x); for(i=int_start; i real_th) { + if(real_x[i] <= real_th) { result = ScalarInteger(i+1); break; } From noreply at r-forge.r-project.org Mon May 19 11:48:41 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 19 May 2014 11:48:41 +0200 (CEST) Subject: [Blotter-commits] r1611 - pkg/quantstrat/R Message-ID: <20140519094841.8B9C9186D5E@r-forge.r-project.org> Author: bodanker Date: 2014-05-19 11:48:41 +0200 (Mon, 19 May 2014) New Revision: 1611 Modified: pkg/quantstrat/R/rules.R Log: - patch 'prefer' handling for univariate series. Thanks to Gaurav Singhal and Paul Seymour for the reports and reproducible examples. Modified: pkg/quantstrat/R/rules.R =================================================================== --- pkg/quantstrat/R/rules.R 2014-05-09 11:23:39 UTC (rev 1610) +++ pkg/quantstrat/R/rules.R 2014-05-19 09:48:41 UTC (rev 1611) @@ -516,6 +516,7 @@ posQty = getPrice(mktdata, prefer='close')[,1], negQty = getPrice(mktdata, prefer='close')[,1])) } else { # univariate or something built with fn_SpreadBuilder + prefer <- if(hasArg("prefer")) match.call(expand.dots=TRUE)$prefer else NULL mktPrices <- list( stoplimit = list( price = getPrice(mktdata, prefer=prefer)[,1]), From noreply at r-forge.r-project.org Thu May 22 12:06:24 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 22 May 2014 12:06:24 +0200 (CEST) Subject: [Blotter-commits] r1612 - pkg/blotter/R Message-ID: <20140522100624.BBEAE18735F@r-forge.r-project.org> Author: bodanker Date: 2014-05-22 12:06:24 +0200 (Thu, 22 May 2014) New Revision: 1612 Modified: pkg/blotter/R/tradeStats.R Log: - Patch dailyStats to capture lowercase variants of 'use' Thanks to Lou Belle for the report Modified: pkg/blotter/R/tradeStats.R =================================================================== --- pkg/blotter/R/tradeStats.R 2014-05-19 09:48:41 UTC (rev 1611) +++ pkg/blotter/R/tradeStats.R 2014-05-22 10:06:24 UTC (rev 1612) @@ -330,10 +330,10 @@ { use=use[1] #take the first value if the user didn't specify switch (use, - Eq = , Equity =, cumPL = { + Eq =, eq =, Equity =, equity =, cumPL = { dailyPL <- dailyEqPL(Portfolios) }, - Txns =, Trades = { + Txns =, txns =, Trades =, trades = { dailyPL <- dailyTxnPL(Portfolios) } )