[Blotter-commits] r486 - pkg/FinancialInstrument/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 9 17:18:03 CET 2010


Author: braverock
Date: 2010-12-09 17:18:02 +0100 (Thu, 09 Dec 2010)
New Revision: 486

Modified:
   pkg/FinancialInstrument/R/synthetic.R
Log:
- set more reasonable defaults in spread constructor

Modified: pkg/FinancialInstrument/R/synthetic.R
===================================================================
--- pkg/FinancialInstrument/R/synthetic.R	2010-12-09 13:45:19 UTC (rev 485)
+++ pkg/FinancialInstrument/R/synthetic.R	2010-12-09 16:18:02 UTC (rev 486)
@@ -71,13 +71,19 @@
         warning("passing in members as a list not fully tested")
         memberlist=members
     }
-    synthetic(primary_id=primary_id , currency=currency , multiplier=multiplier , identifiers = identifiers, members=memberlist , memberratio=memberratio, ...=... ,type=type)
+    if(is.null(currency)) currency<- as.character(memberlist$currencies[1]) #use the currency of the front leg
+
+    if (hasArg(tick_size)){
+        tick_size<-match.call(expand.dots=TRUE)$tick_size  
+    } else tick_size<-0 
+
+    synthetic(primary_id=primary_id , currency=currency , multiplier=multiplier , identifiers = identifiers, members=memberlist , memberratio=memberratio, ...=... ,type=type, tick_size=tick_size)
 }
 
 #' @export
-spread <- function(primary_id , currency , members=NULL, memberratio, ..., multiplier=1, identifiers = NULL)
+spread <- function(primary_id , currency=NULL , members, memberratio, ..., multiplier=1, identifiers = NULL)
 {
-    synthetic.ratio(primary_id , currency , members=members, memberratio=memberratio, multiplier=multiplier, identifiers = identifiers, ...=..., type=c("spread","synthetic.ratio","synthetic","instrument"))
+    synthetic.ratio(primary_id=primary_id , currency=currency , members=members, memberratio=memberratio, multiplier=multiplier, identifiers = identifiers, ...=..., type=c("spread","synthetic.ratio","synthetic","instrument"))
 }
 
 #' @export



More information about the Blotter-commits mailing list