From noreply at r-forge.r-project.org Wed Mar 5 00:12:07 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 5 Mar 2014 00:12:07 +0100 (CET) Subject: [Blotter-commits] r1586 - pkg/quantstrat/R Message-ID: <20140304231207.C3452186858@r-forge.r-project.org> Author: bodanker Date: 2014-03-05 00:12:04 +0100 (Wed, 05 Mar 2014) New Revision: 1586 Modified: pkg/quantstrat/R/ruleOrderProc.R Log: - avoid throwing warnings when handling time in force in ruleOrderProc Modified: pkg/quantstrat/R/ruleOrderProc.R =================================================================== --- pkg/quantstrat/R/ruleOrderProc.R 2014-02-23 01:48:16 UTC (rev 1585) +++ pkg/quantstrat/R/ruleOrderProc.R 2014-03-04 23:12:04 UTC (rev 1586) @@ -68,13 +68,13 @@ tif.xts <- ordersubset[OpenOrders.i, 'Time.In.Force'] if(any(!tif.xts=='')) { - if (class(index(ordersubset))=='Date') + if (any(indexClass(ordersubset)=='Date')) tif <- as.Date(tif.xts) else { tif <- strptime(tif.xts, format='%Y-%m-%d %H:%M:%0S') - if(is.na(tif)) - tif <- strptime(tif.xts, format='%Y-%m-%d %H:%M:%S') + tif.na <- is.na(tif) + tif[tif.na] <- strptime(tif.xts[tif.na], format='%Y-%m-%d %H:%M:%S') } #check which ones should be expired From noreply at r-forge.r-project.org Wed Mar 5 00:39:36 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 5 Mar 2014 00:39:36 +0100 (CET) Subject: [Blotter-commits] r1587 - pkg/quantstrat/R Message-ID: <20140304233936.D6C0E18441E@r-forge.r-project.org> Author: bodanker Date: 2014-03-05 00:39:36 +0100 (Wed, 05 Mar 2014) New Revision: 1587 Modified: pkg/quantstrat/R/orders.R pkg/quantstrat/R/ruleOrderProc.R Log: - fix "0S" -> "OS" typo in addOrder and ruleOrderProc Modified: pkg/quantstrat/R/orders.R =================================================================== --- pkg/quantstrat/R/orders.R 2014-03-04 23:12:04 UTC (rev 1586) +++ pkg/quantstrat/R/orders.R 2014-03-04 23:39:36 UTC (rev 1587) @@ -370,7 +370,7 @@ if(is.numeric(time.in.force)) time.in.force <- timestamp + time.in.force - time.in.force <- format(time.in.force, "%Y-%m-%d %H:%M:%0S") + time.in.force <- format(time.in.force, "%Y-%m-%d %H:%M:%OS") #TODO FIXME this line probably needs to be sensitive to the index of the market data, Date vs POSIXct } } Modified: pkg/quantstrat/R/ruleOrderProc.R =================================================================== --- pkg/quantstrat/R/ruleOrderProc.R 2014-03-04 23:12:04 UTC (rev 1586) +++ pkg/quantstrat/R/ruleOrderProc.R 2014-03-04 23:39:36 UTC (rev 1587) @@ -72,7 +72,7 @@ tif <- as.Date(tif.xts) else { - tif <- strptime(tif.xts, format='%Y-%m-%d %H:%M:%0S') + tif <- strptime(tif.xts, format='%Y-%m-%d %H:%M:%OS') tif.na <- is.na(tif) tif[tif.na] <- strptime(tif.xts[tif.na], format='%Y-%m-%d %H:%M:%S') } From noreply at r-forge.r-project.org Wed Mar 5 15:29:10 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 5 Mar 2014 15:29:10 +0100 (CET) Subject: [Blotter-commits] r1588 - pkg/quantstrat/R Message-ID: <20140305142910.984BB186DAD@r-forge.r-project.org> Author: bodanker Date: 2014-03-05 15:29:09 +0100 (Wed, 05 Mar 2014) New Revision: 1588 Modified: pkg/quantstrat/R/ruleOrderProc.R Log: - fix bug introduced in 1587 Modified: pkg/quantstrat/R/ruleOrderProc.R =================================================================== --- pkg/quantstrat/R/ruleOrderProc.R 2014-03-04 23:39:36 UTC (rev 1587) +++ pkg/quantstrat/R/ruleOrderProc.R 2014-03-05 14:29:09 UTC (rev 1588) @@ -74,7 +74,8 @@ { tif <- strptime(tif.xts, format='%Y-%m-%d %H:%M:%OS') tif.na <- is.na(tif) - tif[tif.na] <- strptime(tif.xts[tif.na], format='%Y-%m-%d %H:%M:%S') + if(any(tif.na)) + tif[tif.na] <- strptime(tif.xts[tif.na], format='%Y-%m-%d %H:%M:%S') } #check which ones should be expired From noreply at r-forge.r-project.org Sat Mar 8 17:25:04 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 8 Mar 2014 17:25:04 +0100 (CET) Subject: [Blotter-commits] r1589 - in pkg/blotter: R man Message-ID: <20140308162504.B1108186CFA@r-forge.r-project.org> Author: braverock Date: 2014-03-08 17:25:03 +0100 (Sat, 08 Mar 2014) New Revision: 1589 Modified: pkg/blotter/R/tradeStats.R pkg/blotter/man/AcctReturns.Rd pkg/blotter/man/PortfReturns.Rd pkg/blotter/man/addAcctTxn.Rd pkg/blotter/man/addDiv.Rd pkg/blotter/man/addPortfInstr.Rd pkg/blotter/man/addTxn.Rd pkg/blotter/man/calcPortfWgt.Rd pkg/blotter/man/calcPosAvgCost.Rd pkg/blotter/man/calcTxnAvgCost.Rd pkg/blotter/man/calcTxnValue.Rd pkg/blotter/man/chart.ME.Rd pkg/blotter/man/chart.Posn.Rd pkg/blotter/man/chart.Reconcile.Rd pkg/blotter/man/chart.Spread.Rd pkg/blotter/man/dailyTxnPL.Rd pkg/blotter/man/extractTxns.Rd pkg/blotter/man/getAccount.Rd pkg/blotter/man/getByPortf.Rd pkg/blotter/man/getBySymbol.Rd pkg/blotter/man/getEndEq.Rd pkg/blotter/man/getPortfAcct.Rd pkg/blotter/man/getPortfolio.Rd pkg/blotter/man/getPos.Rd pkg/blotter/man/getPosAvgCost.Rd pkg/blotter/man/getPosQty.Rd pkg/blotter/man/getTxns.Rd pkg/blotter/man/initAcct.Rd pkg/blotter/man/initPortf.Rd pkg/blotter/man/initPosPL.Rd pkg/blotter/man/initSummary.Rd pkg/blotter/man/initTxn.Rd pkg/blotter/man/is.account.Rd pkg/blotter/man/is.portfolio.Rd pkg/blotter/man/pennyPerShare.Rd pkg/blotter/man/perTradeStats.Rd pkg/blotter/man/put.account.Rd pkg/blotter/man/put.portfolio.Rd pkg/blotter/man/tradeQuantiles.Rd pkg/blotter/man/tradeStats.Rd pkg/blotter/man/updateAcct.Rd pkg/blotter/man/updateEndEq.Rd pkg/blotter/man/updatePortf.Rd pkg/blotter/man/updatePosPL.Rd Log: - fix typos in tradeStats docs - upgrade to latest roxygen2 Modified: pkg/blotter/R/tradeStats.R =================================================================== --- pkg/blotter/R/tradeStats.R 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/R/tradeStats.R 2014-03-08 16:25:03 UTC (rev 1589) @@ -57,7 +57,7 @@ #' \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{Profit.Factor}{ absolute value ratio 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 } @@ -67,7 +67,7 @@ #' \item{Std.Dev.Daily.PL}{ standard deviation of daily P&L } #' \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 mean losing trade } +#' \item{Med.WinLoss.Ratio}{ ratio of median winning trade over median losing trade } #' \item{Max.Equity}{ maximum account equity } #' \item{Min.Equity}{ minimum account equity } #' } Modified: pkg/blotter/man/AcctReturns.Rd =================================================================== --- pkg/blotter/man/AcctReturns.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/AcctReturns.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -1,88 +1,87 @@ -\name{AcctReturns} -\alias{AcctReturns} -\title{Calculate account returns} -\usage{ - AcctReturns(Account, Dates = NULL, Portfolios = NULL, - method = c("timeweighted", "dietz"), ...) -} -\arguments{ - \item{Account}{string name of the account to generate - returns for} - - \item{\dots}{any other passthru parameters (like - \code{native} for \code{.getBySymbol}} - - \item{Dates}{xts style ISO 8601 date subset to retrieve, - default NULL (all dates)} - - \item{Portfolios}{concatenated string vector for - portfolio names to retrieve returns on, default NULL (all - portfolios)} - - \item{method}{Used to select between time-weighted and - linked modified Dietz returns. May be any of: - \itemize{\item timeweighted \item dietz} By default - time-weighted is selected} -} -\value{ - returns xts with account returns -} -\description{ - Similar to the \code{PortfReturns} function, but gives - returns for the entire account and takes into account - external cashflows. External cashflows are defined as - contributions to or withdrawals from the account. Allows - selecting between time-weighted returns and linked - modified Dietz approach. If time-weighted method is - selected, returns at time \eqn{t} are computed using: - \deqn{r_{t}=\frac{V_{t}}{V_{t-1}+C_{t}}-1} where - \eqn{V_{t}} - account value at time \eqn{t}, \eqn{C_{t}} - - cashflow at time \eqn{t}. The implicit assumption made - here is that the cash flow is available for the portfolio - manager to invest from the beginning of the day. These - returns then can be chain linked with geometric - compounding (for instance using \code{Return.cumulative} - function from the \code{PerformanceAnalytics} package) to - yield cumulative multi-period returns: - \deqn{1+r=\prod_{t=1}^{T}(1+r_{t})=\prod_{t=1}^{T}\frac{V_{t}}{V_{t-1}+C_{t}}} - In the case if there were no cashflows, the result - reduces to simple one-period returns. Time-weighted - returns has also an interpretation in terms of unit value - pricing. If Modified Dietz method is selected, monthly - returns are computed taking into account cashflows within - each month: \deqn{r = - \frac{V_{t}-V_{t-1}-C}{V_{t-1}+\sum_{t}C_{t}\times - W_{t}}} where \eqn{C} - total external cash flows within - a month, \eqn{C_{t}} - external cashflow at time \eqn{t}, - \deqn{W_{t}=\frac{TD-D_{t}}{TD}} - weighting ratio to be - applied to external cashflow on day \eqn{t}, \eqn{TD} - - total number of days within the month, \eqn{D_{t}} - - number of days since the beginning of the month including - weekends and public holidays. Finally monthly Modified - Dietz returns can also be linked geometrically. -} -\note{ - TODO handle portfolio and account in different currencies - (not hard, just not done) - - TODO explicitly handle portfolio weights - - TODO support additions and withdrawals to available - capital -} -\author{ - Brian Peterson, Andrii Babii -} -\references{ - Christopherson, Jon A., Carino, David R., Ferson, Wayne - E. \emph{Portfolio Performance Measurement and - Benchmarking}. McGraw-Hill. 2009. Chapter 5 \cr Bacon, C. - \emph{Practical Portfolio Performance Measurement and - Attribution}. Wiley. 2004. Chapter 2 \cr -} -\seealso{ - PortfReturns -} -\keyword{portfolio} -\keyword{returns} - +\name{AcctReturns} +\alias{AcctReturns} +\title{Calculate account returns} +\usage{ +AcctReturns(Account, Dates = NULL, Portfolios = NULL, + method = c("timeweighted", "dietz"), ...) +} +\arguments{ + \item{Account}{string name of the account to generate + returns for} + + \item{\dots}{any other passthru parameters (like + \code{native} for \code{.getBySymbol}} + + \item{Dates}{xts style ISO 8601 date subset to retrieve, + default NULL (all dates)} + + \item{Portfolios}{concatenated string vector for + portfolio names to retrieve returns on, default NULL (all + portfolios)} + + \item{method}{Used to select between time-weighted and + linked modified Dietz returns. May be any of: + \itemize{\item timeweighted \item dietz} By default + time-weighted is selected} +} +\value{ +returns xts with account returns +} +\description{ +Similar to the \code{PortfReturns} function, but gives +returns for the entire account and takes into account +external cashflows. External cashflows are defined as +contributions to or withdrawals from the account. Allows +selecting between time-weighted returns and linked modified +Dietz approach. If time-weighted method is selected, +returns at time \eqn{t} are computed using: +\deqn{r_{t}=\frac{V_{t}}{V_{t-1}+C_{t}}-1} where +\eqn{V_{t}} - account value at time \eqn{t}, \eqn{C_{t}} - +cashflow at time \eqn{t}. The implicit assumption made here +is that the cash flow is available for the portfolio +manager to invest from the beginning of the day. These +returns then can be chain linked with geometric compounding +(for instance using \code{Return.cumulative} function from +the \code{PerformanceAnalytics} package) to yield +cumulative multi-period returns: +\deqn{1+r=\prod_{t=1}^{T}(1+r_{t})=\prod_{t=1}^{T}\frac{V_{t}}{V_{t-1}+C_{t}}} +In the case if there were no cashflows, the result reduces +to simple one-period returns. Time-weighted returns has +also an interpretation in terms of unit value pricing. If +Modified Dietz method is selected, monthly returns are +computed taking into account cashflows within each month: +\deqn{r = +\frac{V_{t}-V_{t-1}-C}{V_{t-1}+\sum_{t}C_{t}\times W_{t}}} +where \eqn{C} - total external cash flows within a month, +\eqn{C_{t}} - external cashflow at time \eqn{t}, +\deqn{W_{t}=\frac{TD-D_{t}}{TD}} - weighting ratio to be +applied to external cashflow on day \eqn{t}, \eqn{TD} - +total number of days within the month, \eqn{D_{t}} - number +of days since the beginning of the month including weekends +and public holidays. Finally monthly Modified Dietz returns +can also be linked geometrically. +} +\note{ +TODO handle portfolio and account in different currencies +(not hard, just not done) + +TODO explicitly handle portfolio weights + +TODO support additions and withdrawals to available capital +} +\author{ +Brian Peterson, Andrii Babii +} +\references{ +Christopherson, Jon A., Carino, David R., Ferson, Wayne E. +\emph{Portfolio Performance Measurement and Benchmarking}. +McGraw-Hill. 2009. Chapter 5 \cr Bacon, C. \emph{Practical +Portfolio Performance Measurement and Attribution}. Wiley. +2004. Chapter 2 \cr +} +\seealso{ +PortfReturns +} +\keyword{portfolio} +\keyword{returns} + Modified: pkg/blotter/man/PortfReturns.Rd =================================================================== --- pkg/blotter/man/PortfReturns.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/PortfReturns.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,9 +2,8 @@ \alias{PortfReturns} \title{Calculate portfolio instrument returns} \usage{ - PortfReturns(Account, method = c("contribution"), ..., - Dates = NULL, Portfolios = NULL, - period = c("daily", "none")) +PortfReturns(Account, method = c("contribution"), ..., Dates = NULL, + Portfolios = NULL, period = c("daily", "none")) } \arguments{ \item{Account}{string name of the account to generate @@ -25,25 +24,24 @@ \item{period}{one of daily} } \description{ - This function (for now) calculates return on initial - equity for each instrument in the portfolio or portfolios - that make up an account. These columns will be additive - to return on capital of each portfolio, or of the entire - account. +This function (for now) calculates return on initial equity +for each instrument in the portfolio or portfolios that +make up an account. These columns will be additive to +return on capital of each portfolio, or of the entire +account. } \details{ - This function exists because of R/Finance community - requests by Mark Breman and Thomas Bolton +This function exists because of R/Finance community +requests by Mark Breman and Thomas Bolton } \note{ - TODO handle portfolio and account in different currencies - (not hard, just not done) +TODO handle portfolio and account in different currencies +(not hard, just not done) - TODO explicitly handle portfolio weights +TODO explicitly handle portfolio weights - TODO provide additional methods of calculating returns +TODO provide additional methods of calculating returns - TODO support additions and withdrawals to available - capital +TODO support additions and withdrawals to available capital } Modified: pkg/blotter/man/addAcctTxn.Rd =================================================================== --- pkg/blotter/man/addAcctTxn.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/addAcctTxn.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,9 +2,8 @@ \alias{addAcctTxn} \title{Add capital account transactions, such as capital additions and withdrawals or interest income (expense)} \usage{ - addAcctTxn(Account, TxnDate, - TxnType = c("Additions", "Withdrawals", "Interest"), - Amount, ..., verbose = TRUE) +addAcctTxn(Account, TxnDate, TxnType = c("Additions", "Withdrawals", + "Interest"), Amount, ..., verbose = TRUE) } \arguments{ \item{name}{Account name, as string} @@ -28,34 +27,34 @@ FALSE.} } \description{ - For the specified Account, take in the date, amount, and - type of transaction and append it to the correct list in - the account object +For the specified Account, take in the date, amount, and +type of transaction and append it to the correct list in +the account object } \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. +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. } \author{ - Peter Carl +Peter Carl } \seealso{ - \code{\link{initAcct}}, \code{\link{updateAcct}}, - \code{\link{updateEndEq}} +\code{\link{initAcct}}, \code{\link{updateAcct}}, +\code{\link{updateEndEq}} } Modified: pkg/blotter/man/addDiv.Rd =================================================================== --- pkg/blotter/man/addDiv.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/addDiv.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,8 +2,8 @@ \alias{addDiv} \title{Add cash dividend transactions to a portfolio.} \usage{ - addDiv(Portfolio, Symbol, TxnDate, DivPerShare, ..., - TxnFees = 0, ConMult = NULL, verbose = TRUE) +addDiv(Portfolio, Symbol, TxnDate, DivPerShare, ..., TxnFees = 0, + ConMult = NULL, verbose = TRUE) } \arguments{ \item{Portfolio}{A portfolio name that points to a @@ -33,12 +33,12 @@ specification.} } \description{ - Adding a cash dividend does not affect position quantity, - like a split would. +Adding a cash dividend does not affect position quantity, +like a split would. } \note{ - # TODO add TxnTypes to $txn table +# TODO add TxnTypes to $txn table - # TODO add AsOfDate +# TODO add AsOfDate } Modified: pkg/blotter/man/addPortfInstr.Rd =================================================================== --- pkg/blotter/man/addPortfInstr.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/addPortfInstr.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,7 +2,7 @@ \alias{addPortfInstr} \title{add an instrument to a portfolio} \usage{ - addPortfInstr(Portfolio, symbols, ...) +addPortfInstr(Portfolio, symbols, ...) } \arguments{ \item{Portfolio}{portfolio identifier string} @@ -13,7 +13,6 @@ \item{\dots}{any other passthru parameters} } \description{ - thanks to WolfGang Wu for making this function more - usable +thanks to WolfGang Wu for making this function more usable } Modified: pkg/blotter/man/addTxn.Rd =================================================================== --- pkg/blotter/man/addTxn.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/addTxn.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -3,12 +3,11 @@ \alias{addTxns} \title{Add transactions to a portfolio.} \usage{ - addTxn(Portfolio, Symbol, TxnDate, TxnQty, TxnPrice, ..., - TxnFees = 0, ConMult = NULL, verbose = TRUE, - eps = 1e-06) +addTxn(Portfolio, Symbol, TxnDate, TxnQty, TxnPrice, ..., TxnFees = 0, + ConMult = NULL, verbose = TRUE, eps = 0.000001) - addTxns(Portfolio, Symbol, TxnData, verbose = FALSE, ..., - ConMult = NULL) +addTxns(Portfolio, Symbol, TxnData, verbose = FALSE, ..., ConMult = NULL, + eps = 0.000001) } \arguments{ \item{Portfolio}{A portfolio name that points to a @@ -45,53 +44,53 @@ fields (for addTxns)} } \description{ - When a trade or adjustment is made to the Portfolio, the - addTxn function calculates the value and average cost of - the transaction, the change in position, the resulting - positions average cost, and any realized profit or loss - (net of fees) from the transaction. Then it stores the - transaction and calculations in the Portfolio object. +When a trade or adjustment is made to the Portfolio, the +addTxn function calculates the value and average cost of +the transaction, the change in position, the resulting +positions average cost, and any realized profit or loss +(net of fees) from the transaction. Then it stores the +transaction and calculations in the Portfolio object. } \details{ - Fees are indicated as negative values and will be - subtracted from the transaction value. TxnFees can either - be a fixed numeric amount, or a function (or charavcter - name of a function) in which case the function is - evaluated to determine the fee amount. +Fees are indicated as negative values and will be +subtracted from the transaction value. TxnFees can either +be a fixed numeric amount, or a function (or charavcter +name of a function) in which case the function is evaluated +to determine the fee amount. - The \code{\link{pennyPerShare}} function provides a - simple example of a transaction cost function. +The \code{\link{pennyPerShare}} function provides a simple +example of a transaction cost function. - Transactions which would cross the position through zero - will be split into two transactions, one to flatten the - position, and another to initiate a new position on the - opposite side of the market. The new (split) transaction - will have its timestamp incremented by \code{eps} to - preserve ordering. +Transactions which would cross the position through zero +will be split into two transactions, one to flatten the +position, and another to initiate a new position on the +opposite side of the market. The new (split) transaction +will have its timestamp incremented by \code{eps} to +preserve ordering. - This transaction splitting vastly simplifies realized P&L - calculations elsewhere in the code. Such splitting also - mirrors many execution platforms and brokerage - requirements in particular asset classes where the side - of a trade needs to be specified with the order. +This transaction splitting vastly simplifies realized P&L +calculations elsewhere in the code. Such splitting also +mirrors many execution platforms and brokerage requirements +in particular asset classes where the side of a trade needs +to be specified with the order. - The \code{addTxns} function allows you to add multiple - transactions to the portfolio, which is much faster than - adding them one at a time. The \code{TxnData} object must - have "TxnQty" and "TxnPrice" columns, while the "TxnFees" - column is optional. +The \code{addTxns} function allows you to add multiple +transactions to the portfolio, which is much faster than +adding them one at a time. The \code{TxnData} object must +have "TxnQty" and "TxnPrice" columns, while the "TxnFees" +column is optional. } \note{ - The addTxn function will eventually also handle other - transaction types, such as adjustments for corporate - actions or expire/assign for options. See - \code{\link{addDiv}} +The addTxn function will eventually also handle other +transaction types, such as adjustments for corporate +actions or expire/assign for options. See +\code{\link{addDiv}} } \author{ - Peter Carl, Brian G. Peterson +Peter Carl, Brian G. Peterson } \seealso{ - \code{\link{addTxns}}, \code{\link{pennyPerShare}}, - \code{\link{initPortf}} +\code{\link{addTxns}}, \code{\link{pennyPerShare}}, +\code{\link{initPortf}} } Modified: pkg/blotter/man/calcPortfWgt.Rd =================================================================== --- pkg/blotter/man/calcPortfWgt.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/calcPortfWgt.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,9 +2,9 @@ \alias{calcPortfWgt} \title{Calculates the portfolio weights for positions within a given portfolio.} \usage{ - calcPortfWgt(Portfolio, Symbols = NULL, Dates = NULL, - denominator = c("Gross.Value", "Net.Value", "Long.Value", "Short.Value"), - Account) +calcPortfWgt(Portfolio, Symbols = NULL, Dates = NULL, + denominator = c("Gross.Value", "Net.Value", "Long.Value", "Short.Value"), + Account) } \arguments{ \item{Portfolio}{a portfolio object structured with @@ -23,15 +23,15 @@ summaries} } \value{ - xts timeseries object with weights by date in rows and - symbolname in columns +xts timeseries object with weights by date in rows and +symbolname in columns } \description{ - Portfolio weights may be calculated differently depending - on their use. By default, this function uses denominator - of 'Gross.Value', the second most common option will - likely be 'Net.Value'. For separating long and short - weights, 'Long.Value' and 'Short.Value' may be needed as - denominators. +Portfolio weights may be calculated differently depending +on their use. By default, this function uses denominator of +'Gross.Value', the second most common option will likely be +'Net.Value'. For separating long and short weights, +'Long.Value' and 'Short.Value' may be needed as +denominators. } Modified: pkg/blotter/man/calcPosAvgCost.Rd =================================================================== --- pkg/blotter/man/calcPosAvgCost.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/calcPosAvgCost.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,8 +2,7 @@ \alias{.calcPosAvgCost} \title{Calculates the average cost of a resulting position from a transaction} \usage{ - .calcPosAvgCost(PrevPosQty, PrevPosAvgCost, TxnValue, - PosQty, ConMult = 1) +.calcPosAvgCost(PrevPosQty, PrevPosAvgCost, TxnValue, PosQty, ConMult = 1) } \arguments{ \item{PrevPosQty}{quantity of the previous position} @@ -20,10 +19,10 @@ \item{ConMult}{multiplier from instrument data} } \value{ - PosAvgCost: average cost of the resulting position +PosAvgCost: average cost of the resulting position } \description{ - Calculates the average cost of a resulting position from - a transaction +Calculates the average cost of a resulting position from a +transaction } Modified: pkg/blotter/man/calcTxnAvgCost.Rd =================================================================== --- pkg/blotter/man/calcTxnAvgCost.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/calcTxnAvgCost.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,7 +2,7 @@ \alias{.calcTxnAvgCost} \title{Calculates a per share or per contract cost of the transaction to match the units the price is quoted in} \usage{ - .calcTxnAvgCost(TxnValue, TxnQty, ConMult = 1) +.calcTxnAvgCost(TxnValue, TxnQty, ConMult = 1) } \arguments{ \item{TxnValue}{total value of the transaction, including @@ -13,11 +13,11 @@ \item{ConMult}{multiplier from instrument data} } \value{ - TxnAvgCost: unit normalized (per share) cost implied by - the transaction +TxnAvgCost: unit normalized (per share) cost implied by the +transaction } \description{ - Calculates a per share or per contract cost of the - transaction to match the units the price is quoted in +Calculates a per share or per contract cost of the +transaction to match the units the price is quoted in } Modified: pkg/blotter/man/calcTxnValue.Rd =================================================================== --- pkg/blotter/man/calcTxnValue.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/calcTxnValue.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,7 +2,7 @@ \alias{.calcTxnValue} \title{Calculates the total value of a transaction or trade} \usage{ - .calcTxnValue(TxnQty, TxnPrice, TxnFees, ConMult = 1) +.calcTxnValue(TxnQty, TxnPrice, TxnFees, ConMult = 1) } \arguments{ \item{TxnQty}{total units (shares) of the transaction} @@ -15,10 +15,10 @@ \item{ConMult}{multiplier from instrument data} } \value{ - TxnValue: total dollar value of the transaction, - including fees +TxnValue: total dollar value of the transaction, including +fees } \description{ - Calculates the total value of a transaction or trade +Calculates the total value of a transaction or trade } Modified: pkg/blotter/man/chart.ME.Rd =================================================================== --- pkg/blotter/man/chart.ME.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/chart.ME.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,8 +2,8 @@ \alias{chart.ME} \title{Chart Maximum Adverse/Favorable Excursion} \usage{ - chart.ME(Portfolio, Symbol, type = c("MAE", "MFE"), - scale = c("cash", "percent", "tick"), ...) +chart.ME(Portfolio, Symbol, type = c("MAE", "MFE"), scale = c("cash", + "percent", "tick"), ...) } \arguments{ \item{Portfolio}{string identifying the portfolio to @@ -23,22 +23,22 @@ particular includeOpenTrades (see perTradeStats())} } \description{ - Produces a scatterplot with one point per trade, with - x-axis: absolute value of Drawdown (Adverse), or Run Up - (Favourable), and y-axis: absolute value of Net Profit or - Loss +Produces a scatterplot with one point per trade, with +x-axis: absolute value of Drawdown (Adverse), or Run Up +(Favourable), and y-axis: absolute value of Net Profit or +Loss } \author{ - Jan Humme +Jan Humme } \references{ - Tomasini, E. and Jaekle, U. \emph{Trading Systems - A new - approach to system development and portfolio - optimisation} (ISBN 978-1-905641-79-6), section 3.5 +Tomasini, E. and Jaekle, U. \emph{Trading Systems - A new +approach to system development and portfolio optimisation} +(ISBN 978-1-905641-79-6), section 3.5 } \seealso{ - \code{\link{perTradeStats}} for the calculations used by - this chart, and \code{\link{tradeStats}} for a summary - view of the performance +\code{\link{perTradeStats}} for the calculations used by +this chart, and \code{\link{tradeStats}} for a summary view +of the performance } Modified: pkg/blotter/man/chart.Posn.Rd =================================================================== --- pkg/blotter/man/chart.Posn.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/chart.Posn.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,8 +2,7 @@ \alias{chart.Posn} \title{Chart trades against market data, position through time, and cumulative P\&L} \usage{ - chart.Posn(Portfolio, Symbol, Dates = NULL, ..., - TA = NULL) +chart.Posn(Portfolio, Symbol, Dates = NULL, ..., TA = NULL) } \arguments{ \item{Portfolio}{string identifying the portfolio to @@ -23,13 +22,13 @@ \code{\link{eval}}} } \description{ - Produces a three-panel chart of time series charts that - contains prices and transactions in the top panel, the - resulting position in the second, and a cumulative - profit-loss line chart in the third. +Produces a three-panel chart of time series charts that +contains prices and transactions in the top panel, the +resulting position in the second, and a cumulative +profit-loss line chart in the third. } \note{ - Expect changes to this function, since the underlying - charts are experimental functions in quantmod. +Expect changes to this function, since the underlying +charts are experimental functions in quantmod. } Modified: pkg/blotter/man/chart.Reconcile.Rd =================================================================== --- pkg/blotter/man/chart.Reconcile.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/chart.Reconcile.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,10 +2,8 @@ \alias{chart.Reconcile} \title{Chart trades against market data, position through time, and cumulative P\&L} \usage{ - chart.Reconcile(theoPort, actualPort, Symbol, - Dates = NULL, ..., - PLdiff = c("cumulative", "episodic"), - data = c(FALSE, "View", "return")) +chart.Reconcile(theoPort, actualPort, Symbol, Dates = NULL, ..., + PLdiff = c("cumulative", "episodic"), data = c(FALSE, "View", "return")) } \arguments{ \item{theoPort}{string identifying the theoretical @@ -28,38 +26,38 @@ Details} } \description{ - Produces a three or four-panel or chart of time series - charts that contains prices and transactions in the top - panel, the resulting position in the second, a cumulative - profit-loss line chart in the third. +Produces a three or four-panel or chart of time series +charts that contains prices and transactions in the top +panel, the resulting position in the second, a cumulative +profit-loss line chart in the third. } \details{ - The theoretical trades, positions, and P&L are plotted - first, in the 'light' versions of the colors, and then - the actual values are overplotted in the main color. If - they agree completely, the theoretical values will not be - visible. Differences will make themselves visible by - misalignment of the symbols or lines. +The theoretical trades, positions, and P&L are plotted +first, in the 'light' versions of the colors, and then the +actual values are overplotted in the main color. If they +agree completely, the theoretical values will not be +visible. Differences will make themselves visible by +misalignment of the symbols or lines. - The fourth panel is the difference in P&L between the - theoretical and actual values, and could be considered - 'slippage', which could be positive or negative. It is - calculated by subtracting the theoretical P&L from the - actual P&L. If parameter \code{PLdiff} is 'cumulative', - then this panel will display the cumsum of difference - between the theoretical and actual portfolios. If - parameter \code{PLdiff} is 'episodic' it will display the - differences in P&L +The fourth panel is the difference in P&L between the +theoretical and actual values, and could be considered +'slippage', which could be positive or negative. It is +calculated by subtracting the theoretical P&L from the +actual P&L. If parameter \code{PLdiff} is 'cumulative', +then this panel will display the cumsum of difference +between the theoretical and actual portfolios. If parameter +\code{PLdiff} is 'episodic' it will display the differences +in P&L - The \code{data} parameter allows the user to either - \code{\link{View}} or \code{\link{return}} the data - calculated inside the chart. Default FALSE (only chart) +The \code{data} parameter allows the user to either +\code{\link{View}} or \code{\link{return}} the data +calculated inside the chart. Default FALSE (only chart) } \note{ - Expect changes to this function, since the underlying - charts are experimental functions in quantmod. +Expect changes to this function, since the underlying +charts are experimental functions in quantmod. } \seealso{ - \code{\link{chart.Posn}} +\code{\link{chart.Posn}} } Modified: pkg/blotter/man/chart.Spread.Rd =================================================================== --- pkg/blotter/man/chart.Spread.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/chart.Spread.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,8 +2,8 @@ \alias{chart.Spread} \title{Charts the transaction series, positions, and P&L of a spread against prices} \usage{ - chart.Spread(Account, Portfolio, Spread = NULL, - Symbols = NULL, Dates = NULL, ...) +chart.Spread(Account, Portfolio, Spread = NULL, Symbols = NULL, + Dates = NULL, ...) } \arguments{ \item{Account}{string identifying the account} @@ -22,7 +22,7 @@ parameters to \code{chart_Series})} } \description{ - Charts the transaction series, positions, and P&L of a - spread against prices +Charts the transaction series, positions, and P&L of a +spread against prices } Modified: pkg/blotter/man/dailyTxnPL.Rd =================================================================== --- pkg/blotter/man/dailyTxnPL.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/dailyTxnPL.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -3,9 +3,9 @@ \alias{dailyTxnPL} \title{generate daily Transaction Realized or Equity Curve P&L by instrument} \usage{ - dailyTxnPL(Portfolios, Symbols, drop.time = TRUE) +dailyTxnPL(Portfolios, Symbols, drop.time = TRUE) - dailyEqPL(Portfolios, Symbols, drop.time = TRUE) +dailyEqPL(Portfolios, Symbols, drop.time = TRUE) } \arguments{ \item{Portfolios}{portfolio string} @@ -16,25 +16,25 @@ (if any), default TRUE} } \value{ - a multi-column \code{xts} time series, one column per - symbol, one row per day +a multi-column \code{xts} time series, one column per +symbol, one row per day } \description{ - designed to collate information for high frequency - portfolios +designed to collate information for high frequency +portfolios } \details{ - If you do not pass \code{Symbols}, then all symbols in - the provided \code{Portfolios} will be used. +If you do not pass \code{Symbols}, then all symbols in the +provided \code{Portfolios} will be used. - The daily P&L is calculated from - \code{Net.Txn.Realized.PL} if by \code{dailyTxnPL} and - from \code{Net.Trading.PL} by \code{dailyEqPL} +The daily P&L is calculated from \code{Net.Txn.Realized.PL} +if by \code{dailyTxnPL} and from \code{Net.Trading.PL} by +\code{dailyEqPL} } \author{ - Brian G. Peterson +Brian G. Peterson } \seealso{ - tradeStats +tradeStats } Modified: pkg/blotter/man/extractTxns.Rd =================================================================== --- pkg/blotter/man/extractTxns.Rd 2014-03-05 14:29:09 UTC (rev 1588) +++ pkg/blotter/man/extractTxns.Rd 2014-03-08 16:25:03 UTC (rev 1589) @@ -2,35 +2,35 @@ \alias{extractTxns} \title{Extract transactions from a portfolio} \usage{ - extractTxns(Portfolio) +extractTxns(Portfolio) } \arguments{ \item{Portfolio}{string identifying the portfolio to extract from} } \value{ - String vector of \code{\link{addTxn}} calls that would - replicate the given portfolio. [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/blotter -r 1589 From noreply at r-forge.r-project.org Tue Mar 11 13:55:27 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 11 Mar 2014 13:55:27 +0100 (CET) Subject: [Blotter-commits] r1590 - pkg/blotter/R Message-ID: <20140311125527.F3F82186ABF@r-forge.r-project.org> Author: bodanker Date: 2014-03-11 13:55:27 +0100 (Tue, 11 Mar 2014) New Revision: 1590 Modified: pkg/blotter/R/updateEndEq.R Log: - s/Int.Income/Interest/ to align with r1481 Modified: pkg/blotter/R/updateEndEq.R =================================================================== --- pkg/blotter/R/updateEndEq.R 2014-03-08 16:25:03 UTC (rev 1589) +++ pkg/blotter/R/updateEndEq.R 2014-03-11 12:55:27 UTC (rev 1590) @@ -30,7 +30,7 @@ PrevEndEq = getEndEq(aname, PrevDate) Additions = Account$summary[Dates]$Additions Withdrawals = Account$summary[Dates]$Withdrawals - NetPerformance = rowSums(Account$summary[Dates,c('Int.Income','Net.Trading.PL', 'Advisory.Fees')]) + NetPerformance = rowSums(Account$summary[Dates,c('Interest','Net.Trading.PL', 'Advisory.Fees')]) # assign NetPerformance into the account slot Account$summary$Net.Performance[Dates] <- NetPerformance From noreply at r-forge.r-project.org Sat Mar 29 12:58:43 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 12:58:43 +0100 (CET) Subject: [Blotter-commits] r1591 - in pkg/blotter: . R man Message-ID: <20140329115843.5EE93187379@r-forge.r-project.org> Author: braverock Date: 2014-03-29 12:58:42 +0100 (Sat, 29 Mar 2014) New Revision: 1591 Modified: pkg/blotter/DESCRIPTION pkg/blotter/R/tradeStats.R pkg/blotter/man/addTxn.Rd pkg/blotter/man/tradeStats.Rd Log: - add annualized Sharpe to tradeStats - bump version Modified: pkg/blotter/DESCRIPTION =================================================================== --- pkg/blotter/DESCRIPTION 2014-03-11 12:55:27 UTC (rev 1590) +++ pkg/blotter/DESCRIPTION 2014-03-29 11:58:42 UTC (rev 1591) @@ -2,7 +2,7 @@ Type: Package Title: Tools for transaction-oriented trading systems development. -Version: 0.8.17 +Version: 0.8.18 Date: $Date$ Author: Peter Carl, Brian G. Peterson Maintainer: Brian G. Peterson Modified: pkg/blotter/R/tradeStats.R =================================================================== --- pkg/blotter/R/tradeStats.R 2014-03-11 12:55:27 UTC (rev 1590) +++ pkg/blotter/R/tradeStats.R 2014-03-29 11:58:42 UTC (rev 1591) @@ -36,6 +36,7 @@ #' @param Portfolios portfolio string #' @param Symbols character vector of symbol strings, default NULL #' @param use for determines whether numbers are calculated from transactions or round-trip trades (for tradeStats) or equity curve (for dailyStats) +#' @param tradeDef string to determine which definition of 'trade' to use. Currently "flat.to.flat" (the default) and "flat.to.reduced" are implemented. #' @author Lance Levenson, Brian Peterson #' @export #' @importFrom zoo as.Date @@ -65,6 +66,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{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 } @@ -75,7 +77,7 @@ #' TODO document each statistic included in this function, with equations #' #' TODO add more stats, potentially -#' PerformanceAnalytics: skewness, kurtosis, upside/downside semidieviation, Sharpe/Sortino +#' PerformanceAnalytics: skewness, kurtosis, upside/downside semidieviation, Sortino #' #' mean absolute deviation stats #' @@ -86,10 +88,11 @@ #' Buy and hold return #' #' Josh has suggested adding \%-return based stats too -tradeStats <- function(Portfolios, Symbols ,use=c('txns','trades')) +tradeStats <- function(Portfolios, Symbols ,use=c('txns','trades'), tradeDef='flat.to.flat') { ret <- NULL use <- use[1] #use the first(default) value only if user hasn't specified + tradeDef <- tradeDef[1] for (Portfolio in Portfolios){ pname <- Portfolio Portfolio<-.getPortfolio(pname) @@ -123,7 +126,7 @@ #moved above for daily stats for now }, trades = { - trades <- perTradeStats(pname,symbol) + trades <- perTradeStats(pname,symbol,tradeDef=tradeDef) PL.gt0 <- trades$Net.Trading.PL[trades$Net.Trading.PL > 0] PL.lt0 <- trades$Net.Trading.PL[trades$Net.Trading.PL < 0] PL.ne0 <- trades$Net.Trading.PL[trades$Net.Trading.PL != 0] @@ -137,7 +140,8 @@ AvgTradePL <- mean(PL.ne0) MedTradePL <- median(PL.ne0) - StdTradePL <- sd(as.numeric(as.vector(PL.ne0))) + StdTradePL <- sd(as.numeric(as.vector(PL.ne0))) + AnnSharpe <- AvgDailyPL/StdDailyPL * sqrt(252) NumberOfTxns <- nrow(txn)-1 NumberOfTrades <- length(PL.ne0) @@ -206,6 +210,7 @@ Avg.Daily.PL = AvgDailyPL, Med.Daily.PL = MedDailyPL, Std.Dev.Daily.PL = StdDailyPL, + Ann.Sharpe = AnnSharpe, Max.Drawdown = MaxDrawdown, Profit.To.Max.Draw = ProfitToMaxDraw, Avg.WinLoss.Ratio = AvgWinLoss, @@ -358,6 +363,7 @@ AvgDailyPL <- as.numeric(mean(PL.ne0)) MedDailyPL <- as.numeric(median(PL.ne0)) StdDailyPL <- as.numeric(sd(PL.ne0)) + AnnSharpe <- AvgDailyPL/StdDailyPL * sqrt(252) Equity <- cumsum(x) Equity.max <- cummax(Equity) @@ -389,6 +395,7 @@ Avg.Daily.PL = AvgDailyPL, Med.Daily.PL = MedDailyPL, Std.Dev.Daily.PL = StdDailyPL, + Ann.Sharpe = AnnSharpe, Max.Drawdown = MaxDrawdown, Profit.To.Max.Draw = ProfitToMaxDraw, Avg.WinLoss.Ratio = AvgWinLoss, Modified: pkg/blotter/man/addTxn.Rd =================================================================== --- pkg/blotter/man/addTxn.Rd 2014-03-11 12:55:27 UTC (rev 1590) +++ pkg/blotter/man/addTxn.Rd 2014-03-29 11:58:42 UTC (rev 1591) @@ -4,10 +4,10 @@ \title{Add transactions to a portfolio.} \usage{ addTxn(Portfolio, Symbol, TxnDate, TxnQty, TxnPrice, ..., TxnFees = 0, - ConMult = NULL, verbose = TRUE, eps = 0.000001) + ConMult = NULL, verbose = TRUE, eps = 1e-06) addTxns(Portfolio, Symbol, TxnData, verbose = FALSE, ..., ConMult = NULL, - eps = 0.000001) + eps = 1e-06) } \arguments{ \item{Portfolio}{A portfolio name that points to a Modified: pkg/blotter/man/tradeStats.Rd =================================================================== --- pkg/blotter/man/tradeStats.Rd 2014-03-11 12:55:27 UTC (rev 1590) +++ pkg/blotter/man/tradeStats.Rd 2014-03-29 11:58:42 UTC (rev 1591) @@ -3,7 +3,8 @@ \alias{tradeStats} \title{calculate statistics on transactions and P&L for a symbol or symbols in a portfolio or portfolios} \usage{ -tradeStats(Portfolios, Symbols, use = c("txns", "trades")) +tradeStats(Portfolios, Symbols, use = c("txns", "trades"), + tradeDef = "flat.to.flat") dailyStats(Portfolios, use = c("equity", "txns")) } @@ -16,6 +17,10 @@ \item{use}{for determines whether numbers are calculated from transactions or round-trip trades (for tradeStats) or equity curve (for dailyStats)} + + \item{tradeDef}{string to determine which definition of + 'trade' to use. Currently "flat.to.flat" (the default) + and "flat.to.reduced" are implemented.} } \value{ a \code{data.frame} containing: @@ -43,6 +48,8 @@ \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{Max.Drawdown}{ max drawdown } \item{Avg.WinLoss.Ratio}{ ratio of mean winning over mean losing trade } \item{Med.WinLoss.Ratio}{ ratio of median @@ -95,8 +102,7 @@ with equations TODO add more stats, potentially PerformanceAnalytics: -skewness, kurtosis, upside/downside semidieviation, -Sharpe/Sortino +skewness, kurtosis, upside/downside semidieviation, Sortino mean absolute deviation stats From noreply at r-forge.r-project.org Sat Mar 29 14:11:01 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 14:11:01 +0100 (CET) Subject: [Blotter-commits] r1592 - pkg/quantstrat/R Message-ID: <20140329131101.20A88183DCB@r-forge.r-project.org> Author: braverock Date: 2014-03-29 14:11:00 +0100 (Sat, 29 Mar 2014) New Revision: 1592 Modified: pkg/quantstrat/R/osFUNs.R Log: - fix typo Modified: pkg/quantstrat/R/osFUNs.R =================================================================== --- pkg/quantstrat/R/osFUNs.R 2014-03-29 11:58:42 UTC (rev 1591) +++ pkg/quantstrat/R/osFUNs.R 2014-03-29 13:11:00 UTC (rev 1592) @@ -54,7 +54,7 @@ #' #' It is also important to note that position limits #' may be time-varying. -#' If you only want one staic maximum position limit, then +#' If you only want one static maximum position limit, then #' call \code{addPosLimit} with a \code{timestamp} argument #' before your first trade. If you want time varying limits, #' typically in response to some rebalancing rule or risk From noreply at r-forge.r-project.org Sat Mar 29 16:18:31 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 16:18:31 +0100 (CET) Subject: [Blotter-commits] r1593 - pkg/blotter/man Message-ID: <20140329151831.56B7B1861BB@r-forge.r-project.org> Author: braverock Date: 2014-03-29 16:18:31 +0100 (Sat, 29 Mar 2014) New Revision: 1593 Modified: pkg/blotter/man/tradeStats.Rd Log: - manually fix an odd roxygen error that used parens instead of curly braces for a new \item Modified: pkg/blotter/man/tradeStats.Rd =================================================================== --- pkg/blotter/man/tradeStats.Rd 2014-03-29 13:11:00 UTC (rev 1592) +++ pkg/blotter/man/tradeStats.Rd 2014-03-29 15:18:31 UTC (rev 1593) @@ -48,7 +48,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 Sat Mar 29 21:39:45 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 21:39:45 +0100 (CET) Subject: [Blotter-commits] r1594 - in pkg/quantstrat: . R demo man Message-ID: <20140329203945.DE4B0183FE3@r-forge.r-project.org> Author: braverock Date: 2014-03-29 21:39:45 +0100 (Sat, 29 Mar 2014) New Revision: 1594 Modified: pkg/quantstrat/.project pkg/quantstrat/DESCRIPTION pkg/quantstrat/NAMESPACE pkg/quantstrat/R/applyStrategy.rebalancing.R pkg/quantstrat/R/ruleSignal.R pkg/quantstrat/R/rules.R pkg/quantstrat/R/strategy.R pkg/quantstrat/demo/faber.R pkg/quantstrat/demo/faber_rebal.R pkg/quantstrat/demo/macdRebalancing.R pkg/quantstrat/man/add.distribution.Rd pkg/quantstrat/man/add.distribution.constraint.Rd pkg/quantstrat/man/add.indicator.Rd pkg/quantstrat/man/add.init.Rd pkg/quantstrat/man/add.rule.Rd pkg/quantstrat/man/add.signal.Rd pkg/quantstrat/man/addOrder.Rd pkg/quantstrat/man/addPosLimit.Rd pkg/quantstrat/man/apply.paramset.Rd pkg/quantstrat/man/applyIndicators.Rd pkg/quantstrat/man/applyParameter.Rd pkg/quantstrat/man/applyRules.Rd pkg/quantstrat/man/applySignals.Rd pkg/quantstrat/man/applyStrategy.Rd pkg/quantstrat/man/applyStrategy.rebalancing.Rd pkg/quantstrat/man/chart.forward.Rd pkg/quantstrat/man/chart.forward.training.Rd pkg/quantstrat/man/delete.paramset.Rd pkg/quantstrat/man/enable.rule.Rd pkg/quantstrat/man/get.strategy.Rd pkg/quantstrat/man/getOrderBook.Rd pkg/quantstrat/man/getOrders.Rd pkg/quantstrat/man/getParameterTable.Rd pkg/quantstrat/man/getPosLimit.Rd pkg/quantstrat/man/initOrders.Rd pkg/quantstrat/man/initStrategy.Rd pkg/quantstrat/man/is.strategy.Rd pkg/quantstrat/man/load.strategy.Rd pkg/quantstrat/man/match.names.Rd pkg/quantstrat/man/osMaxPos.Rd pkg/quantstrat/man/osNoOp.Rd pkg/quantstrat/man/paramConstraint.Rd pkg/quantstrat/man/put.orderbook.Rd pkg/quantstrat/man/put.strategy.Rd pkg/quantstrat/man/rm.strat.Rd pkg/quantstrat/man/ruleOrderProc.Rd pkg/quantstrat/man/rulePctEquity.Rd pkg/quantstrat/man/ruleRevoke.Rd pkg/quantstrat/man/ruleSignal.Rd pkg/quantstrat/man/save.strategy.Rd pkg/quantstrat/man/setParameterConstraint.Rd pkg/quantstrat/man/setParameterDistribution.Rd pkg/quantstrat/man/sigComparison.Rd pkg/quantstrat/man/sigCrossover.Rd pkg/quantstrat/man/sigFormula.Rd pkg/quantstrat/man/sigPeak.Rd pkg/quantstrat/man/sigThreshold.Rd pkg/quantstrat/man/sigTimestamp.Rd pkg/quantstrat/man/strategy.Rd pkg/quantstrat/man/tradeGraphs.Rd pkg/quantstrat/man/tradeOrderStats.Rd pkg/quantstrat/man/updateOrders.Rd pkg/quantstrat/man/updateStrategy.Rd pkg/quantstrat/man/walk.forward.Rd Log: - fix rebalancing and rebalancing demos - update roxygen docs - bump version Modified: pkg/quantstrat/.project =================================================================== --- pkg/quantstrat/.project 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/.project 2014-03-29 20:39:45 UTC (rev 1594) @@ -14,5 +14,6 @@ de.walware.statet.base.StatetNature de.walware.statet.r.RNature + de.walware.statet.r.RPkgNature Modified: pkg/quantstrat/DESCRIPTION =================================================================== --- pkg/quantstrat/DESCRIPTION 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/DESCRIPTION 2014-03-29 20:39:45 UTC (rev 1594) @@ -1,15 +1,18 @@ Package: quantstrat Type: Package Title: Quantitative Strategy Model Framework -Version: 0.8.0 +Version: 0.8.2 Date: $Date$ Author: Peter Carl, Brian G. Peterson, Joshua Ulrich, Jan Humme Depends: - xts(>= 0.8-2),TTR(>= 0.2),blotter(>= 0.7.2), + xts(>= 0.8-2),TTR(>= 0.2), + blotter(>= 0.7.2), FinancialInstrument(>= 0.12.5), foreach(>= 1.4.0) Suggests: - PerformanceAnalytics,PortfolioAnalytics,rgl, + PerformanceAnalytics, + PortfolioAnalytics, + rgl, testthat, xtsExtra Maintainer: Brian G. Peterson @@ -20,26 +23,3 @@ LazyLoad: yes License: GPL-3 ByteCompile: TRUE -Collate: - 'applyStrategy.rebalancing.R' - 'chart.forward.R' - 'chart.forward.training.R' - 'indicators.R' - 'initialize.R' - 'match.names.R' - 'orders.R' - 'osFUNs.R' - 'parameters.R' - 'paramsets.R' - 'rebalance.rules.R' - 'ruleOrderProc.R' - 'ruleRevoke.R' - 'rules.R' - 'ruleSignal.R' - 'signals.R' - 'strategy.R' - 'tradeGraphs.R' - 'tradeOrderStats.R' - 'utils.R' - 'walk.forward.R' - 'wrapup.R' Modified: pkg/quantstrat/NAMESPACE =================================================================== --- pkg/quantstrat/NAMESPACE 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/NAMESPACE 2014-03-29 20:39:45 UTC (rev 1594) @@ -13,6 +13,7 @@ export(applySignals) export(applyStrategy) export(applyStrategy.rebalancing) +export(applyStrategy.rebalancing.training) export(chart.forward) export(chart.forward.training) export(delete.paramset) @@ -46,6 +47,7 @@ export(sigFormula) export(sigPeak) export(sigThreshold) +export(sigTimestamp) export(strategy) export(tradeGraphs) export(tradeOrderStats) Modified: pkg/quantstrat/R/applyStrategy.rebalancing.R =================================================================== --- pkg/quantstrat/R/applyStrategy.rebalancing.R 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/R/applyStrategy.rebalancing.R 2014-03-29 20:39:45 UTC (rev 1594) @@ -15,6 +15,7 @@ #' @seealso \code{\link{strategy}}, \code{\link{applyIndicators}}, #' \code{\link{applySignals}}, \code{\link{applyRules}}, #' \code{\link{initStrategy}}, \code{\link{applyStrategy}} +#' applyStrategy.rebalancing <- function(strategy , portfolios, mktdata=NULL , @@ -130,6 +131,7 @@ #now we need to do the endpoints loop. for(i in 2:length(pindex)){ + #the proper endpoints for each symbol will vary, so we need to get #them separately, and subset each one for (symbol in symbols){ @@ -162,9 +164,14 @@ # specifically, we need to check if *this* index is in st$plist$period for(period in names(st$plist)){ if(pindex[i] %in% st$plist[[period]]){ + + #print(pindex[i]) + curIndex <- pindex[i] #make sure pindex is available as curIndex + #this index is a rebalancing index for period #call the rebalance rules for this period #still need to separate the rules by rebalancing period, this will call them all + ruleProc(s$rules$rebalance, timestamp=pindex[i], path.dep=TRUE, Modified: pkg/quantstrat/R/ruleSignal.R =================================================================== --- pkg/quantstrat/R/ruleSignal.R 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/R/ruleSignal.R 2014-03-29 20:39:45 UTC (rev 1594) @@ -204,13 +204,23 @@ #TODO add fancy formals matching for osFUN if(orderqty!='all') { - orderqty <- osFUN(strategy=strategy, data=mktdata, timestamp=timestamp, orderqty=orderqty, ordertype=ordertype, orderside=orderside, portfolio=portfolio, symbol=symbol,...=...,ruletype=ruletype, orderprice=as.numeric(orderprice)) + orderqty <- osFUN(strategy=strategy, + data=mktdata, + timestamp=timestamp, + orderqty=orderqty, + ordertype=ordertype, + orderside=orderside, + portfolio=portfolio, + symbol=symbol, + ...=..., + ruletype=ruletype, + orderprice=as.numeric(orderprice)) } - if(!is.null(orderqty) && orderqty!=0 && !is.null(orderprice)) #orderprice could have length > 1 + if(!is.null(orderqty) && orderqty!=0 && length(orderprice) && is.numeric(orderprice[1])) #orderprice could have length > 1 { -# if(orderqty != 'all' || getPosQty(portfolio, symbol, timestamp) != 0) -# { + if(orderqty != 'all' || getPosQty(portfolio, symbol, timestamp) != 0) + { addOrder(portfolio=portfolio, symbol=symbol, timestamp=timestamp, @@ -228,8 +238,8 @@ prefer=prefer, TxnFees=TxnFees, label=label, - time.in.force=time.in.force) -# } + time.in.force=time.in.force) + } } } if(sethold) hold <<- TRUE Modified: pkg/quantstrat/R/rules.R =================================================================== --- pkg/quantstrat/R/rules.R 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/R/rules.R 2014-03-29 20:39:45 UTC (rev 1594) @@ -241,6 +241,7 @@ #' @param ... any other passthru parameters #' @param path.dep TRUE/FALSE whether rule is path dependent, default TRUE, see Details #' @param rule.order default NULL, use at your own risk to adjust order of rule evaluation +#' @param debug if TRUE, return output list #' @seealso \code{\link{add.rule}} \code{\link{applyStrategy}} #' @export applyRules <- function(portfolio, @@ -253,7 +254,8 @@ parameters=NULL, ..., path.dep=TRUE, - rule.order=NULL) { + rule.order=NULL, + debug=FALSE) { # TODO check for symbol name in mktdata using Josh's code: # symbol <- strsplit(colnames(mktdata)[1],"\\.")[[1]][1] @@ -486,7 +488,8 @@ holdtill=first(time(Dates))-1 # TODO FIXME make holdtill default more robust? mktinstr<-getInstrument(symbol) curIndex<-1 - freq <- periodicity(mktdata) # run once and pass to ruleOrderProc + if(nrow(mktdata)>1) freq <- periodicity(mktdata) # run once and pass to ruleOrderProc + else if (indexClass(mktdata) == 'Date') freq='daily' # do order price subsetting outside of nextIndex and curIndex loop # this avoids repeated [.xts calls; and mktPrices is never altered, so copies aren't made @@ -526,7 +529,7 @@ while(curIndex){ timestamp=Dates[curIndex] - + #print(paste('timestamp',timestamp,'first',first(index(mktdata)),'last',last(index(mktdata)))) # check to see if we need to release a hold @@ -614,12 +617,17 @@ else curIndex=FALSE } # end index while loop - mktdata<<-mktdata - if(is.null(ret)) { + if(isTRUE(debug)){ + mktdata<<-mktdata + + if(is.null(ret)) { return(mktdata) - } - else return(ret) -} + } + else return(ret) + } else { + return(NULL) + } +} #end applyRules # private function ruleProc, used by applyRules and applyStrategy.rebalancing ruleProc <- function (ruletypelist,timestamp=NULL, path.dep, ruletype, ..., parameters=NULL){ Modified: pkg/quantstrat/R/strategy.R =================================================================== --- pkg/quantstrat/R/strategy.R 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/R/strategy.R 2014-03-29 20:39:45 UTC (rev 1594) @@ -96,6 +96,8 @@ #' @param symbols character vector identifying symbols to initialize a portfolio for, default NULL #' @param initStrat whether to use (experimental) initialization code, default FALSE #' @param updateStrat whether to use (experimental) wrapup code, default FALSE +#' @param gc if TRUE, call \code{\link{gc}} after each symbol run, default FALSE (experimental) +#' @param delorders if TRUE, delete the order book for a symbol at the end of the symbols loop, will cause issues with rebalancing, default FALSE (experimental) #' @export #' @seealso \code{\link{strategy}}, \code{\link{applyIndicators}}, #' \code{\link{applySignals}}, \code{\link{applyRules}}, @@ -108,7 +110,9 @@ debug=FALSE, symbols=NULL, initStrat=FALSE, - updateStrat=FALSE ) { + updateStrat=FALSE, + gc=FALSE, + delorders=FALSE) { #TODO add saving of modified market data @@ -170,7 +174,8 @@ signals=sret$signals, parameters=parameters, ..., - path.dep=FALSE) + path.dep=FALSE, + debug=debug) # Check for open orders rem.orders <- suppressWarnings(getOrders(portfolio=portfolio, symbol=symbol, status="open")) #, timespan=timespan, ordertype=ordertype,which.i=TRUE) @@ -184,9 +189,14 @@ signals=sret$signals, parameters=parameters, ..., - path.dep=TRUE)} + path.dep=TRUE, + debug=debug)} if(isTRUE(debug)) ret[[portfolio]][[symbol]]<-sret + + if(isTRUE(delorders)) .strategy[[paste("order_book",portfolio,sep='.')]][[symbol]]<-NULL #WARNING: This is VERY DESTRUCTIVE + + if(isTRUE(gc)) gc() } # call updateStrategy Modified: pkg/quantstrat/demo/faber.R =================================================================== --- pkg/quantstrat/demo/faber.R 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/demo/faber.R 2014-03-29 20:39:45 UTC (rev 1594) @@ -146,14 +146,15 @@ } ret1 <- PortfReturns('faber') -ret1$total<-rowSums(ret1) +ret1 <- to.monthly(ret1) +ret1$total <- rowSums(ret1) + View(ret1) if("package:PerformanceAnalytics" %in% search() || require("PerformanceAnalytics",quietly=TRUE)){ getSymbols("SPY", src='yahoo', index.class=c("POSIXt","POSIXct"), from='1999-01-01') SPY<-to.monthly(SPY) SPY.ret<-Return.calculate(SPY$SPY.Close) - index(SPY.ret)<-index(ret1) dev.new() charts.PerformanceSummary(cbind(ret1$total,SPY.ret), geometric=FALSE, wealth.index=TRUE) } Modified: pkg/quantstrat/demo/faber_rebal.R =================================================================== --- pkg/quantstrat/demo/faber_rebal.R 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/demo/faber_rebal.R 2014-03-29 20:39:45 UTC (rev 1594) @@ -45,6 +45,12 @@ # Load required libraries require(quantstrat) +#correct for TZ issues if they crop up +oldtz <- Sys.getenv('TZ') +if(oldtz=='') { + Sys.setenv(TZ="UTC") +} + # Try to clean up in case the demo was run previously suppressWarnings(rm("account.faber","portfolio.faber",pos=.blotter)) suppressWarnings(rm("ltaccount", "ltportfolio", "ClosePrice", "CurrentDate", "equity", @@ -121,7 +127,7 @@ add.rule('faber', 'rulePctEquity', arguments=list(rebalance_on='quarters', trade.percent=1/length(symbols), - refprice=quote(last(getPrice(mktdata)[paste('::',timestamp,sep='')][,1])), + refprice=quote(last(getPrice(mktdata)[paste('::',as.character(curIndex),sep='')][,1])), digits=0 ), type='rebalance', @@ -135,6 +141,8 @@ print("Strategy Loop:") print(end_t-start_t) +Sys.setenv(TZ=oldtz) + # look at the order book #print(getOrderBook('faber')) @@ -157,16 +165,17 @@ } ret1 <- PortfReturns('faber') -ret1$total<-rowSums(ret1) -ret1 +ret1 <- to.monthly(ret1) +ret1$total <- rowSums(ret1) +View(ret1) + if("package:PerformanceAnalytics" %in% search() || require("PerformanceAnalytics",quietly=TRUE)){ - getSymbols("SPY", src='yahoo', index.class=c("POSIXt","POSIXct"), from='1999-01-01') - SPY<-to.monthly(SPY) - SPY.ret<-Return.calculate(SPY$SPY.Close) - index(SPY.ret)<-index(ret1) - dev.new() - charts.PerformanceSummary(cbind(ret1$total,SPY.ret), geometric=FALSE, wealth.index=TRUE) + getSymbols("SPY", src='yahoo', index.class=c("POSIXt","POSIXct"), from='1999-01-01') + SPY <- to.monthly(SPY) + SPY.ret <- Return.calculate(SPY$SPY.Close) + dev.new() + charts.PerformanceSummary(cbind(ret1$total,SPY.ret), geometric=FALSE, wealth.index=TRUE) } faber.stats<-tradeStats('faber')[,c('Net.Trading.PL','Max.Drawdown','Num.Trades','Profit.Factor','Std.Dev.Trade.PL','Largest.Winner','Largest.Loser','Max.Equity','Min.Equity')] Modified: pkg/quantstrat/demo/macdRebalancing.R =================================================================== --- pkg/quantstrat/demo/macdRebalancing.R 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/demo/macdRebalancing.R 2014-03-29 20:39:45 UTC (rev 1594) @@ -109,7 +109,7 @@ add.rule(strat.st, 'rulePctEquity', arguments=list(rebalance_on='months', trade.percent=.02, - refprice=quote(last(getPrice(mktdata)[paste('::',timestamp,sep='')])), + refprice=quote(last(getPrice(mktdata)[paste('::',curIndex,sep='')])), digits=0 ), type='rebalance', @@ -119,7 +119,7 @@ #end rules #### -getSymbols(stock.str,from=initDate) +getSymbols(stock.str,from=initDate,src='yahoo') start_t<-Sys.time() out<-applyStrategy.rebalancing(strat.st , portfolios=portfolio.st,parameters=list(nFast=fastMA, nSlow=slowMA, nSig=signalMA,maType=maType),verbose=TRUE) end_t<-Sys.time() Modified: pkg/quantstrat/man/add.distribution.Rd =================================================================== --- pkg/quantstrat/man/add.distribution.Rd 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/man/add.distribution.Rd 2014-03-29 20:39:45 UTC (rev 1594) @@ -2,9 +2,8 @@ \alias{add.distribution} \title{Adds a distribution to a paramset in a strategy} \usage{ - add.distribution(strategy, paramset.label, - component.type, component.label, variable, - weight = NULL, label, store = TRUE) +add.distribution(strategy, paramset.label, component.type, component.label, + variable, weight = NULL, label, store = TRUE) } \arguments{ \item{strategy}{the name of the strategy object to add @@ -31,16 +30,15 @@ the .strategy environment} } \description{ - Creates a distribution in paramset, where a distribution - consists of the name of a variable in a strategy - component plus a range of values for this variable. +Creates a distribution in paramset, where a distribution +consists of the name of a variable in a strategy component +plus a range of values for this variable. } \author{ - Jan Humme +Jan Humme } \seealso{ - \code{\link{add.distribution.constraint}}, - \code{\link{delete.paramset}}, - \code{\link{apply.paramset}} +\code{\link{add.distribution.constraint}}, +\code{\link{delete.paramset}}, \code{\link{apply.paramset}} } Modified: pkg/quantstrat/man/add.distribution.constraint.Rd =================================================================== --- pkg/quantstrat/man/add.distribution.constraint.Rd 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/man/add.distribution.constraint.Rd 2014-03-29 20:39:45 UTC (rev 1594) @@ -2,9 +2,8 @@ \alias{add.distribution.constraint} \title{Adds a constraint on 2 distributions within a paramset} \usage{ - add.distribution.constraint(strategy, paramset.label, - distribution.label.1, distribution.label.2, operator, - label, store = TRUE) +add.distribution.constraint(strategy, paramset.label, distribution.label.1, + distribution.label.2, operator, label, store = TRUE) } \arguments{ \item{strategy}{the name of the strategy object to add @@ -29,16 +28,15 @@ the .strategy environment} } \description{ - Creates a constraint on 2 distributions in a paramset, - i.e. a restriction limiting the allowed combinations from - the ranges for distribution 1 and distribution 2. +Creates a constraint on 2 distributions in a paramset, i.e. +a restriction limiting the allowed combinations from the +ranges for distribution 1 and distribution 2. } \author{ - Jan Humme +Jan Humme } \seealso{ - \code{\link{add.distribution}}, - \code{\link{delete.paramset}}, - \code{\link{apply.paramset}} +\code{\link{add.distribution}}, +\code{\link{delete.paramset}}, \code{\link{apply.paramset}} } Modified: pkg/quantstrat/man/add.indicator.Rd =================================================================== --- pkg/quantstrat/man/add.indicator.Rd 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/man/add.indicator.Rd 2014-03-29 20:39:45 UTC (rev 1594) @@ -2,9 +2,8 @@ \alias{add.indicator} \title{add an indicator to a strategy} \usage{ - add.indicator(strategy, name, arguments, - parameters = NULL, label = NULL, ..., enabled = TRUE, - indexnum = NULL, store = FALSE) +add.indicator(strategy, name, arguments, parameters = NULL, label = NULL, + ..., enabled = TRUE, indexnum = NULL, store = FALSE) } \arguments{ \item{strategy}{an object (or the name of an object) type @@ -39,71 +38,69 @@ the .strategy environment, or return it. default FALSE} } \value{ - if \code{strategy} was the name of a strategy, the name. - It it was a strategy, the updated strategy. +if \code{strategy} was the name of a strategy, the name. It +it was a strategy, the updated strategy. } \description{ - Indicators are typically standard technical or - statistical analysis outputs, such as moving averages, - bands, or pricing models. +Indicators are typically standard technical or statistical +analysis outputs, such as moving averages, bands, or +pricing models. } \details{ - Indicators are always path-independent, and should be - constructed from vectorized functions where possible. +Indicators are always path-independent, and should be +constructed from vectorized functions where possible. - Indicators are applied before signals and rules, and the - output of indicators may be used as inputs to construct - signals or fire rules. +Indicators are applied before signals and rules, and the +output of indicators may be used as inputs to construct +signals or fire rules. - \code{arguments} and \code{parameters} are named lists - that describe the arguments to be passed to the indicator - function. \code{arguments} is for defining any - non-default arguments to be passed to the function named - in the \code{name} of the indicator. For example, the - \code{x} argument to a moving average function may be - defined as \code{x=quote(Cl(mktdata))} +\code{arguments} and \code{parameters} are named lists that +describe the arguments to be passed to the indicator +function. \code{arguments} is for defining any non-default +arguments to be passed to the function named in the +\code{name} of the indicator. For example, the \code{x} +argument to a moving average function may be defined as +\code{x=quote(Cl(mktdata))} - If you look at the demo scripts, you'll notice that we - often use \code{quote(mktdata)} in setting up indicators, - signals, or rules. This tells \R to delay evaluation via - \code{quote()}, and to use the special variable - \code{mktdata}. +If you look at the demo scripts, you'll notice that we +often use \code{quote(mktdata)} in setting up indicators, +signals, or rules. This tells \R to delay evaluation via +\code{quote()}, and to use the special variable +\code{mktdata}. - \code{mktdata} is typically created internally to - \code{quantstrat} by looking in the global environment - for a time series of prices or returns. mktdata may also - contain other data you've manipulated outside quantstrat, - though where possible you should use quantstrat to - contain all the logic for the strategy, to aid in - maintenance and modifications. +\code{mktdata} is typically created internally to +\code{quantstrat} by looking in the global environment for +a time series of prices or returns. mktdata may also +contain other data you've manipulated outside quantstrat, +though where possible you should use quantstrat to contain +all the logic for the strategy, to aid in maintenance and +modifications. - The use of \code{quote()} tells R to not evaluate what's - inside the quote until the function is evaluated later. - By the time that code is evaluated, \code{mktdata} will - be populated with the correct price information based on - the contents of whatever portfolio you are evaluating the - strategy on. +The use of \code{quote()} tells R to not evaluate what's +inside the quote until the function is evaluated later. By +the time that code is evaluated, \code{mktdata} will be +populated with the correct price information based on the +contents of whatever portfolio you are evaluating the +strategy on. - \code{parameters} is another named list, and normally - will not be needed. If you have multiple indicator, - signal, or rule functions share the that \emph{both} - share the same argument names \emph{and} will need to - have different values passed to those arguments as - defined parameters at apply-time, then you may need to - give them unique names so that delayed evaluation can - sort it all out for you at apply-time. We will endeavor - to get an example of named parameters into the demo - scripts. +\code{parameters} is another named list, and normally will +not be needed. If you have multiple indicator, signal, or +rule functions share the that \emph{both} share the same +argument names \emph{and} will need to have different +values passed to those arguments as defined parameters at +apply-time, then you may need to give them unique names so +that delayed evaluation can sort it all out for you at +apply-time. We will endeavor to get an example of named +parameters into the demo scripts. - if \code{label} is not supplied, NULL default will be - converted to '.ind' unless there already exists an - indicator with that label in which case it will be - appended with a number (i.e. '.ind.2', - '.ind.3', etc.). If the indicator function returns - multiple columns, the label will be \code{\link{paste}}'d - to the end of either the returned column names or the - respective column number when applying it to - \code{mktdata}. +if \code{label} is not supplied, NULL default will be +converted to '.ind' unless there already exists an +indicator with that label in which case it will be appended +with a number (i.e. '.ind.2', '.ind.3', etc.). +If the indicator function returns multiple columns, the +label will be \code{\link{paste}}'d to the end of either +the returned column names or the respective column number +when applying it to \code{mktdata}. } \examples{ \dontrun{ @@ -116,7 +113,7 @@ } } \seealso{ - \code{\link{quote}} \code{\link{applyIndicators}} - \code{\link{add.signal}} \code{link{add.rule}} +\code{\link{quote}} \code{\link{applyIndicators}} +\code{\link{add.signal}} \code{link{add.rule}} } Modified: pkg/quantstrat/man/add.init.Rd =================================================================== --- pkg/quantstrat/man/add.init.Rd 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/man/add.init.Rd 2014-03-29 20:39:45 UTC (rev 1594) @@ -2,9 +2,8 @@ \alias{add.init} \title{add arbitrary initialization functions to a strategy} \usage{ - add.init(strategy, name, arguments, parameters = NULL, - label = NULL, ..., enabled = TRUE, indexnum = NULL, - store = FALSE) +add.init(strategy, name, arguments, parameters = NULL, label = NULL, ..., + enabled = TRUE, indexnum = NULL, store = FALSE) } \arguments{ \item{strategy}{an object (or the name of an object) of @@ -36,27 +35,26 @@ the .strategy environment, or return it. default FALSE} } \value{ - if \code{strategy} was the name of a strategy, the name. - It it was a strategy, the updated strategy. +if \code{strategy} was the name of a strategy, the name. It +it was a strategy, the updated strategy. } \description{ - \code{\link{initStrategy}} will run a series of common - initialization functions at the beginning of an - \code{\link{applyStrategy}} call. This function allows - the user to add arbitrary initialization functions to the - sequence. +\code{\link{initStrategy}} will run a series of common +initialization functions at the beginning of an +\code{\link{applyStrategy}} call. This function allows the +user to add arbitrary initialization functions to the +sequence. } \details{ - These arbitrary functions will be added to the - \code{init} slot of the strategy object and when - \code{applyStrategy} is evaluated, the arbitrary - initialization functions will be evaluated after the - standardized functions. +These arbitrary functions will be added to the \code{init} +slot of the strategy object and when \code{applyStrategy} +is evaluated, the arbitrary initialization functions will +be evaluated after the standardized functions. - For example, if your strategy uses a synthetic basket - instrument, you could use this initialization slot to add - a custom constructor to build the basket instrument time - series and modify the symbols slot(s) of the strategy and - portfolio. +For example, if your strategy uses a synthetic basket +instrument, you could use this initialization slot to add a +custom constructor to build the basket instrument time +series and modify the symbols slot(s) of the strategy and +portfolio. } Modified: pkg/quantstrat/man/add.rule.Rd =================================================================== --- pkg/quantstrat/man/add.rule.Rd 2014-03-29 15:18:31 UTC (rev 1593) +++ pkg/quantstrat/man/add.rule.Rd 2014-03-29 20:39:45 UTC (rev 1594) @@ -2,12 +2,10 @@ \alias{add.rule} \title{add a rule to a strategy} \usage{ - add.rule(strategy, name, arguments, parameters = NULL, - label = NULL, - type = c(NULL, "risk", "order", "rebalance", "exit", "enter", "chain"), - parent = NULL, ..., enabled = TRUE, indexnum = NULL, - path.dep = TRUE, timespan = NULL, store = FALSE, - storefun = TRUE) +add.rule(strategy, name, arguments, parameters = NULL, label = NULL, + type = c(NULL, "risk", "order", "rebalance", "exit", "enter", "chain"), + parent = NULL, ..., enabled = TRUE, indexnum = NULL, path.dep = TRUE, + timespan = NULL, store = FALSE, storefun = TRUE) } \arguments{ \item{strategy}{an object of type 'strategy' to add the @@ -55,88 +53,86 @@ usable} } \value{ - if \code{strategy} was the name of a strategy, the name. - It it was a strategy, the updated strategy. +if \code{strategy} was the name of a strategy, the name. It +it was a strategy, the updated strategy. } \description{ - Rules will be processed in a very particular manner, so - it bears going over. +Rules will be processed in a very particular manner, so it +bears going over. } \details{ - First, rules are either path dependent or - non-path-dependent. Path dependent rules will be - processed in every time increment for the \code{mktdata} - passed into \code{\link{applyStrategy}}. Non path - dependent rules will likely be quite rare in real life, - and will be applied after indicators and signals, and - before path-dependent rules are processed. +First, rules are either path dependent or +non-path-dependent. Path dependent rules will be processed +in every time increment for the \code{mktdata} passed into +\code{\link{applyStrategy}}. Non path dependent rules will +likely be quite rare in real life, and will be applied +after indicators and signals, and before path-dependent +rules are processed. - All rules have a \code{type}. These may be any of: - \describe{ \item{risk}{ rules that check and react to - risk of positions, may stop all other rule execution - temporarily or permanently} \item{order}{ rules for order - processing of any open orders at time t, always - path-dependent} \item{rebalance}{ rules executed - specifically in a portfolio context, unnecessary in - univariate strategies} \item{exit}{ rules to determine - whether to exit a position} \item{enter}{ rules to - determine whether to enter or increase a position} - \item{chain}{ rules executed upon fill of an order - corresponding to the label of the parent rule identified - by the \code{parent} arg. } } +All rules have a \code{type}. These may be any of: +\describe{ \item{risk}{ rules that check and react to risk +of positions, may stop all other rule execution temporarily +or permanently} \item{order}{ rules for order processing of +any open orders at time t, always path-dependent} +\item{rebalance}{ rules executed specifically in a +portfolio context, unnecessary in univariate strategies} +\item{exit}{ rules to determine whether to exit a position} +\item{enter}{ rules to determine whether to enter or +increase a position} \item{chain}{ rules executed upon fill +of an order corresponding to the label of the parent rule +identified by the \code{parent} arg. } } - The rules will be executed by type, in the order listed - above. Multiple rules of each type may be defined, as - with signals and indicators, they will be executed in - order by index number with any other rules sharing the - same type. +The rules will be executed by type, in the order listed +above. Multiple rules of each type may be defined, as with +signals and indicators, they will be executed in order by +index number with any other rules sharing the same type. - The rule execution order was constructed because - path-dependent rules may modify the ability of rules that - have not fired yet to be evaluated. For example, a risk - rule may flatten (close out) an entire position and put - new orders on hold, effectively stopping all further - execution of the strategy. Another example would be a - rebalancing rule function that would enter orders to - rebalance the portfolio, and would hold other strategy - processing until the rebalancing period was over. +The rule execution order was constructed because +path-dependent rules may modify the ability of rules that +have not fired yet to be evaluated. For example, a risk +rule may flatten (close out) an entire position and put new +orders on hold, effectively stopping all further execution +of the strategy. Another example would be a rebalancing +rule function that would enter orders to rebalance the +portfolio, and would hold other strategy processing until +the rebalancing period was over. - The \code{timespan} parameter will limit rule execution - by time of day using time based subsetting. See ISO-8601 - specification and xts documentation for more details. - Note that these are only applicable to intra-day - execution, and will remain that way barring patches - (tests and documentation) from interested parties. The - subsetting may (will likely) work with normal ISO/xts - subset ranges, but consider it unsupported. +The \code{timespan} parameter will limit rule execution by +time of day using time based subsetting. See ISO-8601 +specification and xts documentation for more details. Note +that these are only applicable to intra-day execution, and +will remain that way barring patches (tests and +documentation) from interested parties. The subsetting may +(will likely) work with normal ISO/xts subset ranges, but +consider it unsupported. - The \code{name} parameter should be a character string - naming the function to be called in the - \code{\link{applyRules}} loop. The \code{add.rule} - function will then call \code{\link{match.fun}}, ands - store the actual function in your strategy object. This - will avoid lookups via \code{\link{match.fun}} at - \code{\link{applyRules}} time, and may provide a - significant speed increase on higher frequency data (20\% - or more). [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/blotter -r 1594 From noreply at r-forge.r-project.org Sat Mar 29 21:56:08 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 21:56:08 +0100 (CET) Subject: [Blotter-commits] r1595 - in pkg/quantstrat: . demo Message-ID: <20140329205608.A319018737A@r-forge.r-project.org> Author: braverock Date: 2014-03-29 21:56:08 +0100 (Sat, 29 Mar 2014) New Revision: 1595 Modified: pkg/quantstrat/NAMESPACE pkg/quantstrat/demo/macdParameters.R pkg/quantstrat/demo/rsi.R Log: - remove traiing function not pushed to R-Forge svn yet Modified: pkg/quantstrat/NAMESPACE =================================================================== --- pkg/quantstrat/NAMESPACE 2014-03-29 20:39:45 UTC (rev 1594) +++ pkg/quantstrat/NAMESPACE 2014-03-29 20:56:08 UTC (rev 1595) @@ -13,7 +13,7 @@ export(applySignals) export(applyStrategy) export(applyStrategy.rebalancing) -export(applyStrategy.rebalancing.training) +#export(applyStrategy.rebalancing.training) export(chart.forward) export(chart.forward.training) export(delete.paramset) Modified: pkg/quantstrat/demo/macdParameters.R =================================================================== --- pkg/quantstrat/demo/macdParameters.R 2014-03-29 20:39:45 UTC (rev 1594) +++ pkg/quantstrat/demo/macdParameters.R 2014-03-29 20:56:08 UTC (rev 1595) @@ -1,74 +1,74 @@ -# Parameter demo for MACD demo -# -# Author: Yu Chen -############################################################################### - -require(foreach,quietly=TRUE) -require(quantstrat) - -demo('macd',ask=FALSE) - -# example parallel initialization for doParallel. this or doMC, or doRedis are -# most probably preferable to doSMP -#require(doParallel) -#registerDoParallel() # by default number of physical cores -1 - - -#please run macd demo before all these... - -#retrieve the strategy from the environment, since the 'macd' strategy uses store=TRUE -stratMACD<-getStrategy('macd') - -paramStructure<-getParameterTable(stratMACD) - -rm(tPD2) - - -# Just provide leagal values and use random sampling. -# Make nFast and nSlow over lap from 20 to 30 to test the constrains later. -# First call don't need to input tPD2, the funciton will initial one and return it. - -tPD2<-setParameterDistribution(type='indicator',indexnum=1,distribution=list(nFast=(10:30)),label='nFast') - -# Initial one tPD2 and pass it also works as following two lines: -## tPD2<-setParameterDistribution() -## tPD2<-setParameterDistribution(type='indicator',indexnum=1,distribution=list(nFast=(10:30)),label='nFast') - -tPD2<-setParameterDistribution(tPD2,type='indicator',indexnum=1,distribution=list(nSlow=(20:40)),label='nSlow') -tPD2<-setParameterDistribution(tPD2,type='signal',indexnum=1,distribution=list(relationship=c('gt','gte')),label='sig1.gtgte') - -# Put constrains to the nFast and nSlow parameters. -pConstraint2<-setParameterConstraint(constraintLabel='macdPC',paramList=c('nFast','nSlow'),relationship='lt') - - - -#testPackList2<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=3,parameterConstrains=pConstraint2) -#system.time(testPackList2<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=3,parameterConstrains=pConstraint2)) - - -laststpar.rnd<-system.time( - testPackListPL<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=20,parameterConstraints=pConstraint2) -) -#laststpar.rnd - -# Please run either random mode or expand mode, since the latter run will overwrite the objects in .blotter. -#laststpar.exp<-system.time( -# testPackListPL<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=20,parameterConstrains=pConstraint2) -#) -if(verbose >=1) print(laststpar.exp) - -#examine the stats from this parameter run: -if(verbose >=1) print(testPackListPL$statsTable) - -##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ###### -# if(!exists('in_test') || !isTRUE(in_test)){ -# initDate='2005-12-31' # ensure this is demo default -# endDate=Sys.Date() # ensure this is demo default -# } -################################################################ - -##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### -# book = getOrderBook(port) -# stats = tradeStats(port) -# rets = PortfReturns(acct) -################################################################ +# Parameter demo for MACD demo +# +# Author: Yu Chen +############################################################################### + +require(foreach,quietly=TRUE) +require(quantstrat) + +demo('macd',ask=FALSE) + +# example parallel initialization for doParallel. this or doMC, or doRedis are +# most probably preferable to doSMP +#require(doParallel) +#registerDoParallel() # by default number of physical cores -1 + + +#please run macd demo before all these... + +#retrieve the strategy from the environment, since the 'macd' strategy uses store=TRUE +stratMACD<-getStrategy('macd') + +paramStructure<-getParameterTable(stratMACD) + +rm(tPD2) + + +# Just provide leagal values and use random sampling. +# Make nFast and nSlow over lap from 20 to 30 to test the constrains later. +# First call don't need to input tPD2, the funciton will initial one and return it. + +tPD2<-setParameterDistribution(type='indicator',indexnum=1,distribution=list(nFast=(10:30)),label='nFast') + +# Initial one tPD2 and pass it also works as following two lines: +## tPD2<-setParameterDistribution() +## tPD2<-setParameterDistribution(type='indicator',indexnum=1,distribution=list(nFast=(10:30)),label='nFast') + +tPD2<-setParameterDistribution(tPD2,component.type='indicator',indexnum=1,distribution=list(nSlow=(20:40)),label='nSlow') +tPD2<-setParameterDistribution(tPD2,component.type='signal',indexnum=1,distribution=list(relationship=c('gt','gte')),label='sig1.gtgte') + +# Put constrains to the nFast and nSlow parameters. +pConstraint2<-setParameterConstraint(constraintLabel='macdPC',paramList=c('nFast','nSlow'),relationship='lt') + + + +#testPackList2<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=3,parameterConstrains=pConstraint2) +#system.time(testPackList2<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=3,parameterConstrains=pConstraint2)) + + +laststpar.rnd<-system.time( + testPackListPL<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=20,parameterConstraints=pConstraint2) +) +#laststpar.rnd + +# Please run either random mode or expand mode, since the latter run will overwrite the objects in .blotter. +#laststpar.exp<-system.time( +# testPackListPL<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=20,parameterConstrains=pConstraint2) +#) +if(verbose >=1) print(laststpar.exp) + +#examine the stats from this parameter run: +if(verbose >=1) print(testPackListPL$statsTable) + +##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ###### +# if(!exists('in_test') || !isTRUE(in_test)){ +# initDate='2005-12-31' # ensure this is demo default +# endDate=Sys.Date() # ensure this is demo default +# } +################################################################ + +##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ################### +# book = getOrderBook(port) +# stats = tradeStats(port) +# rets = PortfReturns(acct) +################################################################ Modified: pkg/quantstrat/demo/rsi.R =================================================================== --- pkg/quantstrat/demo/rsi.R 2014-03-29 20:39:45 UTC (rev 1594) +++ pkg/quantstrat/demo/rsi.R 2014-03-29 20:56:08 UTC (rev 1595) @@ -103,6 +103,7 @@ charts.PerformanceSummary(ret1$total,geometric=FALSE,wealth.index=TRUE) } + ############################################################################### # R (http://r-project.org/) Quantitative Strategy Model Framework # From noreply at r-forge.r-project.org Sun Mar 30 19:21:55 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 30 Mar 2014 19:21:55 +0200 (CEST) Subject: [Blotter-commits] r1596 - in pkg/blotter: . R Message-ID: <20140330172155.A8464186996@r-forge.r-project.org> Author: braverock Date: 2014-03-30 19:21:55 +0200 (Sun, 30 Mar 2014) New Revision: 1596 Modified: pkg/blotter/DESCRIPTION pkg/blotter/R/PortfReturns.R pkg/blotter/R/addPortfInstr.R pkg/blotter/R/addTxn.R pkg/blotter/R/calcPortfWgt.R pkg/blotter/R/calcPosAvgCost.R pkg/blotter/R/calcTxnAvgCost.R pkg/blotter/R/calcTxnValue.R pkg/blotter/R/chart.ME.R pkg/blotter/R/chart.Posn.R pkg/blotter/R/chart.Reconcile.R pkg/blotter/R/chart.Spread.R pkg/blotter/R/extractTests.R pkg/blotter/R/getAccount.R pkg/blotter/R/getByPortf.R pkg/blotter/R/getBySymbol.R pkg/blotter/R/getEndEq.R pkg/blotter/R/getPortfAcct.R pkg/blotter/R/getPortfolio.R pkg/blotter/R/getPos.R pkg/blotter/R/getPosAvgCost.R pkg/blotter/R/getPosQty.R pkg/blotter/R/getTxn.R pkg/blotter/R/initAcct.R pkg/blotter/R/initPortf.R pkg/blotter/R/initPosPL.R pkg/blotter/R/initSummary.R pkg/blotter/R/initTxn.R pkg/blotter/R/perTradeStats.R pkg/blotter/R/put.account.R pkg/blotter/R/put.portfolio.R pkg/blotter/R/tradeStats.R pkg/blotter/R/updateAcct.R pkg/blotter/R/updateEndEq.R pkg/blotter/R/updatePortf.R pkg/blotter/R/updatePosPL.R Log: - update copyright Modified: pkg/blotter/DESCRIPTION =================================================================== --- pkg/blotter/DESCRIPTION 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/DESCRIPTION 2014-03-30 17:21:55 UTC (rev 1596) @@ -26,5 +26,5 @@ Contributors: Dirk Eddelbuettel, Jan Humme, Lance Levenson, Ben McCann, Jeff Ryan, Garrett See, Joshua Ulrich, Wolfgang Wu URL: https://r-forge.r-project.org/projects/blotter/ -Copyright: (c) 2008-2013 +Copyright: (c) 2008-2014 ByteCompile: TRUE Modified: pkg/blotter/R/PortfReturns.R =================================================================== --- pkg/blotter/R/PortfReturns.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/PortfReturns.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -71,7 +71,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/addPortfInstr.R =================================================================== --- pkg/blotter/R/addPortfInstr.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/addPortfInstr.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -24,7 +24,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/addTxn.R =================================================================== --- pkg/blotter/R/addTxn.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/addTxn.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -303,7 +303,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/calcPortfWgt.R =================================================================== --- pkg/blotter/R/calcPortfWgt.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/calcPortfWgt.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -43,7 +43,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/calcPosAvgCost.R =================================================================== --- pkg/blotter/R/calcPosAvgCost.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/calcPosAvgCost.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -27,7 +27,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/calcTxnAvgCost.R =================================================================== --- pkg/blotter/R/calcTxnAvgCost.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/calcTxnAvgCost.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -13,7 +13,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/calcTxnValue.R =================================================================== --- pkg/blotter/R/calcTxnValue.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/calcTxnValue.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -14,7 +14,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/chart.ME.R =================================================================== --- pkg/blotter/R/chart.ME.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/chart.ME.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -100,7 +100,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/chart.Posn.R =================================================================== --- pkg/blotter/R/chart.Posn.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/chart.Posn.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -94,7 +94,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/chart.Reconcile.R =================================================================== --- pkg/blotter/R/chart.Reconcile.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/chart.Reconcile.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -162,7 +162,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/chart.Spread.R =================================================================== --- pkg/blotter/R/chart.Spread.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/chart.Spread.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -87,7 +87,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/extractTests.R =================================================================== --- pkg/blotter/R/extractTests.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/extractTests.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -56,7 +56,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/getAccount.R =================================================================== --- pkg/blotter/R/getAccount.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/getAccount.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -51,7 +51,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/getByPortf.R =================================================================== --- pkg/blotter/R/getByPortf.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/getByPortf.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -56,7 +56,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/getBySymbol.R =================================================================== --- pkg/blotter/R/getBySymbol.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/getBySymbol.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -55,7 +55,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/getEndEq.R =================================================================== --- pkg/blotter/R/getEndEq.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/getEndEq.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -18,7 +18,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/getPortfAcct.R =================================================================== --- pkg/blotter/R/getPortfAcct.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/getPortfAcct.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -23,7 +23,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/getPortfolio.R =================================================================== --- pkg/blotter/R/getPortfolio.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/getPortfolio.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -82,7 +82,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/getPos.R =================================================================== --- pkg/blotter/R/getPos.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/getPos.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -27,7 +27,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/getPosAvgCost.R =================================================================== --- pkg/blotter/R/getPosAvgCost.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/getPosAvgCost.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -17,7 +17,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/getPosQty.R =================================================================== --- pkg/blotter/R/getPosQty.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/getPosQty.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -31,7 +31,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/getTxn.R =================================================================== --- pkg/blotter/R/getTxn.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/getTxn.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -26,7 +26,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/initAcct.R =================================================================== --- pkg/blotter/R/initAcct.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/initAcct.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -83,7 +83,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/initPortf.R =================================================================== --- pkg/blotter/R/initPortf.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/initPortf.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -98,7 +98,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/initPosPL.R =================================================================== --- pkg/blotter/R/initPosPL.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/initPosPL.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -21,7 +21,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/initSummary.R =================================================================== --- pkg/blotter/R/initSummary.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/initSummary.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -13,7 +13,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/initTxn.R =================================================================== --- pkg/blotter/R/initTxn.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/initTxn.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -19,7 +19,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/perTradeStats.R =================================================================== --- pkg/blotter/R/perTradeStats.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/perTradeStats.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -281,7 +281,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/put.account.R =================================================================== --- pkg/blotter/R/put.account.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/put.account.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -14,7 +14,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/put.portfolio.R =================================================================== --- pkg/blotter/R/put.portfolio.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/put.portfolio.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -14,7 +14,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/tradeStats.R =================================================================== --- pkg/blotter/R/tradeStats.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/tradeStats.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -420,7 +420,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/updateAcct.R =================================================================== --- pkg/blotter/R/updateAcct.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/updateAcct.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -161,7 +161,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/updateEndEq.R =================================================================== --- pkg/blotter/R/updateEndEq.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/updateEndEq.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -45,7 +45,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/updatePortf.R =================================================================== --- pkg/blotter/R/updatePortf.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/updatePortf.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -124,7 +124,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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 Modified: pkg/blotter/R/updatePosPL.R =================================================================== --- pkg/blotter/R/updatePosPL.R 2014-03-29 20:56:08 UTC (rev 1595) +++ pkg/blotter/R/updatePosPL.R 2014-03-30 17:21:55 UTC (rev 1596) @@ -251,7 +251,7 @@ ############################################################################### # 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 +# Copyright (c) 2008-2014 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