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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 25 02:26:39 CEST 2013


Author: gsee
Date: 2013-08-25 02:26:39 +0200 (Sun, 25 Aug 2013)
New Revision: 1498

Modified:
   pkg/FinancialInstrument/R/CompareInstrumentFiles.R
   pkg/FinancialInstrument/R/instrument.R
   pkg/FinancialInstrument/R/load.instruments.R
   pkg/FinancialInstrument/R/ls_by_currency.R
   pkg/FinancialInstrument/R/ls_by_expiry.R
   pkg/FinancialInstrument/R/ls_expiries.R
   pkg/FinancialInstrument/R/ls_instruments.R
   pkg/FinancialInstrument/R/ls_instruments_by.R
   pkg/FinancialInstrument/R/ls_strikes.R
   pkg/FinancialInstrument/R/ls_underlyings.R
   pkg/FinancialInstrument/R/saveInstruments.R
   pkg/FinancialInstrument/R/synthetic.R
   pkg/FinancialInstrument/R/update_instruments.yahoo.R
   pkg/FinancialInstrument/man/instrument.Rd
Log:
Remove a bunch of "FinanicalInstrument:::" for CRAN

Modified: pkg/FinancialInstrument/R/CompareInstrumentFiles.R
===================================================================
--- pkg/FinancialInstrument/R/CompareInstrumentFiles.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/CompareInstrumentFiles.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -44,14 +44,14 @@
 CompareInstrumentFiles <- function(file1, file2, ...) {
     force(file1)
     #backup current instrument environment
-    bak <- as.list(FinancialInstrument:::.instrument, all.names=TRUE)
+    bak <- as.list(.instrument, all.names=TRUE)
     # load files to be compared
     reloadInstruments(file1)
-    orig <- as.list(FinancialInstrument:::.instrument, all.names=TRUE)
+    orig <- as.list(.instrument, all.names=TRUE)
     if (!missing(file2)) {
         force(file2)
         reloadInstruments(file2)
-        new <- as.list(FinancialInstrument:::.instrument, all.names=TRUE)
+        new <- as.list(.instrument, all.names=TRUE)
     } else new <- bak
     #restore user's instrument environment
     reloadInstruments(bak)

Modified: pkg/FinancialInstrument/R/instrument.R
===================================================================
--- pkg/FinancialInstrument/R/instrument.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/instrument.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -108,7 +108,7 @@
 #' \code{primary_id}s are already in use.
 #' 
 #' As of version 0.10.0, the .instrument environment is located at the top level
-#' of the package. i.e. \code{FinancialInstrument:::.instrument}.
+#' of the package. i.e. \code{.instrument}.
 #' 
 #' \code{future} and \code{option} are used to define the contract specs of a 
 #' series of instruments.  The \code{primary_id} for these can begin with 1 or 
@@ -244,7 +244,7 @@
   
   if(assign_i)  {
       assign(primary_id, tmpinstr, 
-             envir=as.environment(FinancialInstrument:::.instrument) )
+             envir=as.environment(.instrument) )
       return(primary_id)  
   } else return(tmpinstr) 
 }
@@ -321,7 +321,7 @@
     if(is.null(underlying_id)) {
         warning("underlying_id should only be NULL for cash-settled futures")
     } else {
-        if(!exists(underlying_id, where=FinancialInstrument:::.instrument,
+        if(!exists(underlying_id, where=.instrument,
                    inherits=TRUE)) {
             warning("underlying_id not found") # assumes that we know where to look
         }
@@ -478,7 +478,7 @@
                                                first_traded))
           temp_series$expires<-unique(c(temp_series$expires,expires))
           assign(primary_id, temp_series, 
-                 envir=as.environment(FinancialInstrument:::.instrument))
+                 envir=as.environment(.instrument))
           return(primary_id)
       } else warning("No contract found to update. A new one will be created.")
   }
