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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 27 20:25:30 CET 2011


Author: braverock
Date: 2011-12-27 20:25:29 +0100 (Tue, 27 Dec 2011)
New Revision: 895

Modified:
   pkg/FinancialInstrument/R/buildSpread.R
Log:
- remove spurious getPrice which breaks the function

Modified: pkg/FinancialInstrument/R/buildSpread.R
===================================================================
--- pkg/FinancialInstrument/R/buildSpread.R	2011-12-27 19:15:31 UTC (rev 894)
+++ pkg/FinancialInstrument/R/buildSpread.R	2011-12-27 19:25:29 UTC (rev 895)
@@ -106,7 +106,7 @@
         } else pref=prefer
         if (!is.logical(instr_prices) || ncol(instr_prices) > 1) instr_prices <- getPrice(instr_prices,prefer=pref)
         if (instr$currency != spread_currency) 
-            instr_prices <- getPrice(redenominate(instr_prices,spread_currency,instr$currency), pref=pref)
+            instr_prices <- redenominate(instr_prices,spread_currency,instr$currency)
         instr_norm <- instr_prices * instr_mult * instr_ratio
         colnames(instr_norm) <- paste(as.character(spread_instr$members[i]), 
             prefer, sep = ".")
@@ -122,6 +122,7 @@
     }
     spreadseries <- spreadseries[paste(last.from, first.to, sep="/")]
     spreadseries <- na.locf(spreadseries,na.rm=TRUE)
+    #browser()
     spreadlevel = xts(rowSums(spreadseries),order.by=index(spreadseries)) #assumes negative memberratio values for shorts in 'memberratio'
     if (onelot) 
         spreadlevel = spreadlevel/abs(spread_instr$memberratio[1]) #abs() takes care of things like a crack spread which is -3:2:1.



More information about the Blotter-commits mailing list