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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 20 01:52:24 CEST 2011


Author: gsee
Date: 2011-09-20 01:52:24 +0200 (Tue, 20 Sep 2011)
New Revision: 783

Modified:
   pkg/FinancialInstrument/R/buildSpread.R
Log:
 if ratio is a vector, memberratio becomes a list for auto.assign in fn_SpreadBuilder

Modified: pkg/FinancialInstrument/R/buildSpread.R
===================================================================
--- pkg/FinancialInstrument/R/buildSpread.R	2011-09-17 14:03:25 UTC (rev 782)
+++ pkg/FinancialInstrument/R/buildSpread.R	2011-09-19 23:52:24 UTC (rev 783)
@@ -378,7 +378,8 @@
     if (auto.assign) { #store the data in 
         members <- c(prod1,prod2)
         id <- make_spread_id(members, ...) #can pass 'root' or 'format' through dots
-        spread(id, currency=currency, members=members, memberratio=c(1,-ratio), defined.by='fn_SpreadBuilder')
+        memberratio <- if(length(ratio) > 1) {list(1,-as.numeric(ratio))} else c(1,-ratio)
+        spread(id, currency=currency, members=members, memberratio=memberratio, defined.by='fn_SpreadBuilder')
         assign(id, Spread, pos=env)
         id
     } else Spread  



More information about the Blotter-commits mailing list