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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 21 16:36:36 CET 2010


Author: braverock
Date: 2010-12-21 16:36:36 +0100 (Tue, 21 Dec 2010)
New Revision: 505

Added:
   pkg/FinancialInstrument/man/buildHierarchy.Rd
   pkg/FinancialInstrument/man/fund.Rd
Modified:
   pkg/FinancialInstrument/R/buildHierarchy.R
   pkg/FinancialInstrument/R/buildSpread.R
   pkg/FinancialInstrument/R/load.instruments.R
   pkg/FinancialInstrument/man/future_series.Rd
   pkg/FinancialInstrument/man/getInstrument.Rd
   pkg/FinancialInstrument/man/getSymbols.FI.Rd
   pkg/FinancialInstrument/man/instrument.Rd
   pkg/FinancialInstrument/man/load.instruments.Rd
   pkg/FinancialInstrument/man/setSymbolLookup.FI.Rd
   pkg/FinancialInstrument/man/synthetic.ratio.Rd
Log:
- update roxygen documentation

Modified: pkg/FinancialInstrument/R/buildHierarchy.R
===================================================================
--- pkg/FinancialInstrument/R/buildHierarchy.R	2010-12-21 11:36:23 UTC (rev 504)
+++ pkg/FinancialInstrument/R/buildHierarchy.R	2010-12-21 15:36:36 UTC (rev 505)
@@ -9,7 +9,7 @@
 #' @param ... any other passthru parameters
 #' @author Peter Carl
 #' @return Constructs a data.frame that contains the list of assets in the first column and the category or factor for grouping at each level in the following columns
-#' @seealso
+# @seealso
 # TODO add a link to PortfolioAnalytics attribution functions, when they exist
 #' @export
 buildHierarchy <- function(primary_ids, levels, ...) {

Modified: pkg/FinancialInstrument/R/buildSpread.R
===================================================================
--- pkg/FinancialInstrument/R/buildSpread.R	2010-12-21 11:36:23 UTC (rev 504)
+++ pkg/FinancialInstrument/R/buildSpread.R	2010-12-21 15:36:36 UTC (rev 505)
@@ -52,6 +52,7 @@
             }
             instr_mult<-instr$multiplier
             instr_ratio<-spread_instr$memberlist$memberratio[i]
+            
             instr_prices<-Cl(get(as.character(spread_instr$memberlist$members[i])))
         }        
         instr_norm<-instr_prices*instr_mult*instr_ratio*exchange_rate

Modified: pkg/FinancialInstrument/R/load.instruments.R
===================================================================
--- pkg/FinancialInstrument/R/load.instruments.R	2010-12-21 11:36:23 UTC (rev 504)
+++ pkg/FinancialInstrument/R/load.instruments.R	2010-12-21 15:36:36 UTC (rev 505)
@@ -37,7 +37,11 @@
 #' @param metadata optional, data.frame containing metadata, default NULL, see Details
 #' @param id_col numeric column containing id if primary_id isn't defined, default 1
 #' @param default_type character string to use as instrument type fallback, see Details
