[Blotter-commits] r1118 - pkg/quantstrat/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 5 18:47:17 CEST 2012


Author: opentrades
Date: 2012-08-05 18:47:17 +0200 (Sun, 05 Aug 2012)
New Revision: 1118

Modified:
   pkg/quantstrat/R/parameters.R
Log:
added support for pos limits to applyParameters(), so it now supports osMaxPos()

Modified: pkg/quantstrat/R/parameters.R
===================================================================
--- pkg/quantstrat/R/parameters.R	2012-08-03 23:31:40 UTC (rev 1117)
+++ pkg/quantstrat/R/parameters.R	2012-08-05 16:47:17 UTC (rev 1118)
@@ -342,6 +342,10 @@
     stock.str<-names(initialPortf$symbols)
     initDate<-time(first(initialPortf$symbols[[1]]$posPL))
     
+    limits<-list()
+    for(symbol in names(initialPortf$symbols))
+        limits[[symbol]]<-initialPortf$symbols[[symbol]]$PosLimit
+
     tmp_strategy<-strategy
     
     testPackList<-list()
@@ -586,6 +590,9 @@
                 try({initAcct(testPack$account.st,testPack$portfolio.st, initDate=initDate)})
                 try({initOrders(portfolio=testPack$portfolio.st,initDate=initDate)})
                 
+                for(symbol in names(limits))
+                    addPosLimit(portfolio=testPack$portfolio.st, symbol=symbol, timestamp=initDate, maxpos=limits[[symbol]]$MaxPos[[1]])
+
 # Apply strategy ######################################################################################
                 if(verbose >=1) print("Apply strategy...")
                 



More information about the Blotter-commits mailing list