[Blotter-commits] r799 - in pkg/FinancialInstrument: R sandbox

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 27 07:25:56 CEST 2011


Author: gsee
Date: 2011-09-27 07:25:54 +0200 (Tue, 27 Sep 2011)
New Revision: 799

Modified:
   pkg/FinancialInstrument/R/instrument.R
   pkg/FinancialInstrument/R/parse_id.R
   pkg/FinancialInstrument/sandbox/ISO.currencies.wiki.R
Log:
 patches for OSI ids

Modified: pkg/FinancialInstrument/R/instrument.R
===================================================================
--- pkg/FinancialInstrument/R/instrument.R	2011-09-26 22:19:29 UTC (rev 798)
+++ pkg/FinancialInstrument/R/instrument.R	2011-09-27 05:25:54 UTC (rev 799)
@@ -765,6 +765,9 @@
             return(synthetic(gsub("\\^","",primary_id), currency=currency, src=list(src='yahoo',name=primary_id), defined_by='auto', ...))
         } else return(synthetic(members=strsplit(primary_id,"\\.")[[1]], currency=currency, defined.by='auto', ...) )
     } 
+    ss <- strsplit(primary_id," ")[[1]]  #take out spaces (OSI uses spaces, but makenames would turn them into dots)
+    ss <- ss[!ss %in% ""]
+    if (length(ss) == 2) primary_id <- paste(ss,collapse="_")
     dargs$primary_id <- primary_id
     dargs$currency <- currency
     dargs$multiplier <- multiplier

Modified: pkg/FinancialInstrument/R/parse_id.R
===================================================================
--- pkg/FinancialInstrument/R/parse_id.R	2011-09-26 22:19:29 UTC (rev 798)
+++ pkg/FinancialInstrument/R/parse_id.R	2011-09-27 05:25:54 UTC (rev 799)
@@ -140,6 +140,7 @@
             suffix <- strsplit(x,"_")[[1]][2]
         }        
     }
+    root <- gsub(" ","",root)    
     suff <- parse_suffix(suffix, silent=silent)
     if (sufftype) type <- suff$type
     if (suffformat) format <- suff$format

Modified: pkg/FinancialInstrument/sandbox/ISO.currencies.wiki.R
===================================================================
--- pkg/FinancialInstrument/sandbox/ISO.currencies.wiki.R	2011-09-26 22:19:29 UTC (rev 798)
+++ pkg/FinancialInstrument/sandbox/ISO.currencies.wiki.R	2011-09-27 05:25:54 UTC (rev 799)
@@ -41,7 +41,10 @@
 }
 
 #rm_currencies()
-#define_currencies.wiki(c("USD","EUR","ADP","ETB","GBP","BTC"))
+#define_currencies.wiki(c("USD","XAU"))
+#exchange_rate("XAUUSD",src=list(src='oanda',name='XAU/USD'))
+
+#define_currencies.wiki(c("JPY","EUR","ADP","ETB","GBP","BTC"))
 #define_currencies.wiki()
 
 #_______________________________________________________________________________________



More information about the Blotter-commits mailing list