Skip to content

Commit

Permalink
refresh docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Sep 11, 2024
1 parent 2724162 commit 22cbae7
Show file tree
Hide file tree
Showing 31 changed files with 272 additions and 238 deletions.
14 changes: 8 additions & 6 deletions R/ichimoku.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@
#' ichimoku analysis.
#' @param keep.data [default FALSE] set to TRUE to retain additional data
#' present in the input object as additional columns and/or attributes.
#' @param ... additional arguments, for instance 'holidays', passed along to
#' \code{\link{tradingDays}} for calculating the future cloud on daily data.

#' @param ... additional arguments, for instance \sQuote{holidays}, passed along
#' to \code{\link{tradingDays}} for calculating the future cloud on daily
#' data.
#'
#' @return An ichimoku object with S3 classes of 'ichimoku', 'xts' and 'zoo'.
#' @return An ichimoku object with S3 classes of \sQuote{ichimoku}, \sQuote{xts}
#' and \sQuote{zoo}.
#'
#' @details Calling an ichimoku object automatically invokes its print method,
#' which by default produces a printout of the data to the console as well
Expand Down Expand Up @@ -308,9 +309,10 @@ ichimoku.default <- function(x, ticker, periods = c(9L, 26L, 52L), keep.data = F
#'
#' @details A faster version of \code{\link{ichimoku}} which can be used when
#' the data is a dataframe in the prescribed format. Does not support the
#' argument 'keep.data'.
#' argument \sQuote{keep.data}.
#'
#' @return An ichimoku object with S3 classes of 'ichimoku', 'xts' and 'zoo'.
#' @return An ichimoku object with S3 classes of \sQuote{ichimoku}, \sQuote{xts}
#' and \sQuote{zoo}.
#'
#' @keywords internal
#' @export
Expand Down
26 changes: 13 additions & 13 deletions R/iplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@
#' environment. Intuitive cursor infotip provides ready access to the data
#' directly from the chart.
#'
#' @param x an object of class 'ichimoku'.
#' @param theme [default 'classic'] with further choices of 'dark', 'mono',
#' 'noguchi', 'okabe-ito' or 'solarized'.
#' @param x an object of class \sQuote{ichimoku}.
#' @param theme [default 'classic'] with further choices of \sQuote{dark},
#' \sQuote{mono}, \sQuote{noguchi}, \sQuote{okabe-ito} or \sQuote{solarized}.
#' @inheritParams plot.ichimoku
#' @param ... additional parameters passed along to the 'options' argument of
#' \code{shiny::shinyApp()}.
#' @param launch.browser [default TRUE] If TRUE, the system's default web browser
#' will be launched automatically after the app is started. The value of this
#' argument can also be a function to call with the application's URL. To use
#' the default Shiny viewer in RStudio, please specify
#' \code{getOption("shiny.launch.browser")}.
#'
#' @return A Shiny app object with class 'shiny.appobj'. With default arguments,
#' the Shiny app is launched in the default browser.
#' @param ... additional parameters passed along to the \sQuote{options}
#' argument of \code{shiny::shinyApp()}.
#' @param launch.browser [default TRUE] If TRUE, the system's default web
#' browser will be launched automatically after the app is started. The
#' value of this argument can also be a function to call with the
#' application's URL. To use the default Shiny viewer in RStudio, please
#' specify \code{getOption("shiny.launch.browser")}.
#'
#' @return A Shiny app object with class \sQuote{shiny.appobj}. With default
#' arguments, the Shiny app is launched in the default browser.
#'
#' @details For further details please refer to the reference vignette by
#' calling: \code{vignette("reference", package = "ichimoku")}
Expand Down
67 changes: 35 additions & 32 deletions R/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#' Default print method for ichimoku objects to enable automatic plotting of the
#' ichimoku cloud chart.
#'
#' @param x an object of class 'ichimoku'.
#' @param x an object of class \sQuote{ichimoku}.
#' @param plot [default TRUE] set to FALSE to prevent automatic plotting of
#' the ichimoku cloud chart.
#' @param rows [default 26L] integer number of rows to print.
Expand All @@ -33,8 +33,8 @@
#' depending on the parameters set.
#'
#' @details This function is an S3 method for the generic function print() for
#' class 'ichimoku'. It can be invoked by calling print(x) on an object 'x'
#' of class 'ichimoku'.
#' class \sQuote{ichimoku}. It can be invoked by calling print(x) on an
#' object \sQuote{x} of class \sQuote{ichimoku}.
#'
#' @examples
#' cloud <- ichimoku(sample_ohlc_data, ticker = "TKR")
Expand All @@ -59,15 +59,15 @@ print.ichimoku <- function(x, plot = TRUE, rows = 26L, ...) {
#'
#' Compactly display the internal structure of ichimoku objects.
#'
#' @param object an object of class 'ichimoku'.
#' @param object an object of class \sQuote{ichimoku}.
#' @param ... arguments passed to or from other methods.
#'
#' @return Invisible NULL. A compact display of the structure of the object is
#' output to the console.
#'
#' @details This function is an S3 method for the generic function str()
#' for class 'ichimoku'. It can be invoked by calling str(x) on an
#' object 'x' of class 'ichimoku'.
#' @details This function is an S3 method for the generic function str() for
#' class \sQuote{ichimoku}. It can be invoked by calling str(x) on an object
#' \sQuote{x} of class \sQuote{ichimoku}.
#'
#' @examples
#' cloud <- ichimoku(sample_ohlc_data, ticker = "TKR")
Expand Down Expand Up @@ -118,18 +118,19 @@ str.ichimoku <- function(object, ...) {
#'
#' Display summary information for an ichimoku object or its strategy.
#'
#' @param object an object of class 'ichimoku'.
#' @param object an object of class \sQuote{ichimoku}.
#' @param strat [default TRUE] to show the strategy summary if present. Set to
#' FALSE to show the object summary instead.
#' @param ... arguments passed to or from other methods.
#'
#' @return A matrix containing the strategy summary, if present and 'strat' is
#' set to TRUE, otherwise a character vector containing an abbreviated object
#' summary (the full object summary is output to the console).
#' @return A matrix containing the strategy summary, if present and
#' \sQuote{strat} is set to TRUE, otherwise a character vector containing an
#' abbreviated object summary (the full object summary is output to the
#' console).
#'
#' @details This function is an S3 method for the generic function summary() for
#' class 'ichimoku'. It can be invoked by calling summary(x) on an object 'x'
#' of class 'ichimoku'.
#' class \sQuote{ichimoku}. It can be invoked by calling summary(x) on an
#' object \sQuote{x} of class \sQuote{ichimoku}.
#'
#' Performs basic validation for an ichimoku object and will inform if an
#' ichimoku object contains invalid information.
Expand Down Expand Up @@ -201,19 +202,19 @@ summary.ichimoku <- function(object, strat = TRUE, ...) {
#'
#' An optimised 'ichimoku' to 'data.frame' constructor.
#'
#' @param x an object of class 'ichimoku'.
#' @param x an object of class \sQuote{ichimoku}.
#' @param row.names not used.
#' @param optional not used.
#' @param keep.attrs [default FALSE] if set to TRUE, will preserve any custom
#' attributes set on the original object.
#' @param ... arguments passed to or from other methods.
#'
#' @return A 'data.frame' object. The ichimoku object index is preserved as the
#' first column with header 'index'.
#' @return A \sQuote{data.frame} object. The ichimoku object index is preserved
#' as the first column with header \sQuote{index}.
#'
#' @details This function is an S3 method for the generic function
#' as.data.frame() for class 'ichimoku'. It can be invoked by calling
#' as.data.frame(x) on an object 'x' of class 'ichimoku'.
#' as.data.frame() for class \sQuote{ichimoku}. It can be invoked by calling
#' as.data.frame(x) on an object \sQuote{x} of class \sQuote{ichimoku}.
#'
#' @examples
#' cloud <- ichimoku(sample_ohlc_data)
Expand All @@ -238,19 +239,20 @@ NULL
#'
#' Method for extracting the core data matrix of ichimoku objects.
#'
#' @param x an object of class 'ichimoku'.
#' @param x an object of class \sQuote{ichimoku}.
#' @param fmt (optional) set to TRUE to retain the index as row names of the
#' returned matrix, or a character string passed on to the 'format' argument
#' of \code{format.POSIXct()} to format these values in a specific way.
#' returned matrix, or a character string passed on to the \sQuote{format}
#' argument of \code{format.POSIXct()} to format these values in a specific
#' way.
#' @param ... arguments passed to or from other methods.
#'
#' @return A numeric matrix containing the ichimoku object data, stripped of the
#' index unless 'fmt' is specified in which case the index will be retained
#' as character values in the matrix row names.
#' index unless \sQuote{fmt} is specified in which case the index will be
#' retained as character values in the matrix row names.
#'
#' @details This function is an S3 method for the generic function coredata()
#' for class 'ichimoku'. It can be invoked by calling coredata(x) on an
#' object 'x' of class 'ichimoku'.
#' for class \sQuote{ichimoku}. It can be invoked by calling coredata(x) on
#' an object \sQuote{x} of class \sQuote{ichimoku}.
#'
#' @examples
#' cloud <- ichimoku(sample_ohlc_data)
Expand Down Expand Up @@ -284,20 +286,21 @@ NULL
#'
#' Method for extracting the date-time index of ichimoku objects.
#'
#' @param x an object of class 'ichimoku'.
#' @param subset an integer or logical value or vector by which to subset the index.
#' @param x an object of class \sQuote{ichimoku}.
#' @param subset an integer or logical value or vector by which to subset the
#' index.
#' @param ... arguments passed to or from other methods.
#'
#' @return The date-time index of the ichimoku object as a vector of POSIXct
#' values.
#'
#' @details This function is an S3 method for the generic function index()
#' for class 'ichimoku'. It can be invoked by calling index(x) on an
#' object 'x' of class 'ichimoku'.
#' @details This function is an S3 method for the generic function index() for
#' class \sQuote{ichimoku}. It can be invoked by calling index(x) on an
#' object \sQuote{x} of class \sQuote{ichimoku}.
#'
#' Subsetting by specifying the 'subset' parameter subsets using the
#' Subsetting by specifying the \sQuote{subset} parameter subsets using the
#' numerical values underlying the POSIXct times and results in a faster
#' operation than usual subset operators such as '['.
#' operation than usual subset operators such as \sQuote{\[}.
#'
#' @examples
#' cloud <- ichimoku(sample_ohlc_data)
Expand Down
34 changes: 18 additions & 16 deletions R/mltools.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
#' @param quietly (optional) if set to TRUE, will suppress printing of additional
#' output to the console and return quietly.
#'
#' @return Returned invisibly, a list of 'n' ichimoku objects containing
#' strategies, with attributes 'logret' (a vector of cumulative log returns
#' for all strategies) and 'summary' (a matrix of summaries for the top 'n'
#' strategies).
#' @return Returned invisibly, a list of \sQuote{n} ichimoku objects containing
#' strategies, with attributes \sQuote{logret} (a vector of cumulative log
#' returns for all strategies) and \sQuote{summary} (a matrix of summaries
#' for the top \sQuote{n} strategies).
#'
#' In addition, the strategy summaries are printed to the console.
#'
#' @details Ichimoku objects for each strategy are returned as a list. The
#' cumulative log returns for all strategies as well as the summaries for
#' the top 'n' strategies are saved as attributes to the list. This
#' the top \sQuote{n} strategies are saved as attributes to the list. This
#' information may be retrieved by using \code{\link{look}} on the returned
#' list.
#'
Expand Down Expand Up @@ -173,8 +173,8 @@ autostrat <- function(x,
#' @param type [default 'boolean'] choose 'boolean', 'numeric' or 'z-score'.
#' 'boolean' creates a grid of dummy variables for ichimoku indicator
#' conditions of the form 1 if c1 > c2, 0 otherwise. 'numeric' creates a
#' grid of the numeric difference c1 - c2. 'z-score' standardises the numeric
#' grid by the mean and standard deviation of each feature.
#' grid of the numeric difference c1 - c2. 'z-score' standardises the
#' numeric grid by the mean and standard deviation of each feature.
#' @param format [default 'dataframe'] select either 'dataframe' or 'matrix' for
#' the format of returned object.
#' @param unique [default TRUE] to return only unique combinations of c1 and c2.
Expand All @@ -184,24 +184,26 @@ autostrat <- function(x,
#' within the function, referencing intermediate objects such as:
#' 'core', the coredata matrix of the ichimoku object, 'xlen' the number of
#' observations, or any of the function parameters etc. Each evaluated
#' expression must return a vector of length 'xlen' for inclusion in the grid.
#' expression must return a vector of length 'xlen' for inclusion in the
#' grid.
#'
#' @return A data.frame or matrix in a 'tidy' format with one observation per
#' row and one feature per column with the target 'y' as the first column
#' (unless set to 'none').
#' @return A data.frame or matrix in a tidy format with one observation per
#' row and one feature per column with the target \sQuote{y} as the first
#' column (unless set to \sQuote{none}).
#'
#' The 'y' and 'k' parameters, trade direction and grid type are set as
#' attributes, with 'means' and 'sdevs' also populated for type 'z-score' to
#' return the mean and standard deviation for each column. To view these,
#' use \code{\link{look}} on the returned object.
#' The \sQuote{y} and \sQuote{k} parameters, trade direction and grid type
#' are set as attributes, with \sQuote{means} and \sQuote{sdevs} also
#' populated for type \sQuote{z-score} to return the mean and standard
#' deviation for each column. To view these, use \code{\link{look}} on the
#' returned object.
#'
#' @details The date-time index corresponds to when the indicator condition is
#' met at the close for that period. The return is the k-period return
#' achieved by transacting at the immediately following opening price until
#' the next opening price.
#'
#' Only valid combinations are included. This excludes any combination
#' involving 'open' as it is in effect a lagged indicator and not
#' involving \sQuote{open} as it is in effect a lagged indicator and not
#' contemporaneous. The following trivial or highly-collinear pairs are also
#' excluded: (high, close), (low, close), (low, high), (cloudTop, Senkou A),
#' (cloudBase, senkou A), (cloudTop, senkouB), (cloudBase, senkouB),
Expand Down
24 changes: 13 additions & 11 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@
#'
#' Plot Ichimoku Kinko Hyo cloud charts from ichimoku objects.
#'
#' @param x an object of class 'ichimoku'.
#' @param x an object of class \sQuote{ichimoku}.
#' @param window (optional) a date-time window to subset the plot, in ISO-8601
#' compatible range strings of the format used for 'xts' objects, for example
#' "2020-02-15/2020-08-15" or "2020-02-15/", "/2020-08" or "2020-07".
#' compatible range strings of the format used for \sQuote{xts} objects, for
#' example "2020-02-15/2020-08-15" or "2020-02-15/", "/2020-08" or "2020-07".
#' @param ticker (optional) specify a ticker (or other text) to include in the
#' chart heading. If not set, the ticker saved within the ichimoku object
#' will be used.
#' @param subtitle (optional) specify a subtitle to display under the chart title.
#' @param theme [default 'classic'] with further choices of 'dark', 'mono',
#' 'noguchi', 'okabe-ito' or 'solarized'. Alternatively, supply a vector
#' of 12 colour values (hex codes or names) as a user-defined theme.
#' @param subtitle (optional) specify a subtitle to display under the chart
#' title.
#' @param theme [default 'classic'] with further choices of \sQuote{dark},
#' \sQuote{mono}, \sQuote{noguchi}, \sQuote{okabe-ito} or \sQuote{solarized}.
#' Alternatively, supply a vector of 12 colour values (hex codes or names)
#' as a user-defined theme.
#' @param strat [default TRUE] if the ichimoku object contains a strategy, the
#' periods for which the strategy results in a position will be shaded, and
#' the strategy printed as the chart subtitle (if not otherwise specified).
Expand All @@ -42,15 +44,15 @@
#' matching the column name of the variable to be displayed as sub-plot.
#' Specify \code{type = 'bar'} or \code{type = 'line'}, otherwise other type
#' settings will take precedence.
#' @param ... additional arguments passed along to the print method for 'ggplot'
#' objects.
#' @param ... additional arguments passed along to the print method for
#' \sQuote{ggplot} objects.
#'
#' @return The ichimoku object supplied (invisibly). The requested plot is output
#' to the graphical device.
#'
#' @details This function is an S3 method for the generic function plot() for
#' class 'ichimoku'. It can be invoked by calling plot(x) on an object 'x'
#' of class 'ichimoku'.
#' class \sQuote{ichimoku}. It can be invoked by calling plot(x) on an
#' object \sQuote{x} of class \sQuote{ichimoku}.
#'
#' For further details please refer to the reference vignette by calling:
#' \code{vignette("reference", package = "ichimoku")}
Expand Down
5 changes: 3 additions & 2 deletions R/switch.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@

#' Switch Default OANDA Server
#'
#' Switch the default OANDA fxTrade server from 'practice' to 'live' or vice versa.
#' Settings persist for the current session only.
#' Switch the default OANDA fxTrade server from \sQuote{practice} to
#' \sQuote{live} or vice versa. Settings persist for the current session
#' only.
#'
#' @return Invisible NULL. A message informs the resulting default server setting.
#'
Expand Down
Loading

0 comments on commit 22cbae7

Please sign in to comment.