@@ -539,7 +539,7 @@
   if(is.null(underlying_id)) {
       warning("underlying_id should only be NULL for cash-settled options")
   } else {
-      if(!exists(underlying_id, where=FinancialInstrument:::.instrument,
+      if(!exists(underlying_id, where=.instrument,
                  inherits=TRUE)) {
           warning("underlying_id not found") # assumes that we know where to look
       }
@@ -656,7 +656,7 @@
                                                  first_traded))
             temp_series$expires<-unique(c(temp_series$expires,expires))
             assign(primary_id, temp_series, 
-                   envir=as.environment(FinancialInstrument:::.instrument))
+                   envir=as.environment(.instrument))
             return(primary_id)
         } else {
             warning("No contract found to update.  A new one will be created.")
@@ -851,7 +851,7 @@
     class(ccy)<-c("currency","instrument")
     if (assign_i) {
         assign(primary_id, ccy, 
-               pos=as.environment(FinancialInstrument:::.instrument) )
+               pos=as.environment(.instrument) )
         return(primary_id)
     }
     ccy
@@ -918,11 +918,11 @@
   }
   if (is.null(currency)) currency <- substr(primary_id,4,6)
   if (is.null(counter_currency)) counter_currency <- substr(primary_id,1,3)
-  if(!exists(currency, where=FinancialInstrument:::.instrument,inherits=TRUE)) {
+  if(!exists(currency, where=.instrument,inherits=TRUE)) {
     warning(paste("currency",currency,"not found")) # assumes that we know where to look
   }
   if(!exists(counter_currency, 
-    where=FinancialInstrument:::.instrument,inherits=TRUE)) {
+    where=.instrument,inherits=TRUE)) {
         warning(paste("counter_currency",counter_currency,"not found")) # assumes that we know where to look
   }
 
