[R-SIG-Finance] quantstrat spread parameter sweep problem

Rob Schmidt roschm at ymail.com
Sat Apr 20 16:29:19 CEST 2013


Hello all,

I am stuck on making a parameter sweep of a spread and have attached 
the version that gets the farthest before failing.  This has driven me 
to extreme measures like reading the documentation and trying to upgrade 
my debugging skills.  

The code gets through the basic calculations and makes a chart so the 
spread definitions seem ok.  But it fails in applyParameter.  The variable 
values are reasonable as far as I can tell until %dopar% in the foreach() 
command in parameters.R.  Then the debugger takes the rest of the 
command in {} as a big chunk and my modest debug skills fail.  This 
sweep code works when I use a single contract rather than a spread.  
Here is the error.  The traceback points to the chunk of code after 
%dopar% so I won't repeat that.

Thanks to the authors for this great effort. Thanks for all help.

Best regards,

Rob

> source('~/work/R/quantstrat/spread-sweep05.R')
[1] "2011-03-01 00:00:00 SPY.DIA -100 @ 10.9387968680294"
[1] "2011-03-07 00:00:00 SPY.DIA 100 @ 10.8600842370335"
[1] "2011-03-10 00:00:00 SPY.DIA -100 @ 9.82580786782957"
[1] "2011-03-11 00:00:00 SPY.DIA 100 @ 10.0274530275673"
[1] "2011-03-15 00:00:00 SPY.DIA -100 @ 9.2739827055253"
[1] "2011-04-06 00:00:00 SPY.DIA 100 @ 9.78335984354628"
[1] "2011-04-13 00:00:00 SPY.DIA -100 @ 9.02241069100391"
Realized PL: -63.23097 
[1] "Object for parameter distribution initialized..."
[1] "Parameter constraint object initialized..."
[1] "ParamTable generated"
numValues: 5, numResults: 0, stopped: TRUE
got results for task 1
accumulate got an error result
numValues: 5, numResults: 1, stopped: TRUE
returning status FALSE
got results for task 2
numValues: 5, numResults: 2, stopped: TRUE
returning status FALSE
got results for task 3
numValues: 5, numResults: 3, stopped: TRUE
returning status FALSE
got results for task 4
numValues: 5, numResults: 4, stopped: TRUE
returning status FALSE
got results for task 5
numValues: 5, numResults: 5, stopped: TRUE
not calling combine function due to errors
returning status TRUE
Error in { (from spread-sweep05.R#193) : task 1 failed - "argument is of
length zero"
> sessionInfo()
R version 2.15.3 (2013-03-01)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] doMC_1.3.0                 iterators_1.0.6           
 [3] quantstrat_0.7.7           foreach_1.4.0             
 [5] blotter_0.8.14             PerformanceAnalytics_1.1.0
 [7] FinancialInstrument_1.1.7  quantmod_0.4-0            
 [9] Defaults_1.1-1             TTR_0.22-0                
[11] xts_0.9-3                  zoo_1.7-9                 
[13] vimcom_0.9-8               setwidth_1.0-3            

loaded via a namespace (and not attached):
[1] codetools_0.2-8 compiler_2.15.3 grid_2.15.3     lattice_0.20-13
[5] tools_2.15.3

spread-sweep05.R
<http://r.789695.n4.nabble.com/file/n4664819/spread-sweep05.R>  



--
View this message in context: http://r.789695.n4.nabble.com/quantstrat-spread-parameter-sweep-problem-tp4664819.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list