-#' @seealso instrument
+#' @seealso 
+#' \code{\link{instrument}} 
+#' \code{\link{setSymbolLookup.FI}} 
+#' \code{\link[quantmod]{getSymbols}} 
+#' \code{\link{getSymbols.FI}}
 #' @export
 load.instruments <- function (file=NULL, ..., metadata=NULL, id_col=1, default_type='stock') {
 
@@ -135,7 +139,8 @@
 #' @param split_method string specifying the method files are split, currently \sQuote{days} or \sQuote{common}, see Details
 #' @param ... any other passthru parameters
 #' @param extension file extension, default "rda"
-#' @seealso 
+#' @seealso \code{\link{load.instruments}} 
+#' \code{\link{getSymbols.FI}}
 #' \code{\link{load.instruments}}
 #' \code{\link[quantmod]{setSymbolLookup}}
 #' @export
@@ -186,6 +191,9 @@
 #' 
 #' The symbol lookup table will most likely be loaded by \code{\link{setSymbolLookup.FI}}
 #' 
+#' If date_format is NULL (the Default), we will assume an ISO date as changed by \code{\link{make.names}}, 
+#' for example, 2010-12-01 would be assumed to be a file containing 2010.12.01
+#'  
 #' @param Symbols a character vector specifying the names of each symbol to be loaded
 #' @param from Retrieve data no earlier than this date. Default '2010-01-01'.
 #' @param to Retrieve data through this date. Default Sys.Date().
@@ -194,11 +202,13 @@
 #' @param dir if not specified in getSymbolLookup, directory string to use.  default ""
 #' @param return.class only "xts" is currently supported
 #' @param extension file extension, default "rda"
-#' @param date_format format as per the \code{\link{strptime}}, default '\%Y.\%m.\%d'
+#' @param date_format format as per the \code{\link{strptime}}, see Details
 #' @seealso 
+#' \code{\link{instrument}}
 #' \code{\link{setSymbolLookup.FI}}
 #' \code{\link{load.instruments}}
 #' \code{\link[quantmod]{getSymbols}}
+#' 
 #' @export
 getSymbols.FI <- function(Symbols,
                             from='2010-01-01',
@@ -208,9 +218,10 @@
                             dir="",
                             return.class="xts",
                             extension="rda",
-                            date_format='%Y.%m.%d'
+                            date_format=NULL
                          ) 
 {
+    if(is.null(date_format)) date_format<-"%Y.%m.%d"
     importDefaults("getSymbols.FI")
     this.env <- environment()
     for(var in names(list(...))) {

Added: pkg/FinancialInstrument/man/buildHierarchy.Rd
===================================================================
--- pkg/FinancialInstrument/man/buildHierarchy.Rd	                        (rev 0)
+++ pkg/FinancialInstrument/man/buildHierarchy.Rd	2010-12-21 15:36:36 UTC (rev 505)
@@ -0,0 +1,13 @@
+\name{buildHierarchy}
+\alias{buildHierarchy}
+\title{Construct a hierarchy of instruments useful for aggregation...}
+\usage{buildHierarchy(primary_ids, levels, ...)}
+\description{Construct a hierarchy of instruments useful for aggregation}
+\details{All 'currency' instruments must be defined before instruments of other types may be defined.
+
+In \dots you may pass any other arbitrary instrument fields that will be used to create 'custom' fields.}
+\author{Peter Carl}
+\value{Constructs a data.frame that contains the list of assets in the first column and the category or factor for grouping at each level in the following columns}
+\arguments{\item{primary_ids}{A list of assets to be included in the hierarchy list}
+\item{levels}{A list of instrument attributes in top-down order}
+\item{...}{any other passthru parameters}}

Added: pkg/FinancialInstrument/man/fund.Rd
===================================================================
--- pkg/FinancialInstrument/man/fund.Rd	                        (rev 0)
+++ pkg/FinancialInstrument/man/fund.Rd	2010-12-21 15:36:36 UTC (rev 505)
@@ -0,0 +1,4 @@
+\name{fund}
+\alias{fund}
+\title{fund}
+\usage{fund(primary_id, currency, multiplier=1, tick_size=0.01, identifiers, ...)}

Modified: pkg/FinancialInstrument/man/future_series.Rd
===================================================================
--- pkg/FinancialInstrument/man/future_series.Rd	2010-12-21 11:36:23 UTC (rev 504)
+++ pkg/FinancialInstrument/man/future_series.Rd	2010-12-21 15:36:36 UTC (rev 505)
@@ -1,16 +1,17 @@
 \name{future_series}
 \title{constructors for series contracts on instruments such as options and futures...}
-\usage{future_series(primary_id, suffix_id, first_traded, expires,
-    identifiers, ...)}
+\usage{future_series(primary_id, suffix_id, first_traded, expires, identifiers, ...)}
 \description{constructors for series contracts on instruments such as options and futures}
 \details{In custom parameters for these series contracts, we have often found it
 useful to store attributes such as local roll-on and roll-off dates
 (rolling not on the \code{first_listed} or \code{expires}}
 \alias{option_series}
 \alias{future_series}
+\alias{bond_series}
 \arguments{\item{primary_id}{string describing the unique ID for the instrument}
 \item{suffix_id}{string suffix that should be associated with the series, usually something like 'Z9' or 'Mar10' denoting expiration and year}
 \item{first_traded}{string coercible to Date for first trading day}
 \item{expires}{string coercible to Date for expiration date}
+\item{maturity}{string coercible to Date for maturity date of bond series}
 \item{identifiers}{named list of any other identifiers that should also be stored for this instrument}
 \item{...}{any other passthru parameters}}

Modified: pkg/FinancialInstrument/man/getInstrument.Rd
===================================================================
--- pkg/FinancialInstrument/man/getInstrument.Rd	2010-12-21 11:36:23 UTC (rev 504)
+++ pkg/FinancialInstrument/man/getInstrument.Rd	2010-12-21 15:36:36 UTC (rev 505)
@@ -1,7 +1,7 @@
 \name{getInstrument}
 \alias{getInstrument}
 \title{primary accessor function for getting objects of type 'instrument'...}
-\usage{getInstrument(x, Dates)}
+\usage{getInstrument(x, Dates, silent=FALSE)}
 \description{primary accessor function for getting objects of type 'instrument'}
 \arguments{\item{x}{string identifier of instrument to retrieve}
 \item{Dates}{date range to retrieve 'as of', may not currently be implemented}}

Modified: pkg/FinancialInstrument/man/getSymbols.FI.Rd
===================================================================
--- pkg/FinancialInstrument/man/getSymbols.FI.Rd	2010-12-21 11:36:23 UTC (rev 504)
+++ pkg/FinancialInstrument/man/getSymbols.FI.Rd	2010-12-21 15:36:36 UTC (rev 505)
@@ -1,16 +1,18 @@
 \name{getSymbols.FI}
 \alias{getSymbols.FI}
 \title{getSymbols method for loading data from split files...}
-\usage{getSymbols.FI(Symbols, from="2010-01-01", to=Sys.Date(), ..., env,
-    dir="", return.class="xts", extension="rda",
-    date_format="\%Y.\%m.\%d")}
+\usage{getSymbols.FI(Symbols, from="2010-01-01", to=Sys.Date(), ..., env, dir="", return.class="xts", extension="rda", date_format)}
 \description{getSymbols method for loading data from split files}
 \details{This function should probably get folded back into getSymbols.rda in quantmod.
 
 Meant to be called internally by \code{\link[quantmod]{getSymbols}} .
 
-The symbol lookup table will most likely be loaded by \code{\link{setSymbolLookup.FI}}}
-\seealso{\code{\link{setSymbolLookup.FI}}
+The symbol lookup table will most likely be loaded by \code{\link{setSymbolLookup.FI}}
+
+If date_format is NULL (the Default), we will assume an ISO date as changed by \code{\link{make.names}}, 
+for example, 2010-12-01 would be assumed to be a file containing 2010.12.01}
+\seealso{\code{\link{instrument}}
+\code{\link{setSymbolLookup.FI}}
 \code{\link{load.instruments}}
 \code{\link[quantmod]{getSymbols}}}
 \arguments{\item{Symbols}{a character vector specifying the names of each symbol to be loaded}
@@ -21,4 +23,4 @@
 \item{dir}{if not specified in getSymbolLookup, directory string to use.  default ""}
 \item{return.class}{only "xts" is currently supported}
 \item{extension}{file extension, default "rda"}
-\item{date_format}{format as per the \code{\link{strptime}}, default '\%Y.\%m.\%d'}}
+\item{date_format}{format as per the \code{\link{strptime}}, see Details}}

Modified: pkg/FinancialInstrument/man/instrument.Rd
===================================================================
--- pkg/FinancialInstrument/man/instrument.Rd	2010-12-21 11:36:23 UTC (rev 504)
+++ pkg/FinancialInstrument/man/instrument.Rd	2010-12-21 15:36:36 UTC (rev 505)
@@ -1,7 +1,6 @@
 \name{instrument}
 \title{instrument class constructors...}
-\usage{instrument(primary_id, ..., currency, multiplier, tick_size,
-    identifiers, type, assign_i=FALSE)}
+\usage{instrument(primary_id, ..., currency, multiplier, tick_size, identifiers, type, assign_i=FALSE)}
 \description{instrument class constructors}
 \details{All 'currency' instruments must be defined before instruments of other types may be defined.
 
@@ -15,7 +14,7 @@
 This is robust enough if you take some care, though a more robust patch would be welcomed.
 
 The \code{primary_id} will be coerced within reason to a valid \R variable name by 
-using \code{\link{make.names}}. We also remove any leading digit (a simple workaround to account for issues with the Reuters API).  
+using \code{\link{make.names}}. We also remove any leading '1' digit (a simple workaround to account for issues with the Reuters API).  
 Please use some care to choose your primary identifiers so that R won't complain.
 If you have better regular expression code, we'd be happy to include it.   
 
@@ -36,6 +35,7 @@
 \alias{option}
 \alias{currency}
 \alias{instrument}
+\alias{fund}
 \seealso{\code{\link{exchange_rate}}
 \code{\link{option_series}}
 \code{\link{future_series}}

Modified: pkg/FinancialInstrument/man/load.instruments.Rd
===================================================================
--- pkg/FinancialInstrument/man/load.instruments.Rd	2010-12-21 11:36:23 UTC (rev 504)
+++ pkg/FinancialInstrument/man/load.instruments.Rd	2010-12-21 15:36:36 UTC (rev 505)
@@ -20,7 +20,10 @@
 Any other columns necessary to define the specified instrument type will also be required to avoid fatal Errors.  
 
 Additional columns will be processed, either as additional identifiers for recognized identifier names, or as custom fields.  See \code{\link{instrument}} for more information on custom fields.}
-\seealso{instrument}
+\seealso{\code{\link{instrument}} 
+\code{\link{setSymbolLookup.FI}} 
+\code{\link[quantmod]{getSymbols}} 
+\code{\link{getSymbols.FI}}}
 \arguments{\item{file}{string identifying file to load, default NULL, see Details}
 \item{...}{any other passthru parameters}
 \item{metadata}{optional, data.frame containing metadata, default NULL, see Details}

Modified: pkg/FinancialInstrument/man/setSymbolLookup.FI.Rd
===================================================================
--- pkg/FinancialInstrument/man/setSymbolLookup.FI.Rd	2010-12-21 11:36:23 UTC (rev 504)
+++ pkg/FinancialInstrument/man/setSymbolLookup.FI.Rd	2010-12-21 15:36:36 UTC (rev 505)
@@ -1,8 +1,7 @@
 \name{setSymbolLookup.FI}
 \alias{setSymbolLookup.FI}
 \title{set quantmod-style SymbolLookup for instruments...}
-\usage{setSymbolLookup.FI(base_dir, ..., split_method=c("days", "common"),
-    storage_method="rda", use_identifier="primary_id", extension="rda")}
+\usage{setSymbolLookup.FI(base_dir, ..., split_method=c("days", "common"), storage_method="rda", use_identifier="primary_id", extension="rda")}
 \description{set quantmod-style SymbolLookup for instruments}
 \details{This function exists to tell \code{\link[quantmod]{getSymbols}} where to look for your repository of market data.
 
@@ -15,7 +14,9 @@
 The \code{split_method} currently allows either \sQuote{days} or \sQuote{common}, and expects the 
 file or files to be in sub-directories named for the symbol.  In high frequency data, it is standard practice to split
 the data by days, which is why that option is the default.}
-\seealso{\code{\link{load.instruments}}
+\seealso{\code{\link{load.instruments}} 
+\code{\link{getSymbols.FI}}
+\code{\link{load.instruments}}
 \code{\link[quantmod]{setSymbolLookup}}}
 \arguments{\item{base_dir}{string specifying the base directory where data is stored, see Details}
 \item{storage_method}{currently only \sQuote{rda}, but we will eventually support \sQuote{indexing} at least, and maybe others}

Modified: pkg/FinancialInstrument/man/synthetic.ratio.Rd
===================================================================
--- pkg/FinancialInstrument/man/synthetic.ratio.Rd	2010-12-21 11:36:23 UTC (rev 504)
+++ pkg/FinancialInstrument/man/synthetic.ratio.Rd	2010-12-21 15:36:36 UTC (rev 505)
@@ -1,8 +1,7 @@
 \name{synthetic.ratio}
 \title{constructors for synthetic instruments...}
-\usage{synthetic.ratio(primary_id, currency, multiplier=1, identifiers, ...,
-    type=c("synthetic.ratio", "synthetic", "instrument"), members,
-    memberratio)}
+\usage{synthetic.ratio(primary_id, currency, members, memberratio, ..., multiplier=1, identifiers, type=c("synthetic.ratio", "synthetic",
+    "instrument"))}
 \description{constructors for synthetic instruments}
 \details{Simple derivatives like \code{\link{option}} or \code{\link{future}} contracts typically have one underlying instrument.  
 While properties like strike and expiration vary for these derivative contracts or series, the underlying is well understood.



More information about the Blotter-commits mailing list