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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 11 03:37:18 CEST 2011


Author: gsee
Date: 2011-07-11 03:37:17 +0200 (Mon, 11 Jul 2011)
New Revision: 676

Modified:
   pkg/FinancialInstrument/R/redenominate.R
Log:
 unapply multiplier after redenominate

Modified: pkg/FinancialInstrument/R/redenominate.R
===================================================================
--- pkg/FinancialInstrument/R/redenominate.R	2011-07-11 00:48:24 UTC (rev 675)
+++ pkg/FinancialInstrument/R/redenominate.R	2011-07-11 01:37:17 UTC (rev 676)
@@ -298,7 +298,11 @@
         instr <- try(getInstrument(symbol,silent=TRUE))
         if (!is.instrument(instr)) {
             if (is.null(old_base)) stop(paste("If old_base is not provided, ", symbol, ' must be defined.', sep=""))
-        } else old_base <- instr$currency
+            mult <- 1        
+        } else {
+            old_base <- instr$currency
+            mult <- as.numeric(instr$multiplier)    
+        }
         if (is.character(x)) x <- get(symbol,pos=env)
     }
     #Now figure out the exchange rate
@@ -354,7 +358,7 @@
     assign(rsym,rate,pos=tmpenv)
     assign(symbol,x,pos=tmpenv)
     
-    buildRatio(c(symbol,rsym),env=tmpenv, silent=TRUE)
+    buildRatio(c(symbol,rsym),env=tmpenv, silent=TRUE) / mult
 #TODO: colnames
 #TODO: auto.assign
 }



More information about the Blotter-commits mailing list