[Blotter-commits] r1707 - in pkg/quantstrat: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Nov 1 18:01:52 CET 2015
Author: bodanker
Date: 2015-11-01 18:01:52 +0100 (Sun, 01 Nov 2015)
New Revision: 1707
Added:
pkg/quantstrat/R/quantstrat-package.R
Modified:
pkg/quantstrat/DESCRIPTION
pkg/quantstrat/NAMESPACE
pkg/quantstrat/man/quantstrat-package.Rd
Log:
Import package dependencies into namespace
This was prompted by the nonsense that is dplyr::lag, which masks the
stats::lag generic and does not do any method dispatch. dplyr also
masks the first and last generics defined in xts. This should avoid any
issues in quantstrat if dplyr is loaded after xts. Note that user's
non-packaged code will still be affected by package load/attach order.
The above is achieved by creating R/quantstrat-package.R by calling
Rd2roxygen on man/quantstrat-package.Rd, and then adding the necessary
@import directives. Also add the "Generated by roxygen2" to quantstrat-
package.Rd so roxygen will update the file. Update Depends and Imports
in DESCRIPTION (and add a period at the end of the Description so R
CMD check won't pedantically complain).
Modified: pkg/quantstrat/DESCRIPTION
===================================================================
--- pkg/quantstrat/DESCRIPTION 2015-10-30 13:20:08 UTC (rev 1706)
+++ pkg/quantstrat/DESCRIPTION 2015-11-01 17:01:52 UTC (rev 1707)
@@ -5,10 +5,13 @@
Date: $Date$
Author: Peter Carl, Brian G. Peterson, Joshua Ulrich, Jan Humme
Depends:
- xts(>= 0.8-2),TTR(>= 0.2),
+ quantmod,
+ xts(>= 0.8-2),
blotter(>= 0.9),
FinancialInstrument(>= 0.12.5),
foreach(>= 1.4.0)
+Imports:
+ zoo
Suggests:
PerformanceAnalytics,
PortfolioAnalytics,
@@ -20,7 +23,7 @@
beanplot
Maintainer: Brian G. Peterson <brian at braverock.com>
Description: Specify, build, and back-test quantitative
- financial trading and portfolio strategies
+ financial trading and portfolio strategies.
Contributors: Yu Chen, Joe Dunn, Dirk Eddelbuettel,
Michael Guan, Jeffrey A. Ryan, Garrett See
LazyLoad: yes
Modified: pkg/quantstrat/NAMESPACE
===================================================================
--- pkg/quantstrat/NAMESPACE 2015-10-30 13:20:08 UTC (rev 1706)
+++ pkg/quantstrat/NAMESPACE 2015-11-01 17:01:52 UTC (rev 1707)
@@ -61,4 +61,9 @@
export(updateOrders)
export(updateStrategy)
export(walk.forward)
+import(FinancialInstrument)
+import(blotter)
+import(quantmod)
+import(xts)
+import(zoo)
useDynLib(quantstrat)
Added: pkg/quantstrat/R/quantstrat-package.R
===================================================================
--- pkg/quantstrat/R/quantstrat-package.R (rev 0)
+++ pkg/quantstrat/R/quantstrat-package.R 2015-11-01 17:01:52 UTC (rev 1707)
@@ -0,0 +1,106 @@
+#' Quantitative Strategy Model Framework
+#'
+#' Transaction-oriented infrastructure for constructing trading systems and
+#' simulation. Provides support for multi-asset class and multi-currency
+#' portfolios for backtesting and other financial research. Still in heavy
+#' development.
+#'
+#' quantstrat provides a generic infrastructure to model and backtest
+#' signal-based quantitative strategies. It is a high-level abstraction layer
+#' (built on xts, FinancialInstrument, blotter, etc.) that allows you to build
+#' and test strategies in very few lines of code. quantstrat is still under
+#' heavy development but is being used every day on real portfolios. We
+#' encourage you to send contributions and test cases to the project forums.
+#'
+#' \emph{Generic Signal-Based Strategy Modeling}
+#'
+#' A signal-based strategy model first generates indicators. Indicators are
+#' quantitative values derived from market data (e.g. moving averages, RSI,
+#' volatility bands, channels, momentum, etc.). Indicators should be applied
+#' to market data in a vectorized (for fast backtesting) or streaming (for live
+#' execution) fashion, and are assumed to be path-independent (i.e. they do not
+#' depend on account / portfolio characteristics, current positions, or
+#' trades).
+#'
+#' The interaction between indicators and market data are used to generate
+#' signals (e.g. crossovers, thresholds, multiples, etc.). These signals are
+#' points in time at which you may want to take some action, even though you
+#' may not be able to. Like indicators, signals may be applied in a vectorized
+#' or streaming fashion, and are assumed to be path-independent.
+#'
+#' Rules use market data, indicators, signals, and current account / portfolio
+#' characteristics to generate orders. Notice that rules about position
+#' sizing, fill simulation, order generation / management, etc. are separate
+#' from the indicator and signal generation process. Unlike indicators and
+#' signals, rules are generally evaluated in a path-dependent fashion
+#' (path-independent rules are supported but are rare in real life) and are
+#' aware of all prior market data and current positions at the time of
+#' evaluation. Rules may either generate new or modify existing orders (e.g.
+#' risk management, fill, rebalance, entry, exit).
+#'
+#' \emph{How quantstrat Models Strategies}
+#'
+#' quantstrat uses FinancialInstrument to specify instruments (including their
+#' currencies) and uses blotter to keep track of transactions, valuations, and
+#' P&L across portfolios and accounts.
+#'
+#' Indicators are often standard technical analysis functions like those found
+#' in TTR; and signals are often specified by the quantstrat sig* functions
+#' (i.e. sigComparison, sigCrossover, sigFormula, sigPeak, sigThreshold).
+#' Rules are typically specified with the quantstrat ruleSignal function.
+#'
+#' The functions used to specify indicators, signals, and rules are not limited
+#' to those mentioned previously. The name parameter to add.indicator,
+#' add.signal, and add.rule can be any R function. Because the supporting
+#' toolchain is built using xts objects, custom functions will integrate most
+#' easily if they return xts objects.
+#'
+#' The strategy model is created in layers and makes use of delayed execution.
+#' This means strategies can be applied--unmodified--to several different
+#' portfolios. Before execution, quantstrat strategy objects do not know what
+#' instruments they will be applied to or what parameters will be passed to
+#' them.
+#'
+#' For example, indicator parameters such as moving average periods or
+#' thresholds are likely to affect strategy performance. Default values for
+#' parameters may (optionally) be set in the strategy object, or set at
+#' call-time via the parameters argument of applyStrategy (parameters is a
+#' named list, used like the arguments lists).
+#'
+#' quantstrat models orders, which may or may not become transactions. This
+#' provides a lot of extra ability to evaluate how the strategy is actually
+#' working, not working, or could be improved. For example, the performance of
+#' strategies are often affected by how often resting limit orders are changed
+#' / replaced / canceled. An order book allows the quantitative strategist to
+#' examine market conditions at the time these decisions are made. Also, the
+#' order history allows for easy computation of things that are important for
+#' many strategies, like order-to-fill ratios.
+#'
+#' \emph{Argument Matching}
+#'
+#' Many places in quantstrat apply arguments passed in the strategy
+#' specification, the parameters list, or in \code{...} to an indicator,
+#' signal, or rule function. These arguments are matched in this order, with
+#' the last math overriding. Specifically, this order is:
+#'
+#' \enumerate{ \item the \code{arguments=list(...)} assigned to each indicator,
+#' signal, or rule \item the \code{parameters=list{...}} applied when
+#' \code{\link{applyStrategy}} is called \item any additional arguments passed
+#' in \code{...} in the call to \code{applyStrategy} }
+#'
+#' @name quantstrat-package
+#' @aliases quantstrat-package quantstrat
+#' @docType package
+#' @author Peter Carl, Brian G. Peterson, Joshua Ulrich, Garrett See, Yu Chen
+#'
+#' Maintainer: Brian G. Peterson <brian@@braverock.com>
+#' @seealso \code{\link[quantmod:quantmod-package]{quantmod}},
+#' \code{\link[blotter:blotter-package]{blotter}},
+#' \code{\link[FinancialInstrument:FinancialInstrument-package]{FinancialInstrument}},
+#' \code{\link[blotter:blotter-package]{blotter}},
+#' \code{\link[PerformanceAnalytics:PerformanceAnalytics-package]{PerformanceAnalytics}}
+#' @keywords package
+# @examples
+#'
+#' @import blotter FinancialInstrument quantmod xts zoo
+NULL
Modified: pkg/quantstrat/man/quantstrat-package.Rd
===================================================================
--- pkg/quantstrat/man/quantstrat-package.Rd 2015-10-30 13:20:08 UTC (rev 1706)
+++ pkg/quantstrat/man/quantstrat-package.Rd 2015-11-01 17:01:52 UTC (rev 1707)
@@ -1,3 +1,4 @@
+% Generated by roxygen2 (4.0.2): do not edit by hand
\name{quantstrat-package}
\alias{quantstrat-package}
\alias{quantstrat}
More information about the Blotter-commits
mailing list