@@ -971,7 +971,7 @@
         temp_series$first_traded<-c(temp_series$first_traded,first_traded)
         temp_series$maturity<-c(temp_series$maturity,maturity)
         assign(id, temp_series, 
-               envir=as.environment(FinancialInstrument:::.instrument))
+               envir=as.environment(.instrument))
     } else {
         dargs<-list(...)
         dargs$currency=NULL
@@ -1298,12 +1298,12 @@
 #' @export
 #' @rdname getInstrument
 getInstrument <- function(x, Dates=NULL, silent=FALSE, type='instrument'){
-    tmp_instr <- try(get(x,pos=FinancialInstrument:::.instrument),silent=TRUE)
+    tmp_instr <- try(get(x,pos=.instrument),silent=TRUE)
     if(inherits(tmp_instr,"try-error") || !inherits(tmp_instr, type)){
         xx <- make.names(x)
         ## First, look to see if x matches any identifiers.
         # unlist all instruments into a big named vector
-        ul.instr <- unlist(as.list(FinancialInstrument:::.instrument, 
+        ul.instr <- unlist(as.list(.instrument, 
                                    all.names=TRUE))
         # subset by names that include "identifiers"
         ul.ident <- ul.instr[grep('identifiers', names(ul.instr))]
@@ -1314,7 +1314,7 @@
         if (length(tmpname) > 0) {
             #primary_id is everything before .identifiers
             id <- gsub("\\.identifiers.*", "", names(tmpname))
-            tmp_instr <- try(get(id, pos=FinancialInstrument:::.instrument), 
+            tmp_instr <- try(get(id, pos=.instrument), 
                              silent=TRUE)
             if (inherits(tmp_instr, type)) {
                 #&& (x %in% tmp_instr$identifiers || x %in% make.names(tmp_instr$identifiers))
@@ -1326,14 +1326,14 @@
         # to the beginning of id.
         char.x <- strsplit(x, "")[[1]] # split x into vector of characters
         x <- substr(x, grep("[^\\.]", char.x)[1], length(char.x)) # excluding leading dots
-        tmp_instr<-try(get(x,pos=FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr<-try(get(x,pos=.instrument),silent=TRUE)
         if(!inherits(tmp_instr,type)) {
             tmp_instr<-try(get(paste(".",x,sep=""),
-                               pos=FinancialInstrument:::.instrument),
+                               pos=.instrument),
                            silent=TRUE)
             if(!inherits(tmp_instr,type)) {
                 tmp_instr<-try(get(paste("..",x,sep=""),
-                                   pos=FinancialInstrument:::.instrument),
+                                   pos=.instrument),
                                silent=TRUE)
             }
         }
@@ -1402,7 +1402,7 @@
     if (inherits(instr, 'try-error') || !is.instrument(instr))
         stop(paste('instrument ',primary_id,' must be defined first.',sep=''))
     if (attr == 'primary_id') {
-        rm(list = primary_id, pos = FinancialInstrument:::.instrument)
+        rm(list = primary_id, pos = .instrument)
     } else if (attr == 'currency') {
         if (!is.currency.name(value)) {
             stop("currency ", value, " must be an object of type 'currency'")
@@ -1440,7 +1440,7 @@
         }
     }
     instr[[attr]] <- value
-    assign(instr$primary_id, instr, pos=FinancialInstrument:::.instrument)
+    assign(instr$primary_id, instr, pos=.instrument)
 }
 
 

Modified: pkg/FinancialInstrument/R/load.instruments.R
===================================================================
--- pkg/FinancialInstrument/R/load.instruments.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/load.instruments.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -181,7 +181,7 @@
 
     #load all instrument names
     instr_names <- if(missing(Symbols)) {
-        ls_non_currencies(ls(pos=FinancialInstrument:::.instrument)) #if roots begin with a dot, this will filter out roots and currencies
+        ls_non_currencies(ls(pos=.instrument)) #if roots begin with a dot, this will filter out roots and currencies
     } else Symbols
     
     #TODO add check to make sure that src is actually the name of a getSymbols function

Modified: pkg/FinancialInstrument/R/ls_by_currency.R
===================================================================
--- pkg/FinancialInstrument/R/ls_by_currency.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/ls_by_currency.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -81,7 +81,7 @@
         
     tmp_symbols <- NULL            
     for (symbol in symbols) {
-        tmp_instr <- try(get(symbol, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(symbol, pos = .instrument),silent=TRUE)
         if (is.instrument(tmp_instr) && 
           tmp_instr$currency == currency ){    
             tmp_symbols <- c(tmp_symbols,symbol)
@@ -101,7 +101,7 @@
     if (missing(x)) {
         x <- ls_by_currency(currency,show.currencies=sc)
     } else x <- ls_by_currency(currency,pattern=x,show.currencies=sc)
-    rm(list=x,pos=FinancialInstrument:::.instrument)
+    rm(list=x,pos=.instrument)
 }
 
 #AUD GBP CAD EUR JPY CHF HKD SEK NZD

Modified: pkg/FinancialInstrument/R/ls_by_expiry.R
===================================================================
--- pkg/FinancialInstrument/R/ls_by_expiry.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/ls_by_expiry.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -61,7 +61,7 @@
     expiry <- gsub("-", "", expiry)
     tmp_symbols <- NULL            
     for (symbol in symbols) {
-        tmp_instr <- try(get(symbol, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(symbol, pos = .instrument),silent=TRUE)
         if (is.instrument(tmp_instr) ) {
             if ((!is.null(tmp_instr$expires) && any(gsub("-", "", tmp_instr$expires) == expiry)) ||
                 (!is.null(tmp_instr$expiry) && any(gsub("-", "", tmp_instr$expiry) == expiry)) ) {
@@ -78,7 +78,7 @@
     if (missing(x)) {
         x <- ls_by_expiry(expiry)
     } else x <- ls_by_expiry(expiry,pattern=x)
-    rm(list=x,pos=FinancialInstrument:::.instrument)
+    rm(list=x,pos=.instrument)
 }
 #rm_by_expiry(ls_options(),'20130119')
 

Modified: pkg/FinancialInstrument/R/ls_expiries.R
===================================================================
--- pkg/FinancialInstrument/R/ls_expiries.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/ls_expiries.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -56,7 +56,7 @@
     dates <- NULL   
     underlyings <- NULL
     for (symbol in symbols) { 
-        tmp_instr <- try(get(symbol,pos=FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(symbol,pos=.instrument),silent=TRUE)
         if (!is.null(tmp_instr$underlying_id) && any(tmp_instr$underlying_id==underlying_id)) { #the underlying_id of this instr mathces one of the one's we're interested in.
         underlying <- tmp_instr$underlying_id            
             if (is.null(tmp_instr$expires)) { #get value for expiry; may be in 'expires' or 'expiry' slot

Modified: pkg/FinancialInstrument/R/ls_instruments.R
===================================================================
--- pkg/FinancialInstrument/R/ls_instruments.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/ls_instruments.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -118,12 +118,12 @@
         match <- TRUE    
     }    
     if (!is.null(pattern) && match) {   #there's a pattern and match is TRUE
-        symbols <- ls(FinancialInstrument:::.instrument, all.names=TRUE)
+        symbols <- ls(.instrument, all.names=TRUE)
         symbols <- symbols[match(pattern,symbols)]
     } else if (!match && length(pattern) == 1) { # pattern is length(1) and don't match
-        symbols <- ls(FinancialInstrument:::.instrument, all.names=TRUE, pattern=pattern)
+        symbols <- ls(.instrument, all.names=TRUE, pattern=pattern)
     } else if (is.null(pattern)) {  #no pattern
-        symbols <- ls(FinancialInstrument:::.instrument, all.names=TRUE)
+        symbols <- ls(.instrument, all.names=TRUE)
     } # else pattern length > 1 & don't match
     
     is.iname <- is.instrument.name(symbols)
@@ -137,7 +137,7 @@
     symbols <- ls_instruments(pattern,match)
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'stock') && inherits(tmp_instr, 'instrument')) {
             tmp_symbols <- c(tmp_symbols,instr)
         }    
@@ -151,7 +151,7 @@
     symbols <- ls_instruments(pattern,match)    
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'option') && inherits(tmp_instr, 'instrument')) {
             if (!inherits(tmp_instr, 'option_series') || include.series)
                 tmp_symbols <- c(tmp_symbols,instr)
@@ -166,7 +166,7 @@
     symbols <- ls_instruments(pattern,match)    
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'option_series') && inherits(tmp_instr, 'instrument')) {
             tmp_symbols <- c(tmp_symbols,instr)
         }    
@@ -180,7 +180,7 @@
     symbols <- ls_instruments(pattern,match)
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'future') && inherits(tmp_instr, 'instrument')) {
             if (!inherits(tmp_instr, 'future_series') || include.series)
                 tmp_symbols <- c(tmp_symbols,instr)
@@ -195,7 +195,7 @@
     symbols <- ls_instruments(pattern,match)
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'future_series') && inherits(tmp_instr, 'instrument')) {
             tmp_symbols <- c(tmp_symbols,instr)
         }    
@@ -209,7 +209,7 @@
     symbols <- ls_instruments(pattern=pattern, match=match)
     tmp_symbols <- NULL
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),
+        tmp_instr <- try(get(instr, pos = .instrument),
                          silent=TRUE)
         if (inherits(tmp_instr, 'currency') 
             && inherits(tmp_instr, 'instrument')) {
@@ -227,7 +227,7 @@
     symbols <- ls_instruments(pattern, match)
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),
+        tmp_instr <- try(get(instr, pos = .instrument),
                          silent=TRUE)
         if (!inherits(tmp_instr, 'currency') || 
                 (inherits(tmp_instr, 'exchange_rate') && includeFX) ) {
@@ -243,7 +243,7 @@
     symbols <- ls_currencies(pattern=pattern, match=match, includeFX=TRUE)
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),
+        tmp_instr <- try(get(instr, pos = .instrument),
                          silent=TRUE)
         if (inherits(tmp_instr, 'exchange_rate') 
             && inherits(tmp_instr, 'instrument')) {
@@ -263,7 +263,7 @@
     symbols <- ls_instruments(pattern,match)
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'bond') && inherits(tmp_instr, 'instrument')) {
             tmp_symbols <- c(tmp_symbols,instr)
         }    
@@ -277,7 +277,7 @@
     symbols <- ls_instruments(pattern,match)
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'fund') && inherits(tmp_instr, 'instrument')) {
             tmp_symbols <- c(tmp_symbols,instr)
         }    
@@ -291,7 +291,7 @@
     symbols <- ls_instruments(pattern,match)
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'spread') && inherits(tmp_instr, 'instrument')) {
             tmp_symbols <- c(tmp_symbols,instr)
         }    
@@ -305,7 +305,7 @@
     symbols <- ls_instruments(pattern,match)
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'guaranteed_spread') && inherits(tmp_instr, 'instrument')) {
             tmp_symbols <- c(tmp_symbols,instr)
         }    
