From noreply at r-forge.r-project.org Thu Apr 2 03:06:32 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 2 Apr 2015 03:06:32 +0200 (CEST) Subject: [Blotter-commits] r1682 - pkg/blotter/R Message-ID: <20150402010632.A0B54187616@r-forge.r-project.org> Author: bodanker Date: 2015-04-02 03:06:31 +0200 (Thu, 02 Apr 2015) New Revision: 1682 Modified: pkg/blotter/R/updateAcct.R Log: Initialize invert to FALSE Reported on stackoverflow: http://stackoverflow.com/q/29367523/271616 Modified: pkg/blotter/R/updateAcct.R =================================================================== --- pkg/blotter/R/updateAcct.R 2015-02-12 12:34:19 UTC (rev 1681) +++ pkg/blotter/R/updateAcct.R 2015-04-02 01:06:31 UTC (rev 1682) @@ -51,6 +51,7 @@ FXrate.str<-paste(p.ccy.str,a.ccy.str,sep='') # currency quote convention is EURUSD which reads as "USD per EUR" FXrate<-try(get(FXrate.str), silent=TRUE) #TODO FIXME: this uses convention to sort out the rate, we should check $currency and $counter_currency and make sure directionality is correct + invert=FALSE if(inherits(FXrate,"try-error")){ FXrate.str<-paste(a.ccy.str,p.ccy.str,sep='') FXrate<-try(get(FXrate.str), silent=TRUE) From noreply at r-forge.r-project.org Wed Apr 8 19:55:18 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 8 Apr 2015 19:55:18 +0200 (CEST) Subject: [Blotter-commits] r1683 - pkg/blotter/R Message-ID: <20150408175519.092F118740F@r-forge.r-project.org> Author: bodanker Date: 2015-04-08 19:55:18 +0200 (Wed, 08 Apr 2015) New Revision: 1683 Modified: pkg/blotter/R/addTxn.R Log: Warn if txn timestamp is not after initDate It doesn't make sense for a portfolio to have a transaction before it was created, and it can cause problems for other functions that operate on the portfolio. Modified: pkg/blotter/R/addTxn.R =================================================================== --- pkg/blotter/R/addTxn.R 2015-04-02 01:06:31 UTC (rev 1682) +++ pkg/blotter/R/addTxn.R 2015-04-08 17:55:18 UTC (rev 1683) @@ -142,6 +142,11 @@ #colnames(NewTxns) = c('Txn.Qty', 'Txn.Price', 'Txn.Value', 'Txn.Avg.Cost', 'Pos.Qty', 'Pos.Avg.Cost', 'Gross.Txn.Realized.PL', 'Txn.Fees', 'Net.Txn.Realized.PL', 'Con.Mult') Portfolio$symbols[[Symbol]]$txn<-rbind(Portfolio$symbols[[Symbol]]$txn, NewTxn) + # Warn if the transaction timestamp is not after initDate + if(.index(NewTxn) <= .index(Portfolio$symbols[[Symbol]]$txn[1L,1L])) + warning("Transaction timestamp (", index(NewTxn[1L,]), ") ", + "is not after initDate (", index(Portfolio$symbols[[Symbol]]$txn[1L,1L]), ").") + if(verbose) # print(paste(TxnDate, Symbol, TxnQty, "@",TxnPrice, sep=" ")) print(paste(format(TxnDate, "%Y-%m-%d %H:%M:%S"), Symbol, TxnQty, "@",TxnPrice, sep=" ")) @@ -181,6 +186,11 @@ NewTxns <- xts(matrix(NA_real_, nrow(TxnData), 10L), index(TxnData)) colnames(NewTxns) <- c('Txn.Qty', 'Txn.Price', 'Txn.Value', 'Txn.Avg.Cost', 'Pos.Qty', 'Pos.Avg.Cost', 'Gross.Txn.Realized.PL', 'Txn.Fees', 'Net.Txn.Realized.PL', 'Con.Mult') + # Warn if the transaction timestamp is not after initDate + if(.index(NewTxns[1L,1L]) <= .index(Portfolio$symbols[[Symbol]]$txn[1L,1L])) + warning("First transaction timestamp (", index(NewTxns[1L,1L]), ") ", + "is not after initDate (", index(Portfolio$symbols[[Symbol]]$txn[1L,1L]), ").") + if(!("TxnQty" %in% colnames(TxnData))) { warning(paste("No TxnQty column found, what did you call it?")) } else { From noreply at r-forge.r-project.org Thu Apr 9 20:39:29 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 9 Apr 2015 20:39:29 +0200 (CEST) Subject: [Blotter-commits] r1684 - in pkg/quantstrat: R man Message-ID: <20150409183929.E9457184B75@r-forge.r-project.org> Author: bodanker Date: 2015-04-09 20:39:29 +0200 (Thu, 09 Apr 2015) New Revision: 1684 Modified: pkg/quantstrat/R/signals.R pkg/quantstrat/man/distributional.boxplot.Rd Log: Parens to curly brace in distributional.boxplot.Rd Fixes #6069. Thanks to Claymore Marshall for the report. Modified: pkg/quantstrat/R/signals.R =================================================================== --- pkg/quantstrat/R/signals.R 2015-04-08 17:55:18 UTC (rev 1683) +++ pkg/quantstrat/R/signals.R 2015-04-09 18:39:29 UTC (rev 1684) @@ -856,7 +856,7 @@ #' Visualization of Single Signal #' -#' This function employs \code(plotSimpleGamlss) in package \code(gamlss.util). +#' This function employs \code{plotSimpleGamlss} in package \code{gamlss.util}. #' #' @param signal list of paramset forward looking price changes by asset #' @param x.val he values of the explanatory variable where we want to see the distribution Modified: pkg/quantstrat/man/distributional.boxplot.Rd =================================================================== --- pkg/quantstrat/man/distributional.boxplot.Rd 2015-04-08 17:55:18 UTC (rev 1683) +++ pkg/quantstrat/man/distributional.boxplot.Rd 2015-04-09 18:39:29 UTC (rev 1684) @@ -25,7 +25,7 @@ plot } \description{ -This function employs \code(plotSimpleGamlss) in package \code(gamlss.util). +This function employs \code{plotSimpleGamlss} in package \code{gamlss.util}. } \author{ Michael Guan From noreply at r-forge.r-project.org Wed Apr 15 04:33:21 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 15 Apr 2015 04:33:21 +0200 (CEST) Subject: [Blotter-commits] r1685 - pkg/blotter/R Message-ID: <20150415023321.8E894187708@r-forge.r-project.org> Author: bodanker Date: 2015-04-15 04:33:20 +0200 (Wed, 15 Apr 2015) New Revision: 1685 Modified: pkg/blotter/R/addTxn.R Log: Update txnfees if txn takes position across zero Update txnfees (instead of TxnFees) when a transaction causes the position to cross zero. txnfees, not TxnFees, is used when creating the new transaction, so the updated transaction fee was not being used for the second transaction. Thanks to Ivan Popivanov for the report and patch. Modified: pkg/blotter/R/addTxn.R =================================================================== --- pkg/blotter/R/addTxn.R 2015-04-09 18:39:29 UTC (rev 1684) +++ pkg/blotter/R/addTxn.R 2015-04-15 02:33:20 UTC (rev 1685) @@ -100,7 +100,7 @@ TxnDate=TxnDate+2*eps #transactions need unique timestamps, so increment a bit TxnQty=TxnQty+PrevPosQty PrevPosQty=0 - TxnFees=txnFeeQty*abs(TxnQty+PrevPosQty) + txnfees=txnFeeQty*abs(TxnQty+PrevPosQty) } if(is.null(ConMult) | !hasArg(ConMult)){