[Blotter-commits] r522 - in pkg/quantstrat: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jan 2 15:46:44 CET 2011
Author: braverock
Date: 2011-01-02 15:46:43 +0100 (Sun, 02 Jan 2011)
New Revision: 522
Modified:
pkg/quantstrat/DESCRIPTION
pkg/quantstrat/R/rules.R
pkg/quantstrat/R/traderules.R
pkg/quantstrat/man/add.indicator.Rd
pkg/quantstrat/man/add.parameter.Rd
pkg/quantstrat/man/add.rule.Rd
pkg/quantstrat/man/add.signal.Rd
pkg/quantstrat/man/addOrder.Rd
pkg/quantstrat/man/addPosLimit.Rd
pkg/quantstrat/man/applyRules.Rd
pkg/quantstrat/man/applyStrategy.Rd
pkg/quantstrat/man/getOrders.Rd
pkg/quantstrat/man/initOrders.Rd
pkg/quantstrat/man/osMaxPos.Rd
pkg/quantstrat/man/ruleOrderProc.Rd
pkg/quantstrat/man/ruleSignal.Rd
pkg/quantstrat/man/sigComparison.Rd
pkg/quantstrat/man/sigCrossover.Rd
pkg/quantstrat/man/sigThreshold.Rd
pkg/quantstrat/man/updateOrders.Rd
Log:
- updates to docs to pass R CMD check
- bump version
Modified: pkg/quantstrat/DESCRIPTION
===================================================================
--- pkg/quantstrat/DESCRIPTION 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/DESCRIPTION 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,17 +1,13 @@
Package: quantstrat
Type: Package
Title: Quantitative Strategy Model Framework
-Version: 0.3.1
+Version: 0.3.2
Date: $Date$
-Author: Peter Carl, Dirk Eddelbuettel, Brian G. Peterson, Jeffrey A.
- Ryan, Joshua Ulrich
-Depends: xts(>= 0.7-6.1),TTR(>= 0.2),blotter(>= 0.7.2),
- FinancialInstrument, quantmod (>= 0.3-14)
+Author: Peter Carl, Dirk Eddelbuettel, Brian G. Peterson, Jeffrey A. Ryan, Joshua Ulrich
+Depends: xts(>= 0.7-6.1),TTR(>= 0.2),blotter(>= 0.7.2), FinancialInstrument, quantmod (>= 0.3-14)
Suggests: PerformanceAnalytics,PortfolioAnalytics
Maintainer: Jeffrey A. Ryan <jeff.a.ryan at gmail.com>
-Description: Specify, build, and back-test quantitative financial
- trading and portfolio strategies
+Description: Specify, build, and back-test quantitative financial trading and portfolio strategies
LazyLoad: yes
License: GPL-3
-Collate: 'indicators.R' 'match.names.R' 'orders.R' 'parameters.R'
- 'rules.R' 'signals.R' 'strategy.R' 'traderules.R'
+Collate: 'indicators.R' 'match.names.R' 'orders.R' 'parameters.R' 'rules.R' 'signals.R' 'strategy.R' 'traderules.R'
Modified: pkg/quantstrat/R/rules.R
===================================================================
--- pkg/quantstrat/R/rules.R 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/R/rules.R 2011-01-02 14:46:43 UTC (rev 522)
@@ -8,7 +8,7 @@
#' and will be applied after indicators and signals, and before path-dependent rules are processed.
#'
#' All rules have a \code{type}. These may be any of:
-#' \itemize{
+#' \describe{
#' \item{risk}{ rules that check and react to risk of positions, may stop all other rule execution temporarily or permanently}
#' \item{order}{ rules for order processing of any open orders at time t, always path-dependent}
#' \item{rebalance}{ rules executed specifically in a portfolio context, unnecessary in univariate strategies}
Modified: pkg/quantstrat/R/traderules.R
===================================================================
--- pkg/quantstrat/R/traderules.R 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/R/traderules.R 2011-01-02 14:46:43 UTC (rev 522)
@@ -34,9 +34,10 @@
#' @param ruletype one of "risk","order","rebalance","exit","entry", see \code{\link{add.rule}}
#' @param TxnFees numeric fees (usually negative) or function name for calculating TxnFees (processing happens later, not in this function)
#' @param prefer price method for getPrice
+#' @param sethold boolean, puts entry Rule processing on hold, default FALSE
#' @seealso \code{\link{osNoOp}} , \code{\link{add.rule}}
#' @export
-ruleSignal <- function(data=mktdata, timestamp, sigcol, sigval, orderqty=0, ordertype, orderside=NULL, threshold=NULL, tmult=FALSE, replace=TRUE, delay=0.0001, osFUN='osNoOp', pricemethod=c('market','opside','maker'), portfolio, symbol, ..., ruletype, TxnFees=0, prefer=NULL)
+ruleSignal <- function(data=mktdata, timestamp, sigcol, sigval, orderqty=0, ordertype, orderside=NULL, threshold=NULL, tmult=FALSE, replace=TRUE, delay=0.0001, osFUN='osNoOp', pricemethod=c('market','opside','maker'), portfolio, symbol, ..., ruletype, TxnFees=0, prefer=NULL, sethold=FALSE)
{
if(!is.function(osFUN)) osFUN<-match.fun(osFUN)
#print(paste(symbol,timestamp))
@@ -126,6 +127,7 @@
addOrder(portfolio=portfolio, symbol=symbol, timestamp=timestamp, qty=orderqty, price=as.numeric(orderprice), ordertype=ordertype, side=orderside, threshold=threshold, status="open", replace=replace , delay=delay, tmult=tmult, ...=..., TxnFees=TxnFees)
}
}
+ if(sethold) hold <<- TRUE
}
#TODO ruleORSignal
Modified: pkg/quantstrat/man/add.indicator.Rd
===================================================================
--- pkg/quantstrat/man/add.indicator.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/add.indicator.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{add.indicator}
\alias{add.indicator}
\title{add an indicator to a strategy...}
-\usage{add.indicator(strategy, name, arguments, parameters, label, ...,
- enabled=TRUE, indexnum, store=FALSE)}
+\usage{add.indicator(strategy, name, arguments, parameters, label, ..., enabled=TRUE, indexnum, store=FALSE)}
\description{add an indicator to a strategy}
\details{Indicators are typically standard technical or statistical analysis outputs,
such as moving averages, bands, or pricing models.
Modified: pkg/quantstrat/man/add.parameter.Rd
===================================================================
--- pkg/quantstrat/man/add.parameter.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/add.parameter.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{add.parameter}
\alias{add.parameter}
\title{add parameters to strategy objects: ALPHA CODE USE WITH CARE...}
-\usage{add.parameter(strategy, type=c("indicator", "signal"), add.to.name,
- method=c("lookup", "lookup.range", "calc"), arguments, label, ...,
+\usage{add.parameter(strategy, type=c("indicator", "signal"), add.to.name, method=c("lookup", "lookup.range", "calc"), arguments, label, ...,
store=FALSE)}
\description{add parameters to strategy objects: ALPHA CODE USE WITH CARE}
\arguments{\item{strategy}{}
Modified: pkg/quantstrat/man/add.rule.Rd
===================================================================
--- pkg/quantstrat/man/add.rule.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/add.rule.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{add.rule}
\alias{add.rule}
\title{add a rule to a strategy...}
-\usage{add.rule(strategy, name, arguments, parameters, label, type=c(NULL,
- "risk", "order", "rebalance", "exit", "enter"), ..., enabled=TRUE,
+\usage{add.rule(strategy, name, arguments, parameters, label, type=c(NULL, "risk", "order", "rebalance", "exit", "enter"), ..., enabled=TRUE,
indexnum, path.dep=TRUE, timespan, store=FALSE)}
\description{add a rule to a strategy}
\details{Rules will be processed in a very particular manner, so it bears going over.
@@ -13,7 +12,7 @@
and will be applied after indicators and signals, and before path-dependent rules are processed.
All rules have a \code{type}. These may be any of:
-\itemize{
+\describe{
\item{risk}{ rules that check and react to risk of positions, may stop all other rule execution temporarily or permanently}
\item{order}{ rules for order processing of any open orders at time t, always path-dependent}
\item{rebalance}{ rules executed specifically in a portfolio context, unnecessary in univariate strategies}
Modified: pkg/quantstrat/man/add.signal.Rd
===================================================================
--- pkg/quantstrat/man/add.signal.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/add.signal.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{add.signal}
\alias{add.signal}
\title{add a signal to a strategy...}
-\usage{add.signal(strategy, name, arguments, parameters, label, ...,
- enabled=TRUE, indexnum, store=FALSE)}
+\usage{add.signal(strategy, name, arguments, parameters, label, ..., enabled=TRUE, indexnum, store=FALSE)}
\description{add a signal to a strategy}
\arguments{\item{strategy}{an object of type 'strategy' to add the signal to}
\item{name}{name of the signal, must correspond to an R function}
Modified: pkg/quantstrat/man/addOrder.Rd
===================================================================
--- pkg/quantstrat/man/addOrder.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/addOrder.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,9 +1,8 @@
\name{addOrder}
\alias{addOrder}
\title{add an order to the order book...}
-\usage{addOrder(portfolio, symbol, timestamp, qty, price, ordertype, side,
- threshold, status="open", statustimestamp="", delay=1e-05,
- tmult=FALSE, replace=TRUE, return=FALSE, ..., TxnFees=0)}
+\usage{addOrder(portfolio, symbol, timestamp, qty, price, ordertype, side, threshold, status="open", statustimestamp="", delay=1e-05, tmult=FALSE,
+ replace=TRUE, return=FALSE, ..., TxnFees=0)}
\description{add an order to the order book}
\details{It is important to understand that all the order functionality included in \code{quantstrat}
exists to more closely model a real trading environment both in backtesting and in production.
Modified: pkg/quantstrat/man/addPosLimit.Rd
===================================================================
--- pkg/quantstrat/man/addPosLimit.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/addPosLimit.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{addPosLimit}
\alias{addPosLimit}
\title{add position and level limits at timestamp...}
-\usage{addPosLimit(portfolio, symbol, timestamp, maxpos, longlevels=1,
- minpos=0, shortlevels=0)}
+\usage{addPosLimit(portfolio, symbol, timestamp, maxpos, longlevels=1, minpos=0, shortlevels=0)}
\description{add position and level limits at timestamp}
\details{levels are a simplification of more complex (proprietary)
techniques sometimes used for order sizing.
Modified: pkg/quantstrat/man/applyRules.Rd
===================================================================
--- pkg/quantstrat/man/applyRules.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/applyRules.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{applyRules}
\alias{applyRules}
\title{apply the rules in the strategy to arbitrary market data...}
-\usage{applyRules(portfolio, symbol, strategy, mktdata, Dates, indicators,
- signals, parameters, ..., path.dep=TRUE)}
+\usage{applyRules(portfolio, symbol, strategy, mktdata, Dates, indicators, signals, parameters, ..., path.dep=TRUE)}
\description{apply the rules in the strategy to arbitrary market data}
\details{In typical usage, this function will be called via \code{\link{applyStrategy}}.
In this mode, this function will be called twice, once with \code{path.dep=FALSE}
@@ -19,7 +18,8 @@
\code{\link{applyStrategy}} will likely need to be replaced to connect to a live
market infrastructure.
-\section{Dimension Reduction for Performance}{
+
+} \section{Dimension Reduction for Performance}{ %roxygen requires that we stop the prior section before we add a new one
In evaluation of path-dependent rules, the simplest method,
and the one we used initially, is to check the rules on every observation
in the time series of market data.
@@ -61,8 +61,7 @@
It should be noted that this dimension reduction methodology does 'look ahead'
in the data. This 'look ahead' is only done \emph{after} the order has been
-entered in the normal path-dependent process, and so should not introduce biases.
-}}
+entered in the normal path-dependent process, and so should not introduce biases.}
\seealso{\code{\link{add.rule}} \code{\link{applyStrategy}}}
\arguments{\item{portfolio}{text name of the portfolio to associate the order book with}
\item{symbol}{identfier of the instrument to find orders for. The name of any associated price objects (xts prices, usually OHLC) should match these}
Modified: pkg/quantstrat/man/applyStrategy.Rd
===================================================================
--- pkg/quantstrat/man/applyStrategy.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/applyStrategy.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{applyStrategy}
\alias{applyStrategy}
\title{apply the strategy to arbitrary market data...}
-\usage{applyStrategy(strategy, portfolios, mktdata, parameters, ...,
- verbose=TRUE)}
+\usage{applyStrategy(strategy, portfolios, mktdata, parameters, ..., verbose=TRUE)}
\description{apply the strategy to arbitrary market data}
\details{if \code{mktdata} is NULL, the default, the mktdata variable will be populated
for each symbol via a call to get (getSymbols??, not yet)}
Modified: pkg/quantstrat/man/getOrders.Rd
===================================================================
--- pkg/quantstrat/man/getOrders.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/getOrders.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{getOrders}
\alias{getOrders}
\title{get orders by time span, status, type, and side...}
-\usage{getOrders(portfolio, symbol, status="open", timespan, ordertype, side,
- which.i=FALSE)}
+\usage{getOrders(portfolio, symbol, status="open", timespan, ordertype, side, which.i=FALSE)}
\description{get orders by time span, status, type, and side}
\details{This function exists so that other code can find open orders, potentially to update or cancel them.
Modified: pkg/quantstrat/man/initOrders.Rd
===================================================================
--- pkg/quantstrat/man/initOrders.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/initOrders.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,7 +1,7 @@
\name{initOrders}
\alias{initOrders}
\title{initialize order container...}
-\usage{initOrders(portfolio, symbols, initDate="1999-12-31")}
+\usage{initOrders(portfolio, symbols, initDate="1999-12-31", ...)}
\description{initialize order container}
\details{This function sets up the order container by portfolio.
@@ -9,4 +9,5 @@
to retrieve the symbols list from the portfolio in the trade blotter.}
\arguments{\item{portfolio}{text name of the portfolio to associate the order book with}
\item{symbols}{a list of identfiers of the instruments to be contained in the Portfolio. The name of any associated price objects (xts prices, usually OHLC) should match these}
-\item{initDate}{date (ISO8601) prior to the first close price given in mktdata, used to initialize the order book with a dummy order}}
+\item{initDate}{date (ISO8601) prior to the first close price given in mktdata, used to initialize the order book with a dummy order}
+\item{\dots}{any other passthrough parameters}}
Modified: pkg/quantstrat/man/osMaxPos.Rd
===================================================================
--- pkg/quantstrat/man/osMaxPos.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/osMaxPos.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{osMaxPos}
\alias{osMaxPos}
\title{order sizing function for position limits and level sizing...}
-\usage{osMaxPos(data, timestamp, orderqty, ordertype, orderside, portfolio,
- symbol, ruletype, ...)}
+\usage{osMaxPos(data, timestamp, orderqty, ordertype, orderside, portfolio, symbol, ruletype, ...)}
\description{order sizing function for position limits and level sizing}
\details{levels are a simplification of more complex (proprietary)
techniques sometimes used for order sizing.
Modified: pkg/quantstrat/man/ruleOrderProc.Rd
===================================================================
--- pkg/quantstrat/man/ruleOrderProc.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/ruleOrderProc.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{ruleOrderProc}
\alias{ruleOrderProc}
\title{process open orders at time t, generating transactions or new orders...}
-\usage{ruleOrderProc(portfolio, symbol, mktdata, timespan, ordertype, ...,
- slippageFUN)}
+\usage{ruleOrderProc(portfolio, symbol, mktdata, timespan, ordertype, ..., slippageFUN)}
\description{process open orders at time \emph{t}, generating transactions or new orders}
\details{The ruleOrderProc function is effectively the default fill simulator for quantstrat.
This function is meant to be sufficient for backtesting most strategies,
Modified: pkg/quantstrat/man/ruleSignal.Rd
===================================================================
--- pkg/quantstrat/man/ruleSignal.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/ruleSignal.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,10 +1,8 @@
\name{ruleSignal}
\alias{ruleSignal}
\title{default rule to generate a trade order on a signal...}
-\usage{ruleSignal(data=mktdata, timestamp, sigcol, sigval, orderqty=0,
- ordertype, orderside, threshold, tmult=FALSE, replace=TRUE,
- delay=1e-04, osFUN="osNoOp", pricemethod=c("market", "opside",
- "maker"), portfolio, symbol, ..., ruletype, TxnFees=0, prefer)}
+\usage{ruleSignal(data=mktdata, timestamp, sigcol, sigval, orderqty=0, ordertype, orderside, threshold, tmult=FALSE, replace=TRUE, delay=1e-04,
+ osFUN="osNoOp", pricemethod=c("market", "opside", "maker"), portfolio, symbol, ..., ruletype, TxnFees=0, prefer, sethold=FALSE)}
\description{default rule to generate a trade order on a signal}
\details{\code{pricemethod} may be one of 'market', 'opside', or 'maker'
which will either try to get the price of the 'market' at \code{timestamp} and use this as the order price
@@ -38,4 +36,5 @@
\item{...}{any other passthru parameters}
\item{ruletype}{one of "risk","order","rebalance","exit","entry", see \code{\link{add.rule}}}
\item{TxnFees}{numeric fees (usually negative) or function name for calculating TxnFees (processing happens later, not in this function)}
-\item{prefer}{price method for getPrice}}
+\item{prefer}{price method for getPrice}
+\item{sethold}{boolean, puts entry Rule processing on hold, default FALSE}}
Modified: pkg/quantstrat/man/sigComparison.Rd
===================================================================
--- pkg/quantstrat/man/sigComparison.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/sigComparison.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{sigComparison}
\alias{sigComparison}
\title{generate comparison signal...}
-\usage{sigComparison(label, data=mktdata, columns, relationship=c("gt", "lt",
- "eq", "gte", "lte"))}
+\usage{sigComparison(label, data=mktdata, columns, relationship=c("gt", "lt", "eq", "gte", "lte"))}
\description{generate comparison signal}
\details{Currently, this function compares two columns.
Patches to compare an arbitrary number of columns would be gladly accepted.
Modified: pkg/quantstrat/man/sigCrossover.Rd
===================================================================
--- pkg/quantstrat/man/sigCrossover.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/sigCrossover.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{sigCrossover}
\alias{sigCrossover}
\title{generate a crossover signal...}
-\usage{sigCrossover(label, data=mktdata, columns, relationship=c("gt", "lt",
- "eq", "gte", "lte"))}
+\usage{sigCrossover(label, data=mktdata, columns, relationship=c("gt", "lt", "eq", "gte", "lte"))}
\description{generate a crossover signal}
\details{This will generate a crossover signal, which is a dimension-reduced version
of a comparison signal \code{\link{sigComparison}}.
Modified: pkg/quantstrat/man/sigThreshold.Rd
===================================================================
--- pkg/quantstrat/man/sigThreshold.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/sigThreshold.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{sigThreshold}
\alias{sigThreshold}
\title{generate a threshold signal...}
-\usage{sigThreshold(label, data=mktdata, column, threshold=0,
- relationship=c("gt", "lt", "eq", "gte", "lte"), cross=FALSE)}
+\usage{sigThreshold(label, data=mktdata, column, threshold=0, relationship=c("gt", "lt", "eq", "gte", "lte"), cross=FALSE)}
\description{generate a threshold signal}
\details{Many strategies, including RSI or MACD styles, make trading decisions when an indicator
is over or under a specific threshold.
Modified: pkg/quantstrat/man/updateOrders.Rd
===================================================================
--- pkg/quantstrat/man/updateOrders.Rd 2011-01-02 14:37:36 UTC (rev 521)
+++ pkg/quantstrat/man/updateOrders.Rd 2011-01-02 14:46:43 UTC (rev 522)
@@ -1,8 +1,7 @@
\name{updateOrders}
\alias{updateOrders}
\title{update an order or orders...}
-\usage{updateOrders(portfolio, symbol, timespan, ordertype, side,
- oldstatus="open", newstatus, statustimestamp)}
+\usage{updateOrders(portfolio, symbol, timespan, ordertype, side, oldstatus="open", newstatus, statustimestamp)}
\description{update an order or orders}
\details{When an order gets filled, it should have its status moved to 'closed'.
More information about the Blotter-commits
mailing list