@@ -319,7 +319,7 @@
     symbols <- ls_instruments(pattern,match)    
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'synthetic') && inherits(tmp_instr, 'instrument')) {
             tmp_symbols <- c(tmp_symbols,instr)
         }    
@@ -333,7 +333,7 @@
     symbols <- ls_instruments(pattern,match)    
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'ICS') && inherits(tmp_instr, 'instrument')) {
             tmp_symbols <- c(tmp_symbols,instr)
         }    
@@ -347,7 +347,7 @@
     symbols <- ls_instruments(pattern,match)
     tmp_symbols <- NULL            
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
         if (inherits(tmp_instr, 'ICS_root') && inherits(tmp_instr, 'instrument')) {
             tmp_symbols <- c(tmp_symbols,instr)
         }    
@@ -361,7 +361,7 @@
 #    symbols <- ls_instruments(pattern) #TODO: other functions should be updated to get symbols like this too   
 #    tmp_symbols <- NULL
 #    for (instr in symbols) {
-#        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+#        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
 #        if ( is.instrument(tmp_instr) && !is.null(tmp_instr$defined.by) )  {        
 #            dby <- unlist(strsplit( tmp_instr$defined.by,";"))    
 #            if (any(dby == "yahoo" )) 
@@ -376,7 +376,7 @@
 #    symbols <- ls_instruments(pattern)   
 #    tmp_symbols <- NULL
 #    for (instr in symbols) {
