[Blotter-commits] r919 - in pkg/FinancialInstrument: R inst/parser

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 2 16:43:54 CET 2012


Author: gsee
Date: 2012-02-02 16:43:53 +0100 (Thu, 02 Feb 2012)
New Revision: 919

Modified:
   pkg/FinancialInstrument/R/load.instruments.R
   pkg/FinancialInstrument/inst/parser/TRTH_BackFill.R
Log:
give default value to use_identifier.

Modified: pkg/FinancialInstrument/R/load.instruments.R
===================================================================
--- pkg/FinancialInstrument/R/load.instruments.R	2012-02-01 15:27:47 UTC (rev 918)
+++ pkg/FinancialInstrument/R/load.instruments.R	2012-02-02 15:43:53 UTC (rev 919)
@@ -253,13 +253,12 @@
                             return.class="xts",
                             extension="rda",
                             split_method = c("days", "common"),
-                            use_identifier,
+                            use_identifier = NA,
                             date_format=NULL,
                             verbose=TRUE,
                             days_to_omit=c("Saturday", "Sunday")
                          ) 
 {
-    if (missing(use_identifier)) use_identifier <- NA
     if (is.null(date_format)) date_format <- "%Y.%m.%d"
     if (is.null(days_to_omit)) days_to_omit <- 'NULL'
     importDefaults("getSymbols.FI")

Modified: pkg/FinancialInstrument/inst/parser/TRTH_BackFill.R
===================================================================
--- pkg/FinancialInstrument/inst/parser/TRTH_BackFill.R	2012-02-01 15:27:47 UTC (rev 918)
+++ pkg/FinancialInstrument/inst/parser/TRTH_BackFill.R	2012-02-02 15:43:53 UTC (rev 919)
@@ -78,14 +78,16 @@
 CleanUpArchive <- function(archive_dir) {
     # If a job is killed, or it fails, there will probably be files in the
     # archive directory that should be removed.  This will delete files
-    # that do not end with .csv.gz.
+    # that do not end with .csv.gz and are not confirmation files.
     # This will be called from `configureTRTH` and on.exit in `splitCSV`
     if (substr(archive_dir, nchar(archive_dir), nchar(archive_dir)) != "/") {
         archive_dir <- paste(archive_dir, "/", sep="")
     }    
     archive.files <- list.files(archive_dir)
     to.remove <- archive.files[!grepl("\\.csv\\.gz", archive.files)]
-    if (length(to.remove) > 0) warning("Cleaning up archive_dir: removing ", to.remove)
+    to.remove <- to.remove[!grepl("confirmation", to.remove)]
+    if (length(to.remove) > 0) warning(paste("Cleaning up archive_dir: removing", 
+                                       cat(paste(to.remove, collapse="\n"), '\n')))
     paste(archive_dir, to.remove, sep="")
     unlink(to.remove, force=TRUE)
 }
@@ -304,7 +306,7 @@
     #FIXME: respect overwrite argument
     if (missing(.TRTH) && !exists(".TRTH")) stop("Run configureTRTH function first")
     on.exit(CleanUpArchive(.TRTH$archive_dir))
-    if (isTRUE(.TRTH$doCleanUp) CleanUpArchive(.TRTH$archive_dir)
+    if (isTRUE(.TRTH$doCleanUp)) CleanUpArchive(.TRTH$archive_dir)
 
     if (substr(.TRTH$path.output, nchar(.TRTH$path.output), nchar(.TRTH$path.output)) != "/") {
         .TRTH$path.output <- paste(.TRTH$path.output, "/", sep="")



More information about the Blotter-commits mailing list