[Blotter-commits] r7 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Dec 13 20:35:22 CET 2008
Author: peter_carl
Date: 2008-12-13 20:35:22 +0100 (Sat, 13 Dec 2008)
New Revision: 7
Modified:
pkg/R/initPortf.R
Log:
- fixed initial position quantity specification for multiple symbol portfolios
Modified: pkg/R/initPortf.R
===================================================================
--- pkg/R/initPortf.R 2008-12-13 19:33:50 UTC (rev 6)
+++ pkg/R/initPortf.R 2008-12-13 19:35:22 UTC (rev 7)
@@ -23,6 +23,10 @@
# FUNCTION
portfolio=vector("list",length=length(symbols))
names(portfolio)=symbols
+ if(length(initPosQty)==1)
+ initPosQty=rep(initPosQty, length(symbols))
+ if(length(initPosQty)!=length(symbols))
+ stop("The length of initPosQty is unequal to the number of symbols in the portfolio.")
for(instrument in symbols){
i = grep(instrument, symbols)
portfolio[[instrument]]$txn = initTxn(initDate = initDate, initPosQty = initPosQty[i])
More information about the Blotter-commits
mailing list