-#        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+#        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
 #        if ( is.instrument(tmp_instr) && !is.null(tmp_instr$defined.by) )  {        
 #            dby <- unlist(strsplit( tmp_instr$defined.by,";"))    
 #            if (any(dby == "IB" )) tmp_symbols <- c(tmp_symbols,instr)
@@ -390,7 +390,7 @@
 #	symbols <- ls_instruments(pattern)
 #	tmp_symbols <- NULL
 #	for (symbol in symbols) {
-#		tmp_instr <- try(get(symbol, pos=FinancialInstrument:::.instrument),silent=TRUE)
+#		tmp_instr <- try(get(symbol, pos=.instrument),silent=TRUE)
 #		if (is.instrument(tmp_instr) && !is.null(tmp_instr$defined.by) ) {
 #			dby <- unlist(strsplit( tmp_instr$defined.by,";"))
 #			if (any(dby == x)) tmp_symbols <- c(tmp_symbols,symbol)
@@ -407,7 +407,7 @@
     #but check for it in case someone made one    
     tmp_symbols <- NULL
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
          if (inherits(tmp_instr, 'derivative') || 
                  inherits(tmp_instr, 'option') ||
                  inherits(tmp_instr, 'future') ) {
@@ -425,7 +425,7 @@
     #but check for it in case someone made one    
     tmp_symbols <- NULL
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
          if (!inherits(tmp_instr, 'derivative') && 
                  !inherits(tmp_instr, 'option') &&
                  !inherits(tmp_instr, 'future') ) {
@@ -442,7 +442,7 @@
     symbols <- ls_options(pattern=pattern,match=match)
 	tmp_symbols <- NULL
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
 		if (is.instrument(tmp_instr) && inherits(tmp_instr, 'option')) {
 			if (!is.null(tmp_instr$callput)) {
 				right <- tmp_instr$callput
@@ -464,7 +464,7 @@
     symbols <- ls_options(pattern=pattern,match=match)
 	tmp_symbols <- NULL
     for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(instr, pos = .instrument),silent=TRUE)
 		if (is.instrument(tmp_instr) && inherits(tmp_instr, 'option')) {
 			if (!is.null(tmp_instr$callput)) {
 				right <- tmp_instr$callput
@@ -496,7 +496,7 @@
         } else stop('Use keep.currencies=FALSE to delete a currency')    
     }
 
-    rm(list=x,pos=FinancialInstrument:::.instrument)
+    rm(list=x,pos=.instrument)
 }
 
 #' @export
@@ -505,7 +505,7 @@
     if (missing(x)) {
         x <- ls_stocks()
     }
-    rm(list=x[x %in% ls_stocks()], pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_stocks()], pos=.instrument)
 }
 
 #' @export
@@ -514,7 +514,7 @@
     if (missing(x)) {
         x <- ls_options()
     }
-    rm(list=x[x %in% ls_options()], pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_options()], pos=.instrument)
 }
 
 #' @export
@@ -523,7 +523,7 @@
     if (missing(x)) {
         x <- ls_option_series()
     }
-    rm(list=x[x %in% ls_option_series()], pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_option_series()], pos=.instrument)
 }
 
 #' @export
