[Blotter-commits] r1521 - in pkg/blotter: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Oct 9 00:01:26 CEST 2013
Author: bodanker
Date: 2013-10-09 00:01:24 +0200 (Wed, 09 Oct 2013)
New Revision: 1521
Modified:
pkg/blotter/R/addTxn.R
pkg/blotter/man/addTxn.Rd
Log:
- Fix addTxns and add a little documentation
Modified: pkg/blotter/R/addTxn.R
===================================================================
--- pkg/blotter/R/addTxn.R 2013-10-08 18:55:45 UTC (rev 1520)
+++ pkg/blotter/R/addTxn.R 2013-10-08 22:01:24 UTC (rev 1521)
@@ -27,6 +27,12 @@
#' 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.
#'
#' @param Portfolio A portfolio name that points to a portfolio object structured with \code{initPortf()}
#' @param Symbol An instrument identifier for a symbol included in the portfolio, e.g., "IBM"
@@ -168,8 +174,8 @@
PrevPosAvgCost <- .getPosAvgCost(pname, Symbol, index(TxnData[row,]))
}
#TODO create vectorized versions of all these functions so we don't have to loop
- TxnQty <- as.numeric(TxnData[row,'Quantity'])
- TxnPrice <- as.numeric(TxnData[row,'Price'])
+ TxnQty <- as.numeric(TxnData[row,'TxnQty'])
+ TxnPrice <- as.numeric(TxnData[row,'TxnPrice'])
# If TxnFees are to be used, it must be a column in TxnData
TxnFees <- if (any(grepl("TxnFees", colnames(TxnData)))) {
as.numeric(TxnData[row, "TxnFees"])
Modified: pkg/blotter/man/addTxn.Rd
===================================================================
--- pkg/blotter/man/addTxn.Rd 2013-10-08 18:55:45 UTC (rev 1520)
+++ pkg/blotter/man/addTxn.Rd 2013-10-08 22:01:24 UTC (rev 1521)
@@ -74,6 +74,12 @@
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.
}
\note{
The addTxn function will eventually also handle other
More information about the Blotter-commits
mailing list