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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 23 14:53:11 CET 2011


Author: braverock
Date: 2011-02-23 14:53:11 +0100 (Wed, 23 Feb 2011)
New Revision: 559

Modified:
   pkg/FinancialInstrument/R/load.instruments.R
Log:
- add src argument to allow pointing at other getSymbols functions

Modified: pkg/FinancialInstrument/R/load.instruments.R
===================================================================
--- pkg/FinancialInstrument/R/load.instruments.R	2011-02-17 15:17:31 UTC (rev 558)
+++ pkg/FinancialInstrument/R/load.instruments.R	2011-02-23 13:53:11 UTC (rev 559)
@@ -140,12 +140,13 @@
 #' @param split_method string specifying the method files are split, currently \sQuote{days} or \sQuote{common}, see Details
 #' @param use_identifier string identifying which column should be use to construct the \code{primary_id} of the instrument, default 'primary_id'
 #' @param extension file extension, default "rda"
+#' @param src which \code{\linkp[quantmod]{getSymbols}} sub-type to use, default \code{\link{getSymbols.FI}} by setting 'FI'
 #' @seealso \code{\link{load.instruments}} 
 #' \code{\link{getSymbols.FI}}
 #' \code{\link{load.instruments}}
 #' \code{\link[quantmod]{setSymbolLookup}}
 #' @export
-setSymbolLookup.FI<-function(base_dir,..., split_method=c("days","common"), storage_method='rda', use_identifier='primary_id', extension='rda'){
+setSymbolLookup.FI<-function(base_dir,..., split_method=c("days","common"), storage_method='rda', use_identifier='primary_id', extension='rda', src='FI'){
     # check that base_dir exists
     if(!file.exists(base_dir)) stop('base_dir ',base_dir,' does not seem to specify a valid path' )
     
@@ -155,12 +156,14 @@
     #load all instrument names
     instr_names<-ls(pos=.instrument)
     
+    #TODO add check to make sure that src is actually the name of a getSymbols function
+    
     #initialize list
     params<-list()
     params$storage_method<-storage_method
     params$extension<-extension
     params$split_method<-split_method
-    params$src<-"FI"
+    params$src<-src
     new.symbols<-list()
     ndc<-nchar(base_dir)
     if(substr(base_dir,ndc,ndc)=='/') sepch='' else sepch='/'



More information about the Blotter-commits mailing list