[Blotter-commits] r698 - in pkg/FinancialInstrument: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jul 24 20:10:21 CEST 2011
Author: braverock
Date: 2011-07-24 20:10:20 +0200 (Sun, 24 Jul 2011)
New Revision: 698
Added:
pkg/FinancialInstrument/man/series_instrument.Rd
Removed:
pkg/FinancialInstrument/man/future_series.Rd
Modified:
pkg/FinancialInstrument/DESCRIPTION
pkg/FinancialInstrument/NAMESPACE
pkg/FinancialInstrument/R/build_symbols.R
pkg/FinancialInstrument/R/instrument.R
pkg/FinancialInstrument/R/redenominate.R
pkg/FinancialInstrument/R/synthetic.R
pkg/FinancialInstrument/man/buildHierarchy.Rd
pkg/FinancialInstrument/man/buildRatio.Rd
pkg/FinancialInstrument/man/buildSpread.Rd
pkg/FinancialInstrument/man/build_series_symbols.Rd
pkg/FinancialInstrument/man/build_spread_symbols.Rd
pkg/FinancialInstrument/man/exchange_rate.Rd
pkg/FinancialInstrument/man/fn_SpreadBuilder.Rd
pkg/FinancialInstrument/man/formatSpreadPrice.Rd
pkg/FinancialInstrument/man/getInstrument.Rd
pkg/FinancialInstrument/man/getSymbols.FI.Rd
pkg/FinancialInstrument/man/get_rate.Rd
pkg/FinancialInstrument/man/instrument.Rd
pkg/FinancialInstrument/man/instrument.table.Rd
pkg/FinancialInstrument/man/is.currency.Rd
pkg/FinancialInstrument/man/is.instrument.Rd
pkg/FinancialInstrument/man/load.instruments.Rd
pkg/FinancialInstrument/man/option_series.yahoo.Rd
pkg/FinancialInstrument/man/redenominate.Rd
pkg/FinancialInstrument/man/setSymbolLookup.FI.Rd
pkg/FinancialInstrument/man/synthetic.instrument.Rd
pkg/FinancialInstrument/man/synthetic.ratio.Rd
pkg/FinancialInstrument/man/to_daily.Rd
pkg/FinancialInstrument/man/volep.Rd
Log:
- update roxygen comments to use roxygen2, including rdname for functions that share a single .Rd file
- generate new Rd files
Modified: pkg/FinancialInstrument/DESCRIPTION
===================================================================
--- pkg/FinancialInstrument/DESCRIPTION 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/DESCRIPTION 2011-07-24 18:10:20 UTC (rev 698)
@@ -1,15 +1,34 @@
+Copyright: (c) 2004 - 2011
Package: FinancialInstrument
-Type: Package
-Title: Financial Instrument Model Infrastructure for R
-Version: 0.4.1
-Date: $Date$
-Author: Peter Carl, Dirk Eddelbuettel, Jeffrey Ryan, Joshua Ulrich, Brian G. Peterson, Garrett See
Maintainer: Peter Carl <peter at braverock.com>
-Description: Infrastructure for defining instruments meta-data and relationships. Provides support for multi-asset class and multi-currency
- portfolios. Still in heavy development.
-URL: https://r-forge.r-project.org/projects/blotter/
License: GPL
+Title: Financial Instrument Model Infrastructure for R
+Type: Package
LazyLoad: yes
-Depends: R (>= 2.12.0), xts, zoo
-Suggests: quantmod
-Copyright: (c) 2004 - 2011
+Author: Peter Carl, Dirk Eddelbuettel, Jeffrey Ryan, Joshua
+ Ulrich, Brian G. Peterson, Garrett See
+Description: Infrastructure for defining instruments
+ meta-data and relationships. Provides support for
+ multi-asset class and multi-currency portfolios. Still
+ in heavy development.
+Version: 0.4.2
+URL: https://r-forge.r-project.org/projects/blotter/
+Date: $Date$
+Depends:
+ R (>= 2.12.0),
+ xts,
+ zoo
+Suggests:
+ quantmod
+Collate:
+ 'buildHierarchy.R'
+ 'buildSpread.R'
+ 'build_symbols.R'
+ 'instrument.R'
+ 'instrument.table.R'
+ 'load.instruments.R'
+ 'redenominate.R'
+ 'splice.R'
+ 'splooth.R'
+ 'synthetic.R'
+ 'volep.R'
Modified: pkg/FinancialInstrument/NAMESPACE
===================================================================
--- pkg/FinancialInstrument/NAMESPACE 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/NAMESPACE 2011-07-24 18:10:20 UTC (rev 698)
@@ -1,35 +1,35 @@
+export(bond)
+export(bond_series)
export(buildHierarchy)
+export(buildRatio)
+export(build_series_symbols)
export(buildSpread)
+export(build_spread_symbols)
+export(butterfly)
+export(currency)
+export(exchange_rate)
export(fn_SpreadBuilder)
export(formatSpreadPrice)
-export(build_series_symbols)
-export(build_spread_symbols)
-export(is.instrument)
-export(instrument)
-export(stock)
export(fund)
export(future)
export(future_series)
+export(getInstrument)
+export(getSymbols.FI)
+export(guaranteed_spread)
+export(instrument)
+export(instrument.table)
+export(is.currency)
+export(is.instrument)
+export(load.instruments)
export(option)
export(option_series)
export(option_series.yahoo)
-export(currency)
-export(is.currency)
-export(exchange_rate)
-export(bond)
-export(bond_series)
-export(getInstrument)
-export(instrument.table)
-export(load.instruments)
+export(redenominate)
export(setSymbolLookup.FI)
-export(getSymbols.FI)
-export(.to_daily)
-export(buildRatio)
-export(redenominate)
+export(spread)
+export(stock)
export(synthetic)
+export(synthetic.instrument)
export(synthetic.ratio)
-export(synthetic.instrument)
-export(spread)
-export(butterfly)
-export(guaranteed_spread)
+export(.to_daily)
export(volep)
Modified: pkg/FinancialInstrument/R/build_symbols.R
===================================================================
--- pkg/FinancialInstrument/R/build_symbols.R 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/R/build_symbols.R 2011-07-24 18:10:20 UTC (rev 698)
@@ -9,11 +9,11 @@
#' \code{"Mar,Jun,Sep,Dec"} for quarters as three-letter month abbreviations, etc.
#' The correct values will vary based on your data source.
#'
-#' @param yearlist vector of year suffixes to be applied, see Details
+#' TODO add more flexibility in input formats for \code{roots}
+#' #' @param yearlist vector of year suffixes to be applied, see Details
#' @param roots data.frame containing at least columns \code{primary_id} and \code{month_cycle}, see Details
#' @author Brian G. Peterson
#' @seealso \code{\link{load.instruments}}
-#' @TODO add more flexibility in input formats for \code{roots}
#' @export
build_series_symbols <- function(roots, yearlist=c(0,1)) {
symbols<-''
Modified: pkg/FinancialInstrument/R/instrument.R
===================================================================
--- pkg/FinancialInstrument/R/instrument.R 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/R/instrument.R 2011-07-24 18:10:20 UTC (rev 698)
@@ -136,16 +136,19 @@
}
#' @export
+#' @rdname instrument
stock <- function(primary_id , currency=NULL , multiplier=1 , tick_size=.01, identifiers = NULL, ...){
stock_temp= instrument(primary_id=primary_id , currency=currency , multiplier=multiplier , tick_size=tick_size, identifiers = identifiers, ..., type="stock", assign_i=TRUE)
}
#' @export
+#' @rdname instrument
fund <- function(primary_id , currency=NULL , multiplier=1 , tick_size=.01, identifiers = NULL, ...){
fund_temp = instrument(primary_id = primary_id, currency = currency, multiplier = multiplier, tick_size = tick_size, identifiers = identifiers, ..., type="fund", assign_i=TRUE)
}
#' @export
+#' @rdname instrument
future <- function(primary_id , currency , multiplier , tick_size=NULL, identifiers = NULL, ..., underlying_id=NULL){
if(is.null(underlying_id)) {
warning("underlying_id should only be NULL for cash-settled futures")
@@ -174,11 +177,8 @@
#' option_series
#' future_series
#' bond_series
-#' @usage
-#' future_series(primary_id , suffix_id, first_traded=NULL, expires=NULL, identifiers = NULL, ...)
-#' option_series(primary_id , suffix_id, first_traded=NULL, expires=NULL, callput=c("call","put"), identifiers = NULL, ...)
-#' bond_series(primary_id , suffix_id, ..., first_traded=NULL, maturity=NULL, identifiers = NULL, payment_schedule=NULL)
#' @export
+#' @rdname series_instrument
future_series <- function(primary_id , suffix_id, first_traded=NULL, expires=NULL, identifiers = NULL, ...){
contract<-try(getInstrument(primary_id))
if(!inherits(contract,"future")) stop("futures contract spec must be defined first")
@@ -216,6 +216,7 @@
}
#' @export
+#' @rdname instrument
option <- function(primary_id , currency , multiplier , tick_size=NULL, identifiers = NULL, ..., underlying_id=NULL){
option_temp = instrument(primary_id=primary_id , currency=currency , multiplier=multiplier , tick_size=tick_size, identifiers = identifiers, ..., type="option")
@@ -229,6 +230,7 @@
}
#' @export
+#' @rdname series_instrument
option_series <- function(primary_id , suffix_id, first_traded=NULL, expires=NULL, callput=c("call","put"), identifiers = NULL, ...){
contract<-try(getInstrument(primary_id))
if(!inherits(contract,"option")) stop("options contract spec must be defined first")
@@ -344,6 +346,7 @@
}
#' @export
+#' @rdname instrument
currency <- function(primary_id , currency=NULL , multiplier=1 , identifiers = NULL, ...){
## now structure and return
currency_temp <- list(primary_id = primary_id,
@@ -399,11 +402,13 @@
#TODO auction dates, coupons, etc for govmt. bonds
#' @export
+#' @rdname instrument
bond <- function(primary_id , currency , multiplier, tick_size=NULL , identifiers = NULL, ...){
bond_temp = instrument(primary_id=primary_id , currency=currency , multiplier=multiplier , tick_size=tick_size, identifiers = identifiers, ..., type="bond", assign_i=TRUE )
}
#' @export
+#' @rdname series_instrument
bond_series <- function(primary_id , suffix_id, ..., first_traded=NULL, maturity=NULL, identifiers = NULL, payment_schedule=NULL){
contract<-try(getInstrument(primary_id))
if(!inherits(contract,"bond")) stop("bonds contract spec must be defined first")
@@ -441,6 +446,10 @@
}
#' primary accessor function for getting objects of type 'instrument'
+#'
+#' This function will search the \code{.instrument} environment, using first the
+#' \code{primary_id} and then any \code{identifiers} to locate the instrument.
+#'
#' @param x string identifier of instrument to retrieve
#' @param Dates date range to retrieve 'as of', may not currently be implemented
#' @param silent if TRUE, will not warn on failure, default FALSE
Modified: pkg/FinancialInstrument/R/redenominate.R
===================================================================
--- pkg/FinancialInstrument/R/redenominate.R 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/R/redenominate.R 2011-07-24 18:10:20 UTC (rev 698)
@@ -19,6 +19,7 @@
#' head(USDEUR)
#' head(EURUSD)
#' }
+#' @rdname get_rate
.get_rate <- function(ccy1, ccy2, env=.GlobalEnv) {
rsym <- NA
invert <- FALSE
@@ -75,6 +76,7 @@
#' @author Garrett See
#' @seealso quantmod:::to.daily, quantmod:::to.period
#' @export
+#' @rdname to_daily
.to_daily <- function(x, EOD_time="15:00:00") {
x <- do.call(rbind, lapply(split(x[paste("T00:00:00/T",EOD_time,sep="")],'days'),'last'))
xts(x, order.by=as.Date(paste(index(x))))
Modified: pkg/FinancialInstrument/R/synthetic.R
===================================================================
--- pkg/FinancialInstrument/R/synthetic.R 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/R/synthetic.R 2011-07-24 18:10:20 UTC (rev 698)
@@ -12,6 +12,7 @@
###############################################################################
#' @export
+#' @rdname synthetic.instrument
synthetic <- function(primary_id , currency , multiplier=1, identifiers = NULL, ..., members=NULL, type=c("synthetic", "instrument"))
{
synthetic_temp = instrument(primary_id=primary_id , currency=currency , multiplier=multiplier , identifiers = identifiers, ...=..., type=type, members=members, assign_i=TRUE )
@@ -163,6 +164,7 @@
#' @export
+#' @rdname synthetic.instrument
spread <- function (primary_id, currency = NULL, members, memberratio, tick_size=NULL,
..., multiplier = 1, identifiers = NULL)
{
@@ -174,6 +176,7 @@
#' @export
+#' @rdname synthetic.instrument
butterfly <- function(primary_id, currency=NULL, members,tick_size=NULL, identifiers=NULL, ...)
{
##TODO: butterfly can refer to expirations (futures) or strikes (options)
@@ -192,6 +195,7 @@
#' @export
+#' @rdname synthetic.instrument
guaranteed_spread <- calendar_spread <- function (primary_id, currency=NULL, root_id=NULL, suffix_id=NULL, members = NULL, memberratio = c(1,-1), ...,
multiplier = NULL, identifiers = NULL, tick_size=NULL)
{
@@ -230,5 +234,4 @@
memberratio = memberratio, multiplier = multiplier, identifiers = NULL,
tick_size=tick_size, ... = ..., type = c("guaranteed_spread", "spread",
"synthetic.instrument", "synthetic", "instrument"))
-}
-
+}
\ No newline at end of file
Modified: pkg/FinancialInstrument/man/buildHierarchy.Rd
===================================================================
--- pkg/FinancialInstrument/man/buildHierarchy.Rd 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/man/buildHierarchy.Rd 2011-07-24 18:10:20 UTC (rev 698)
@@ -1,13 +1,32 @@
\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.
+\title{Construct a hierarchy of instruments useful for aggregation}
+\usage{
+ buildHierarchy(primary_ids, levels, ...)
+}
+\arguments{
+ \item{primary_ids}{A list of assets to be included in the
+ hierarchy list}
-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}}
+ \item{levels}{A list of instrument attributes in top-down
+ order}
+
+ \item{...}{any other passthru parameters}
+}
+\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
+}
+\description{
+ All 'currency' instruments must be defined before
+ instruments of other types may be defined.
+}
+\details{
+ In \dots you may pass any other arbitrary instrument
+ fields that will be used to create 'custom' fields.
+}
+\author{
+ Peter Carl
+}
+
Modified: pkg/FinancialInstrument/man/buildRatio.Rd
===================================================================
--- pkg/FinancialInstrument/man/buildRatio.Rd 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/man/buildRatio.Rd 2011-07-24 18:10:20 UTC (rev 698)
@@ -1,39 +1,60 @@
\name{buildRatio}
\alias{buildRatio}
-\title{contruct price ratios of 2 instruments...}
-\usage{buildRatio(x, env=.GlobalEnv, silent=FALSE)}
-\description{contruct price ratios of 2 instruments}
-\details{Calculates time series of ratio of 2 instruments using available data.
-Returned object will be ratios calculated using Bids, Asks, and Mids, or Opens, Closes, and Adjusteds.
-\code{x} should be a vector of 2 instrument names. An attempt will be made to \code{get} the data
-for both instruments. If there are no xts data stored under either of the names, it will try to
-return prebuilt data with a call to \code{\link{.get_rate}}.
+\title{contruct price ratios of 2 instruments}
+\usage{
+ buildRatio(x, env = .GlobalEnv, silent = FALSE)
+}
+\arguments{
+ \item{x}{vector of instrument names. e.g. c("SPY","DIA")}
-If the data are not of the same frequency, or are not of the same type (OHLC, BBO, etc.)
-An attempt will be made to make them compatible. Preference is given to the first leg.
+ \item{env}{environment where xts data is stored}
-If the data in \code{x[1]} is daily or slower and the data in \code{x[2]} is intraday
-(e.g. if you give it daily OHLC and intraday Bid Ask Mid, it will use all of
-the OHLC columns of \code{x[1]} and only the the End of Day Mid price of the BAM object.
+ \item{silent}{silence warnings?}
+}
+\value{
+ An xts object with columns of Bid, Ask, Mid OR Open,
+ Close, Adjusted OR Price
+}
+\description{
+ Calculates time series of ratio of 2 instruments using
+ available data. Returned object will be ratios calculated
+ using Bids, Asks, and Mids, or Opens, Closes, and
+ Adjusteds. \code{x} should be a vector of 2 instrument
+ names. An attempt will be made to \code{get} the data for
+ both instruments. If there are no xts data stored under
+ either of the names, it will try to return prebuilt data
+ with a call to \code{\link{.get_rate}}.
+}
+\details{
+ If the data are not of the same frequency, or are not of
+ the same type (OHLC, BBO, etc.) An attempt will be made
+ to make them compatible. Preference is given to the
+ first leg.
-If the data in \code{x[1]} is intraday, and the data in \code{x[2]} is daily or slower,
-for each day, the previous closing value of \code{x[2]} will be filled forward with \code{na.locf}}
-\value{An xts object with columns of
-Bid, Ask, Mid
-OR
-Open, Close, Adjusted
-OR
-Price}
-\author{Garrett See}
-\seealso{\code{\link{redenominate}}
-\code{\link{buildSpread}}
-\code{\link{fn_SpreadBuilder}}}
-\arguments{\item{x}{vector of instrument names. e.g. c("SPY","DIA")}
-\item{env}{environment where xts data is stored}
-\item{silent}{silence warnings?}}
-\examples{\dontrun{
+ If the data in \code{x[1]} is daily or slower and the
+ data in \code{x[2]} is intraday (e.g. if you give it
+ daily OHLC and intraday Bid Ask Mid, it will use all of
+ the OHLC columns of \code{x[1]} and only the the End of
+ Day Mid price of the BAM object.
+
+ If the data in \code{x[1]} is intraday, and the data in
+ \code{x[2]} is daily or slower, for each day, the
+ previous closing value of \code{x[2]} will be filled
+ forward with \code{na.locf}
+}
+\examples{
+\dontrun{
syms <- c("SPY","DIA")
getSymbols(syms)
rat <- buildRatio(syms)
summary(rat)
-}}
+}
+}
+\author{
+ Garrett See
+}
+\seealso{
+ \code{\link{redenominate}} \code{\link{buildSpread}}
+ \code{\link{fn_SpreadBuilder}}
+}
+
Modified: pkg/FinancialInstrument/man/buildSpread.Rd
===================================================================
--- pkg/FinancialInstrument/man/buildSpread.Rd 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/man/buildSpread.Rd 2011-07-24 18:10:20 UTC (rev 698)
@@ -1,37 +1,68 @@
\name{buildSpread}
\alias{buildSpread}
-\title{construct a price/level series for pre-defined multi-leg spread instrument...}
-\usage{buildSpread(spread_id, Dates, onelot=TRUE, prefer, auto.assign=TRUE,
- env=.GlobalEnv)}
-\description{construct a price/level series for pre-defined multi-leg spread instrument}
-\details{build price series for spreads, butterflies, or other synthetic instruments,
-using metadata of a previously defined synthetic instrument.
+\title{construct a price/level series for pre-defined multi-leg spread instrument}
+\usage{
+ buildSpread(spread_id, Dates = NULL, onelot = TRUE,
+ prefer = NULL, auto.assign = TRUE, env = .GlobalEnv)
+}
+\arguments{
+ \item{spread_id}{The name of the instrument that contains
+ members and memberratio}
-The spread and all legs must be defined instruments.
+ \item{Dates}{date range to subset on, will be used for
+ \code{\link[quantmod]{getSymbols}} if the instrument is
+ not available via \code{\link{get}}}
-This function can build multileg spreads such as calendars, butterflies, condors, etc.
-However, the returned series will be univariate. It does not build Bid Ask Mid data
-like fn_SpreadBuilder does.}
-\value{If \code{auto.assign} is FALSE, a univariate xts object
-otherwise, the xts object will be assigned to \code{spread_id} and the \code{spread_id} will be returned.}
-\seealso{\code{\link{fn_SpreadBuilder}}
-\code{\link{spread}} for instructions on defining the spread}
-\author{Brian Peterson, Garrett See}
-\note{this could also be used to build a basket or a strip by using only positive values in memberratio}
-\arguments{\item{spread_id}{The name of the instrument that contains members and memberratio}
-\item{Dates}{date range to subset on, will be used for \code{\link[quantmod]{getSymbols}}
-if the instrument is not available via \code{\link{get}}}
-\item{onelot}{Should the series be divided by the first leg's ratio?}
-\item{prefer}{price column to use to build structure.}
-\item{auto.assign}{assign the spread? If FALSE, the xts object will be returned}
-\item{env}{environment in which to assign spread.}}
-\examples{\dontrun{
+ \item{onelot}{Should the series be divided by the first
+ leg's ratio?}
+
+ \item{prefer}{price column to use to build structure.}
+
+ \item{auto.assign}{assign the spread? If FALSE, the xts
+ object will be returned}
+
+ \item{env}{environment in which to assign spread.}
+}
+\value{
+ If \code{auto.assign} is FALSE, a univariate xts object
+ otherwise, the xts object will be assigned to
+ \code{spread_id} and the \code{spread_id} will be
+ returned.
+}
+\description{
+ build price series for spreads, butterflies, or other
+ synthetic instruments, using metadata of a previously
+ defined synthetic instrument.
+}
+\details{
+ The spread and all legs must be defined instruments.
+
+ This function can build multileg spreads such as
+ calendars, butterflies, condors, etc. However, the
+ returned series will be univariate. It does not build Bid
+ Ask Mid data like fn_SpreadBuilder does.
+}
+\note{
+ this could also be used to build a basket or a strip by
+ using only positive values in memberratio
+}
+\examples{
+\dontrun{
currency("USD")
stock("SPY","USD",1)
stock("DIA","USD",1)
-getSymbols(c("SPY","DIA"))
+getSymbols(c("SPY","DIA"))
spread("SPYDIA", "USD", c("SPY","DIA"),c(1,-1)) #define it.
buildSpread('SPYDIA') #build it.
head(SPYDIA)
-}}
+}
+}
+\author{
+ Brian Peterson, Garrett See
+}
+\seealso{
+ \code{\link{fn_SpreadBuilder}} \code{\link{spread}} for
+ instructions on defining the spread
+}
+
Modified: pkg/FinancialInstrument/man/build_series_symbols.Rd
===================================================================
--- pkg/FinancialInstrument/man/build_series_symbols.Rd 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/man/build_series_symbols.Rd 2011-07-24 18:10:20 UTC (rev 698)
@@ -1,18 +1,37 @@
\name{build_series_symbols}
\alias{build_series_symbols}
-\title{construct a series of symbols based on root symbol and suffix letters...}
-\usage{build_series_symbols(roots, yearlist=c(0, 1))}
-\description{construct a series of symbols based on root symbol and suffix letters}
-\details{The columns needed by this version of the function are \code{primary_id}
-and \code{month_cycle}. \code{primary_id} should match the \code{primary_id}
-of the instrument describing the root contract.
-\code{month_cycle} should contain a comma delimited string describing the
-month sequence to use, e.g. \code{"F,G,H,J,K,M,N,Q,U,V,X,Z"} for all months
-using the standard futures letters, or \code{"H,M,U,Z"} for quarters, or
-\code{"Mar,Jun,Sep,Dec"} for quarters as three-letter month abbreviations, etc.
-The correct values will vary based on your data source.}
-\author{Brian G. Peterson}
-\seealso{\code{\link{load.instruments}}}
-\section{TODO}{add more flexibility in input formats for \code{roots}}
-\arguments{\item{yearlist}{vector of year suffixes to be applied, see Details}
-\item{roots}{data.frame containing at least columns \code{primary_id} and \code{month_cycle}, see Details}}
+\title{construct a series of symbols based on root symbol and suffix letters}
+\usage{
+ build_series_symbols(roots, yearlist = c(0, 1))
+}
+\arguments{
+ \item{yearlist}{vector of year suffixes to be applied,
+ see Details}
+
+ \item{roots}{data.frame containing at least columns
+ \code{primary_id} and \code{month_cycle}, see Details}
+}
+\description{
+ The columns needed by this version of the function are
+ \code{primary_id} and \code{month_cycle}.
+ \code{primary_id} should match the \code{primary_id} of
+ the instrument describing the root contract.
+ \code{month_cycle} should contain a comma delimited
+ string describing the month sequence to use, e.g.
+ \code{"F,G,H,J,K,M,N,Q,U,V,X,Z"} for all months using the
+ standard futures letters, or \code{"H,M,U,Z"} for
+ quarters, or \code{"Mar,Jun,Sep,Dec"} for quarters as
+ three-letter month abbreviations, etc. The correct values
+ will vary based on your data source.
+}
+\details{
+ TODO add more flexibility in input formats for
+ \code{roots} #'
+}
+\author{
+ Brian G. Peterson
+}
+\seealso{
+ \code{\link{load.instruments}}
+}
+
Modified: pkg/FinancialInstrument/man/build_spread_symbols.Rd
===================================================================
--- pkg/FinancialInstrument/man/build_spread_symbols.Rd 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/man/build_spread_symbols.Rd 2011-07-24 18:10:20 UTC (rev 698)
@@ -1,34 +1,62 @@
\name{build_spread_symbols}
\alias{build_spread_symbols}
-\title{build symbols for exchange guaranteed (calendar) spreads...}
-\usage{build_spread_symbols(data, file, outputfile, start_date=Sys.Date())}
-\description{build symbols for exchange guaranteed (calendar) spreads}
-\details{The columns needed by this version of the function are \code{primary_id},
-\code{month_cycle}, and code \code{contracts_ahead}.
+\title{build symbols for exchange guaranteed (calendar) spreads}
+\usage{
+ build_spread_symbols(data = NULL, file = NULL, outputfile
+ = NULL, start_date = Sys.Date())
+}
+\arguments{
+ \item{data}{data.frame containing at least columns
+ \code{primary_id}, \code{month_cycle}, amd
+ \code{contracts_ahead}, see Details}
-\code{primary_id} should match the \code{primary_id}
-of the instrument describing the root contract.
+ \item{file}{if not NULL, will read input data from the
+ file named by this argument, in the same folrmat as
+ \code{data}, above}
-\code{month_cycle} should contain a comma delimited string describing the
-month sequence to use, e.g. \code{"F,G,H,J,K,M,N,Q,U,V,X,Z"} for all months
-using the standard futures letters, or \code{"H,M,U,Z"} for quarters, or
-\code{"Mar,Jun,Sep,Dec"} for quarters as three-letter month abbreviations, etc.
-The correct values will vary based on your data source.
+ \item{outputfile}{if not NULL, will write out put to this
+ file as a CSV}
-\code{contracts_ahead} should contain a comma-delimited string describing
-the cycle on which the guaranteed calendar spreads are to be consructed,
-e.g. '1' for one-month spreads, '1,3' for one and three month spreads,
-'1,6,12' for 1, 6, and 12 month spreads, etc.
+ \item{start_date}{date to start building from, of type
+ \code{Date} or an ISO-8601 date string, defaults to
+ \code{\link{Sys.Date}}}
+}
+\description{
+ The columns needed by this version of the function are
+ \code{primary_id}, \code{month_cycle}, and code
+ \code{contracts_ahead}.
+}
+\details{
+ \code{primary_id} should match the \code{primary_id} of
+ the instrument describing the root contract.
-\code{active_months} is a numeric field indicating how many months including
-the month of the \code{start_date} the contract is available to trade.
-This number will be used as the upper limit for symbol generation.
+ \code{month_cycle} should contain a comma delimited
+ string describing the month sequence to use, e.g.
+ \code{"F,G,H,J,K,M,N,Q,U,V,X,Z"} for all months using the
+ standard futures letters, or \code{"H,M,U,Z"} for
+ quarters, or \code{"Mar,Jun,Sep,Dec"} for quarters as
+ three-letter month abbreviations, etc. The correct values
+ will vary based on your data source.
-One of \code{data} or \code{file} must be populated for input data.}
-\author{Ilya Kipnis <Ilya.Kipnis<at>gmail.com>}
-\seealso{\code{\link{load.instruments}}
-\code{\link{build_series_symbols}}}
-\arguments{\item{data}{data.frame containing at least columns \code{primary_id}, \code{month_cycle}, amd \code{contracts_ahead}, see Details}
-\item{file}{if not NULL, will read input data from the file named by this argument, in the same folrmat as \code{data}, above}
-\item{outputfile}{if not NULL, will write out put to this file as a CSV}
-\item{start_date}{date to start building from, of type \code{Date} or an ISO-8601 date string, defaults to \code{\link{Sys.Date}}}}
+ \code{contracts_ahead} should contain a comma-delimited
+ string describing the cycle on which the guaranteed
+ calendar spreads are to be consructed, e.g. '1' for
+ one-month spreads, '1,3' for one and three month spreads,
+ '1,6,12' for 1, 6, and 12 month spreads, etc.
+
+ \code{active_months} is a numeric field indicating how
+ many months including the month of the \code{start_date}
+ the contract is available to trade. This number will be
+ used as the upper limit for symbol generation.
+
+ One of \code{data} or \code{file} must be populated for
+ input data.
+}
+\author{
+ Ilya Kipnis <Ilya.Kipnis<at>gmail.com>
+}
+\seealso{
+ \code{\link{load.instruments}}
+ \code{\link{build_series_symbols}}
+}
+
Modified: pkg/FinancialInstrument/man/exchange_rate.Rd
===================================================================
--- pkg/FinancialInstrument/man/exchange_rate.Rd 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/man/exchange_rate.Rd 2011-07-24 18:10:20 UTC (rev 698)
@@ -1,21 +1,44 @@
\name{exchange_rate}
\alias{exchange_rate}
-\title{constructor for spot exchange rate instruments...}
-\usage{exchange_rate(primary_id, currency, counter_currency, identifiers, ...)}
-\description{constructor for spot exchange rate instruments}
-\details{Currency symbols (like any symbol) may be any combination of alphanumeric characters,
-but the FX market has a convention that says that the first currency in a
-currency pair is the 'target' and the second currency in the symbol pair
-is the currency the rate ticks in. So 'EURUSD' can be read as 'USD per 1 EUR'.
+\title{constructor for spot exchange rate instruments}
+\usage{
+ exchange_rate(primary_id, currency, counter_currency,
+ identifiers = NULL, ...)
+}
+\arguments{
+ \item{primary_id}{string identifier, usually expressed as
+ a currency pair 'USDYEN' or 'EURGBP'}
-In \code{FinancialInstrument} the \code{currency} of the instrument should
-be the currency that the spot rate ticks in, so it will typically be the second
-currency listed in the symbol.
+ \item{currency}{string identifying the currency the
+ exchange rate ticks in}
-Thanks to Garrett See for helping sort out the inconsistencies in different naming and calculating conventions.}
-\references{http://financial-dictionary.thefreedictionary.com/Base+Currency}
-\arguments{\item{primary_id}{string identifier, usually expressed as a currency pair 'USDYEN' or 'EURGBP'}
-\item{currency}{string identifying the currency the exchange rate ticks in}
-\item{counter_currency}{string identifying the currency which the rate uses as the base 'per 1' multiplier}
-\item{identifiers}{named list of any other identifiers that should also be stored for this instrument}
-\item{...}{any other passthru parameters}}
+ \item{counter_currency}{string identifying the currency
+ which the rate uses as the base 'per 1' multiplier}
+
+ \item{identifiers}{named list of any other identifiers
+ that should also be stored for this instrument}
+
+ \item{...}{any other passthru parameters}
+}
+\description{
+ Currency symbols (like any symbol) may be any combination
+ of alphanumeric characters, but the FX market has a
+ convention that says that the first currency in a
+ currency pair is the 'target' and the second currency in
+ the symbol pair is the currency the rate ticks in. So
+ 'EURUSD' can be read as 'USD per 1 EUR'.
+}
+\details{
+ In \code{FinancialInstrument} the \code{currency} of the
+ instrument should be the currency that the spot rate
+ ticks in, so it will typically be the second currency
+ listed in the symbol.
+
+ Thanks to Garrett See for helping sort out the
+ inconsistencies in different naming and calculating
+ conventions.
+}
+\references{
+ http://financial-dictionary.thefreedictionary.com/Base+Currency
+}
+
Modified: pkg/FinancialInstrument/man/fn_SpreadBuilder.Rd
===================================================================
--- pkg/FinancialInstrument/man/fn_SpreadBuilder.Rd 2011-07-23 00:06:37 UTC (rev 697)
+++ pkg/FinancialInstrument/man/fn_SpreadBuilder.Rd 2011-07-24 18:10:20 UTC (rev 698)
@@ -1,43 +1,71 @@
\name{fn_SpreadBuilder}
\alias{fn_SpreadBuilder}
\title{Calculate prices of a spread from 2 instruments.}
-\usage{fn_SpreadBuilder(prod1, prod2, ratio=1, currency="USD", from, to,
- session_times, unique_method=c("make.index.unique", "duplicated",
- "least.liq", "price.change"), silent=FALSE, ...)}
-\description{Calculate prices of a spread from 2 instruments.}
-\details{It will try to get data for \code{prod1} and \code{prod2} from .GlobalEnv.
-If it cannot find the data, it will get it with a call to getSymbols.
+\usage{
+ fn_SpreadBuilder(prod1, prod2, ratio = 1, currency =
+ "USD", from = NULL, to = NULL, session_times = NULL,
+ unique_method = c("make.index.unique", "duplicated",
+ "least.liq", "price.change"), silent = FALSE, ...)
+}
+\arguments{
+ \item{prod1}{chr name of instrument that will be the 1st
+ leg of a 2 leg spread}
-Prices are multiplied by multipliers and exchange rates to get notional values in the currency specified.
-The second leg's notional values are multiplied by the ratio.
-Then the difference is taken between the notionals of leg1 and the new values for leg2.
+ \item{prod2}{chr name of instrument that will be the 2nd
+ leg of a 2 leg spread}
-\sQuote{make.index.unique} uses the xts function \code{make.index.unique}
-\sQuote{least.liq} subsets the spread time series, by using the timestamps of the leg that has the fewest rows.
-\sQuote{duplicated} removes any duplicate indexes.
-\sQuote{price.change} only return rows where there was a price change in the Bid, Mid or Ask Price of the spread.}
-\value{an xts object with
-Bid, Ask, Mid columns,
-or Open, Close, Adjusted columns,
-or Open, Close columns.
-or Price column.}
-\author{Lance Levenson, Brian Peterson, Garrett See}
-\note{requires quantmod}
-\seealso{\code{\link{buildSpread}}
-\code{\link{synthetic.instrument}}
-\code{\link{formatSpreadPrice}}
-\code{\link{buildRatio}}}
-\arguments{\item{prod1}{chr name of instrument that will be the 1st leg of a 2 leg spread}
-\item{prod2}{chr name of instrument that will be the 2nd leg of a 2 leg spread}
-\item{ratio}{hedge ratio. Can be a single number, or a vector of same length as data.}
-\item{currency}{chr name of currency denomination of the spread}
-\item{from}{from Date to pass through to getSymbols if needed.}
-\item{to}{to Date to pass through to getSymbols if needed.}
-\item{session_times}{ISO-8601 time subset for the session time, in GMT, in the format 'T08:00/T14:59'}
-\item{unique_method}{method for making the time series unique}
-\item{silent}{silence warnings? (FALSE by default)}
-\item{\dots}{any other passthrough parameters}}
-\examples{\dontrun{
+ \item{ratio}{hedge ratio. Can be a single number, or a
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/blotter -r 698
More information about the Blotter-commits
mailing list