Description Usage Arguments Value
View source: R/momentum_data.R
Given price relatives and window sizes, returns a tibble with price windows, historic mean windows, and momentum values if desired.
1 2 3 4 5 6 7 8 9 | aggregate_price_and_mean_windows(
price_relative_matrix,
decay_factor,
price_window_size,
historic_mean_window_size,
initial_prices = NULL,
include_missing = FALSE,
.check_input = TRUE
)
|
price_relative_matrix |
a matrix of price relatives, each row representing a trading period and each column an asset. A price relative is p_{t+1} / p_t, i.e. the ratio of trading price to next price. Prices change according to the price relatives after the trade, i.e. the price relatives for the trading period are not known at trading time |
decay_factor |
the decay factor for the mean (see description) |
historic_mean_window_size |
The size of the historic price mean window to include |
initial_prices |
A vector holding the initial prices of each asset i |
include_missing |
If |
.check_input |
If |
momentum_window_size |
determines how momentum is computed. |
A tibble (arranged by c(trading_period, asset)
)
subclassed to be of class @eval{AGG_WINDOW_CLASS_NAME}
with columns
The trading period during which prices change
The name (or column index if no names are present)
of the asset, corresponding with the column names
of the argument price_relative_matrix
The price before the prices change at the end of the trading period
The price after the prices change at the end of the trading period
The price_window_size
previous prices
(including the price during the trading period)
in chronological order (i.e. oldest first,
newest last)
The historic price mean
with decay factor decay_factor
(see compute_historic_price_means)
during trading (before prices changes at the end
of the current trading period)
The historic price mean
with decay factor decay_factor
(see compute_historic_price_means)
after trading (after prices change
at the end of the current trading period)
The previous
historic_mean_window_size
many historic price means. These
are not used to compute anything,
but may be desired as features.
They are also in chronological order,
oldest -> newest.
You should not modify the values of these columns except using methods defined in this package (unless you know what you're doing... you know who you are)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.