[Blotter-commits] r1565 - in pkg/quantstrat: R demo

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 4 21:15:00 CET 2013


Author: opentrades
Date: 2013-11-04 21:15:00 +0100 (Mon, 04 Nov 2013)
New Revision: 1565

Modified:
   pkg/quantstrat/R/paramsets.R
   pkg/quantstrat/demo/luxor.3.paramset.sma.R
   pkg/quantstrat/demo/luxor.4.paramset.timespan.R
Log:
- fixed single paramset distribution
- fixed luxor demo 4 timespans
- small output file name adjustment for luxor.3 and luxor.4 demos



Modified: pkg/quantstrat/R/paramsets.R
===================================================================
--- pkg/quantstrat/R/paramsets.R	2013-11-04 16:53:04 UTC (rev 1564)
+++ pkg/quantstrat/R/paramsets.R	2013-11-04 20:15:00 UTC (rev 1565)
@@ -36,6 +36,11 @@
 #
 ###############################################################################
 
+# TODO: fix put.portfolio() to use environments
+# TODO: fix expand.grid
+# TODO: "and" multiple constraints i.o. "or"
+
+
 #require(foreach, quietly=TRUE)
 require('foreach')
 #require(iterators, quietly=TRUE)
@@ -141,9 +146,13 @@
     nsamples <- min(nsamples, nrow(param.combos))
 
     param.combos <- param.combos[sample(nrow(param.combos), size=nsamples),]
-    param.combos <- param.combos[with(param.combos,order(param.combos[,1],param.combos[,2])),]
+    
+    if(NCOL(param.combos) == 1)
+        param.combos <- param.combos[order(param.combos)]
+    else
+        param.combos <- param.combos[with(param.combos,order(param.combos[,1],param.combos[,2])),]
 
-    param.combos
+    data.frame(param.combos)
 }
 
 install.param.combo <- function(strategy, param.combo, paramset.label)

Modified: pkg/quantstrat/demo/luxor.3.paramset.sma.R
===================================================================
--- pkg/quantstrat/demo/luxor.3.paramset.sma.R	2013-11-04 16:53:04 UTC (rev 1564)
+++ pkg/quantstrat/demo/luxor.3.paramset.sma.R	2013-11-04 20:15:00 UTC (rev 1565)
@@ -46,5 +46,5 @@
 
 print(stats)
 
-save(stats, file='luxor.3.paramset.SMA.RData')
+save(stats, file='luxor.3.paramset.sma.RData')
 

Modified: pkg/quantstrat/demo/luxor.4.paramset.timespan.R
===================================================================
--- pkg/quantstrat/demo/luxor.4.paramset.timespan.R	2013-11-04 16:53:04 UTC (rev 1564)
+++ pkg/quantstrat/demo/luxor.4.paramset.timespan.R	2013-11-04 20:15:00 UTC (rev 1565)
@@ -8,8 +8,6 @@
 #
 # Paragraph 3.4: luxor timespan paramset optimization
 
-stop('#### DEMO BROKEN - BEING FIXED ###')
-
 require(quantstrat)
 
 source(paste0(path.package("quantstrat"),"/demo/luxor.include.R"))
@@ -47,5 +45,5 @@
 
 print(stats)
 
-save(stats, file='luxor.4.paramset.Timespan.RData')
+save(stats, file='luxor.4.paramset.timespan.RData')
 



More information about the Blotter-commits mailing list