@@ -532,7 +532,7 @@
     if (missing(x)) {
         x <- ls_futures()
     }
-    rm(list=x[x %in% ls_futures()], pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_futures()], pos=.instrument)
 }
 
 #' @export
@@ -541,7 +541,7 @@
     if (missing(x)) {
         x <- ls_future_series()
     }
-    rm(list=x[x %in% ls_future_series()], pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_future_series()], pos=.instrument)
 }
 
 #' @export
@@ -550,7 +550,7 @@
     if (missing(x)) {
         x <- ls_currencies()
     }
-    rm(list=x[x %in% ls_currencies()], pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_currencies()], pos=.instrument)
 }   
 
 #' @export
@@ -559,7 +559,7 @@
     if (missing(x)) {
         x <- ls_exchange_rates()
     }
-    rm(list=x[x %in% ls_exchange_rates()], pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_exchange_rates()], pos=.instrument)
 }
 
 #' @export
@@ -572,7 +572,7 @@
     if (missing(x)) {
         x <- ls_bonds()
     }
-    rm(list=x[x %in% ls_bonds()], pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_bonds()], pos=.instrument)
 }
 
 #' @export
@@ -581,7 +581,7 @@
     if (missing(x)) {
         x <- ls_funds()
     }
-    rm(list=x[x %in% ls_funds()], pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_funds()], pos=.instrument)
 }
 
 #' @export
@@ -590,7 +590,7 @@
     if (missing(x)) {
         x <- ls_spreads()
     }
-    rm(list=x[x %in% ls_spreads()], pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_spreads()], pos=.instrument)
 }
 
 #' @export
@@ -599,7 +599,7 @@
     if (missing(x)) {
         x <- ls_synthetics()
     }
-    rm(list=x[x %in% ls_synthetics()],pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_synthetics()],pos=.instrument)
 }
 
 
@@ -609,7 +609,7 @@
     if (missing(x)) {
         x <- ls_derivatives()
     }
-    rm(list=x[x %in% ls_derivatives()],pos=FinancialInstrument:::.instrument)
+    rm(list=x[x %in% ls_derivatives()],pos=.instrument)
 }
 
 #' @export
@@ -624,7 +624,7 @@
                 x <- x[-match(ls_currencies(),x)] #then take them out of to-be-removed
         } else stop('Use keep.currencies=FALSE to delete a currency')    
     }
-    rm(list=x[x %in% ls_non_derivatives()],pos=FinancialInstrument:::.instrument) 
+    rm(list=x[x %in% ls_non_derivatives()],pos=.instrument) 
 }
 
 

