[Blotter-commits] r1517 - pkg/quantstrat/demo

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Oct 3 22:10:10 CEST 2013


Author: braverock
Date: 2013-10-03 22:10:10 +0200 (Thu, 03 Oct 2013)
New Revision: 1517

Modified:
   pkg/quantstrat/demo/faber_rebal.R
Log:
- updates to only pass one column prices/pos on deeer in the code


Modified: pkg/quantstrat/demo/faber_rebal.R
===================================================================
--- pkg/quantstrat/demo/faber_rebal.R	2013-10-03 20:09:08 UTC (rev 1516)
+++ pkg/quantstrat/demo/faber_rebal.R	2013-10-03 20:10:10 UTC (rev 1517)
@@ -94,7 +94,7 @@
 # set intial position limits
 posval<-initEq/length(symbols)
 for(symbol in symbols){
-    pos<-round((posval/first(getPrice(get(symbol)))),-2)
+    pos<-round((posval/first(getPrice(get(symbol)))[,1]),-2)
     addPosLimit('faber',symbol,initDate, maxpos=pos,minpos=-pos)
 }
 print("setup completed")
@@ -121,7 +121,7 @@
 add.rule('faber', 'rulePctEquity',
         arguments=list(rebalance_on='quarters',
                 trade.percent=1/length(symbols),
-                refprice=quote(last(getPrice(mktdata)[paste('::',timestamp,sep='')])),
+                refprice=quote(last(getPrice(mktdata)[paste('::',timestamp,sep='')][,1])),
                 digits=0
         ),
         type='rebalance',



More information about the Blotter-commits mailing list