[Blotter-commits] r1640 - in pkg/FinancialInstrument: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Oct 11 23:54:36 CEST 2014


Author: gsee
Date: 2014-10-11 23:54:35 +0200 (Sat, 11 Oct 2014)
New Revision: 1640

Modified:
   pkg/FinancialInstrument/NEWS
   pkg/FinancialInstrument/R/load.instruments.R
   pkg/FinancialInstrument/man/getSymbols.FI.Rd
Log:
allow for options() to be set, which getSymbols.FI() will check.  See NEWS.

Modified: pkg/FinancialInstrument/NEWS
===================================================================
--- pkg/FinancialInstrument/NEWS	2014-10-08 13:38:22 UTC (rev 1639)
+++ pkg/FinancialInstrument/NEWS	2014-10-11 21:54:35 UTC (rev 1640)
@@ -7,6 +7,13 @@
 * No longer using Defaults package (which is now archived on CRAN) in
   getSymbols.FI.
 
+* getSymbols.FI() allows the user to set default values by checking for 
+  options().  For example, the default value for from= is now 
+  getOption("getSymbols.FI.from", "2010-01-01").  So, if you do not set the
+  "getSymbols.FI.from" option, the value will be what it always has been 
+  ("2010-01-01"), but if you did set a value (e.g. 
+  options(getSymbols.FI.from="2014-01-01")), then that value will be used.
+
 * remove some `:::` calls to unexported functions from quantmod.
 
 * saveInstruments() gains a "compress" argument to allow for different 

Modified: pkg/FinancialInstrument/R/load.instruments.R
===================================================================
--- pkg/FinancialInstrument/R/load.instruments.R	2014-10-08 13:38:22 UTC (rev 1639)
+++ pkg/FinancialInstrument/R/load.instruments.R	2014-10-11 21:54:35 UTC (rev 1640)
@@ -287,19 +287,23 @@
 #' }
 #' @export
 getSymbols.FI <- function(Symbols,
-                            from='2010-01-01',
-                            to=Sys.Date(),
+                            from=getOption("getSymbols.FI.from", "2010-01-01"),
+                            to=getOption("getSymbols.FI.to", Sys.Date()),
                             ..., 
-                            dir="",
-                            return.class="xts",
-                            extension="rda",
-                            split_method = c("days", "common"),
-                            use_identifier = NA,
-                            date_format=NULL,
-                            verbose=TRUE,
-                            days_to_omit=c("Saturday", "Sunday"),
-                            indexTZ=NA
-                         ) 
+                            dir=getOption("getSymbols.FI.dir", ""),
+                            return.class=getOption("getSymbols.FI.return.class", 
+                                                   "xts"),
+                            extension=getOption("getSymbols.FI.extension", "rda"),
+                            split_method=getOption("getSymbols.FI.split_method",
+                                                   c("days", "common")),
+                            use_identifier=getOption("getSymbols.FI.use_identifier",
+                                                     NA),
+                            date_format=getOption("getSymbols.FI.date_format"),
+                            verbose=getOption("getSymbols.FI.verbose", TRUE),
+                            days_to_omit=getOption("getSymbols.FI.days_to_omit",
+                                                   c("Saturday", "Sunday")),
+                            indexTZ=getOption("getSymbols.FI.indexTZ", NA)
+                         )
 {
     if (is.null(date_format)) date_format <- "%Y.%m.%d"
     if (is.null(days_to_omit)) days_to_omit <- 'NULL'

Modified: pkg/FinancialInstrument/man/getSymbols.FI.Rd
===================================================================
--- pkg/FinancialInstrument/man/getSymbols.FI.Rd	2014-10-08 13:38:22 UTC (rev 1639)
+++ pkg/FinancialInstrument/man/getSymbols.FI.Rd	2014-10-11 21:54:35 UTC (rev 1640)
@@ -3,11 +3,17 @@
 \alias{getSymbols.FI}
 \title{getSymbols method for loading data from split files}
 \usage{
-getSymbols.FI(Symbols, from = "2010-01-01", to = Sys.Date(), ...,
-  dir = "", return.class = "xts", extension = "rda",
-  split_method = c("days", "common"), use_identifier = NA,
-  date_format = NULL, verbose = TRUE, days_to_omit = c("Saturday",
-  "Sunday"), indexTZ = NA)
+getSymbols.FI(Symbols, from = getOption("getSymbols.FI.from", "2010-01-01"),
+  to = getOption("getSymbols.FI.to", Sys.Date()), ...,
+  dir = getOption("getSymbols.FI.dir", ""),
+  return.class = getOption("getSymbols.FI.return.class", "xts"),
+  extension = getOption("getSymbols.FI.extension", "rda"),
+  split_method = getOption("getSymbols.FI.split_method", c("days", "common")),
+  use_identifier = getOption("getSymbols.FI.use_identifier", NA),
+  date_format = getOption("getSymbols.FI.date_format"),
+  verbose = getOption("getSymbols.FI.verbose", TRUE),
+  days_to_omit = getOption("getSymbols.FI.days_to_omit", c("Saturday",
+  "Sunday")), indexTZ = getOption("getSymbols.FI.indexTZ", NA))
 }
 \arguments{
 \item{Symbols}{a character vector specifying the names of each symbol to be



More information about the Blotter-commits mailing list