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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 10 13:46:22 CEST 2011


Author: braverock
Date: 2011-04-10 13:46:22 +0200 (Sun, 10 Apr 2011)
New Revision: 595

Modified:
   pkg/FinancialInstrument/R/buildSpread.R
Log:
- clean up SpreadBuilder code a bit

Modified: pkg/FinancialInstrument/R/buildSpread.R
===================================================================
--- pkg/FinancialInstrument/R/buildSpread.R	2011-04-09 20:11:13 UTC (rev 594)
+++ pkg/FinancialInstrument/R/buildSpread.R	2011-04-10 11:46:22 UTC (rev 595)
@@ -89,7 +89,7 @@
 #' @param unique_method method for making the time series unique, see Details
 #' @author Lance Levenson, Brian Peterson
 #' @export
-fn_SpreadBuilder <- function(prod1, prod2, from, to, ratio, session_times=NULL, unique_method=c('make.index.unique','duplicated','leastliq','price_change'))
+fn_SpreadBuilder <- function(prod1, prod2, from, to, ratio, session_times=NULL, unique_method=c('make.index.unique','duplicated','least.liq','price.change'))
 {
     #print(paste(date," ",prod1,".",prod2,sep=""))
     
@@ -166,8 +166,8 @@
     Spread$Mid.Price <- (Spread$Bid.Price + Spread$Ask.Price) / 2
     
     switch(unique_method,
-            make_index_unique = {Spread<-make.index.unique(Spread)},
-            leastliq = {
+            make.index.unique = {Spread<-make.index.unique(Spread)},
+            least.liq = {
                 #determine the least liquid
                 idx1 <- index(na.omit(getPrice(Data.1)))
                 idx2 <- index(na.omit(getPrice(Data.2)))
@@ -179,7 +179,7 @@
             duplicated = {
                 Spread <- Spread[!duplicated(index(Spread))]  #this may still be useful for instrument with huge numders of observations 
             },
-            price_change = {
+            price.change = {
                 Spread <- Spread[which(diff(Spread$Mid.Price)!=0 | 
                                         diff(Spread$Bid.Price)!=0 | 
                                         diff(Spread$Ask.Price)!=0) ,]



More information about the Blotter-commits mailing list