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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Apr 9 22:11:14 CEST 2011


Author: braverock
Date: 2011-04-09 22:11:13 +0200 (Sat, 09 Apr 2011)
New Revision: 594

Modified:
   pkg/quantstrat/R/rules.R
   pkg/quantstrat/R/signals.R
   pkg/quantstrat/R/traderules.R
Log:
- make quantstrat less 'chatty' with Warnings

Modified: pkg/quantstrat/R/rules.R
===================================================================
--- pkg/quantstrat/R/rules.R	2011-04-09 20:08:19 UTC (rev 593)
+++ pkg/quantstrat/R/rules.R	2011-04-09 20:11:13 UTC (rev 594)
@@ -242,7 +242,7 @@
             
             if(!isTRUE(rule$enabled)) next()
             
-			# check to see if we should run in this timepan
+			# check to see if we should run in this timespan
 			if(!is.null(rule$timespan) & nrow(mktdata[rule$timespan]==0)) next()
 			
             # see 'S Programming' p. 67 for this matching

Modified: pkg/quantstrat/R/signals.R
===================================================================
--- pkg/quantstrat/R/signals.R	2011-04-09 20:08:19 UTC (rev 593)
+++ pkg/quantstrat/R/signals.R	2011-04-09 20:11:13 UTC (rev 594)
@@ -81,8 +81,8 @@
         onames <- names(.formals)
         
         pm <- pmatch(names(signal$arguments), onames, nomatch = 0L)
-        if (any(pm == 0L))
-            warning(paste("some arguments stored for",signal$name,"do not match"))
+        #if (any(pm == 0L))
+        #    warning(paste("some arguments stored for",signal$name,"do not match"))
         names(signal$arguments[pm > 0L]) <- onames[pm]
         .formals[pm] <- signal$arguments[pm > 0L]		
 		

Modified: pkg/quantstrat/R/traderules.R
===================================================================
--- pkg/quantstrat/R/traderules.R	2011-04-09 20:08:19 UTC (rev 593)
+++ pkg/quantstrat/R/traderules.R	2011-04-09 20:11:13 UTC (rev 594)
@@ -40,9 +40,10 @@
 ruleSignal <- function(data=mktdata, timestamp, sigcol, sigval, orderqty=0, ordertype, orderside=NULL, threshold=NULL, tmult=FALSE, replace=TRUE, delay=0.0001, osFUN='osNoOp', pricemethod=c('market','opside','maker'), portfolio, symbol, ..., ruletype, TxnFees=0, prefer=NULL, sethold=FALSE)
 {
     if(!is.function(osFUN)) osFUN<-match.fun(osFUN)
-    #print(paste(symbol,timestamp))
+    #print(paste(symbol,timestamp, sigval))
     #print(data[timestamp][,sigcol])
-    if (!is.na(data[timestamp][,sigcol]) && data[timestamp][,sigcol] == sigval) {
+    #browser()
+    if (!is.na(timestamp) && !is.na(data[timestamp][,sigcol]) && data[timestamp][,sigcol] == sigval) {
         #calculate order price using pricemethod
         pricemethod<-pricemethod[1] #only use the first if not set by calling function
 



More information about the Blotter-commits mailing list