aggregate_price_and_mean_windows: Get Price and historic price mean windows from price...

Description Usage Arguments Value

View source: R/momentum_data.R

Description

Given price relatives and window sizes, returns a tibble with price windows, historic mean windows, and momentum values if desired.

Usage

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
)

Arguments

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 TRUE, includes rows for trading periods with either missing windows or missing next values/momenta

.check_input

If TRUE, checks that input meets the given assumptions.

momentum_window_size

determines how momentum is computed.

Value

A tibble (arranged by c(trading_period, asset)) subclassed to be of class @eval{AGG_WINDOW_CLASS_NAME} with columns

trading_period

The trading period during which prices change

asset

The name (or column index if no names are present) of the asset, corresponding with the column names of the argument price_relative_matrix

price

The price before the prices change at the end of the trading period

next_price

The price after the prices change at the end of the trading period

price_window

The price_window_size previous prices (including the price during the trading period) in chronological order (i.e. oldest first, newest last)

historic_price_mean

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)

next_historic_price_mean

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)

historic_price_mean_window

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)


benSepanski/pfselect documentation built on May 1, 2020, 1:57 p.m.