Modified: pkg/FinancialInstrument/R/ls_instruments_by.R
===================================================================
--- pkg/FinancialInstrument/R/ls_instruments_by.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/ls_instruments_by.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -57,7 +57,7 @@
     if (missing(value)) value <- NULL
     tmp_symbols <- NULL 
     for (symbol in symbols) {
-        tmp_instr <- try(get(symbol, pos = FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(symbol, pos = .instrument),silent=TRUE)
         #TODO: clean this up
         if (is.instrument(tmp_instr)) {
             if (

Modified: pkg/FinancialInstrument/R/ls_strikes.R
===================================================================
--- pkg/FinancialInstrument/R/ls_strikes.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/ls_strikes.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -36,7 +36,7 @@
     symbols <- ls_option_series(pattern, match=FALSE)
     tmp_symbols <- NULL
     for (symbol in symbols) {
-        tmp_instr <- try(get(symbol,pos=FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(symbol,pos=.instrument),silent=TRUE)
         #if (is.instrument(tmp_instr))  
         if (!is.null(tmp_instr$strike)) 
             tmp_symbols <- c(tmp_symbols,tmp_instr$strike)

Modified: pkg/FinancialInstrument/R/ls_underlyings.R
===================================================================
--- pkg/FinancialInstrument/R/ls_underlyings.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/ls_underlyings.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -38,7 +38,7 @@
     symbols <- ls_derivatives(pattern, match)
     tmp_symbols <- NULL
     for (symbol in symbols) {
-        tmp_instr <- try(get(symbol,pos=FinancialInstrument:::.instrument),silent=TRUE)
+        tmp_instr <- try(get(symbol,pos=.instrument),silent=TRUE)
         #if (is.instrument(tmp_instr))  
         if (!is.null(tmp_instr$underlying_id)) 
             tmp_symbols <- c(tmp_symbols,tmp_instr$underlying_id)

Modified: pkg/FinancialInstrument/R/saveInstruments.R
===================================================================
--- pkg/FinancialInstrument/R/saveInstruments.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/saveInstruments.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -63,7 +63,6 @@
 saveInstruments <- function(file_name="MyInstruments", dir="", compress="gzip") {
 	if (!is.null(dir) && !dir == "" && substr(dir,nchar(dir),nchar(dir)) != "/")
 		dir <- paste(dir,"/",sep="")
-    .instrument <- FinancialInstrument:::.instrument
     ssfn <- strsplit(file_name, "\\.")[[1]]
 	extension <- if (tolower(tail(ssfn, 1)) %in% c('rda', 'rdata', 'r', 'txt')) {
         file_name <- paste(ssfn[1:(length(ssfn)-1)], collapse=".")
@@ -76,7 +75,7 @@
             "require(FinancialInstrument)\n\n", file=file.name)
         for (s in ls_instruments()) {
             sink(file.name, append=TRUE)
-            cat('assign("', s, '", pos=FinancialInstrument:::.instrument, ', 
+            cat('assign("', s, '", pos=.instrument, ', 
                 'value=\n', sep="", append=TRUE)
             dput(getInstrument(s))
             cat(")\n\n", append=TRUE)
@@ -99,7 +98,7 @@
         }
         for (i in seq_along(ilist)) {
             assign(ilist[[i]][["primary_id"]], ilist[[i]],
-                   pos=FinancialInstrument:::.instrument)
+                   pos=.instrument)
         }
         return(invisible(NULL))
 	}
@@ -122,7 +121,7 @@
         il <- ls(tmpenv$.instrument, all.names=TRUE)
         for (i in il) {
              assign(i, tmpenv$.instrument[[i]], 
-                    pos=FinancialInstrument:::.instrument, inherits=FALSE)
+                    pos=.instrument, inherits=FALSE)
         }
     }
 }

Modified: pkg/FinancialInstrument/R/synthetic.R
===================================================================
--- pkg/FinancialInstrument/R/synthetic.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/synthetic.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -376,7 +376,7 @@
     })
 
     # Check to make sure members exist in instrument envir.  Warn if not.
-    defined <- sapply(members, exists, where=FinancialInstrument:::.instrument)
+    defined <- sapply(members, exists, where=.instrument)
     if (any(defined == FALSE)) warning("No instrument definition found for ", 
                                        paste(members[!defined], collapse=" "))
     memberratio <- suff.2

Modified: pkg/FinancialInstrument/R/update_instruments.yahoo.R
===================================================================
--- pkg/FinancialInstrument/R/update_instruments.yahoo.R	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/R/update_instruments.yahoo.R	2013-08-25 00:26:39 UTC (rev 1498)
@@ -118,7 +118,7 @@
 			instr$defined.by=db 
 		    instr$updated=Sys.time()
             
-		    assign(Symbols[i], instr, pos=FinancialInstrument:::.instrument)
+		    assign(Symbols[i], instr, pos=.instrument)
 		}
     }        
     Symbols
@@ -379,7 +379,7 @@
     if (isTRUE(assign_i)) {
         invisible(lapply(out, function(x) {
             if (!is.null(x)) assign(x$primary_id, x, 
-                                    pos=FinancialInstrument:::.instrument)
+                                    pos=.instrument)
         }))
     } else return(out)
     do.call(c, lapply(out, "[[", "primary_id"))

Modified: pkg/FinancialInstrument/man/instrument.Rd
===================================================================
--- pkg/FinancialInstrument/man/instrument.Rd	2013-08-14 14:40:48 UTC (rev 1497)
+++ pkg/FinancialInstrument/man/instrument.Rd	2013-08-25 00:26:39 UTC (rev 1498)
@@ -134,7 +134,7 @@
 
   As of version 0.10.0, the .instrument environment is
   located at the top level of the package. i.e.
-  \code{FinancialInstrument:::.instrument}.
+  \code{.instrument}.
 
   \code{future} and \code{option} are used to define the
   contract specs of a series of instruments.  The



More information about the Blotter-commits mailing list