manipulate_initial_data {dispositionEffect}R Documentation

Pre-process transactions and market prices data frames

Description

These functions allows to pre-process transactions and market prices data frames performing aggregation and subsetting operations.

Usage

aggregate_transactions(portfolio_transactions, unit = "1 mins")

reduce_transactions(portfolio_transactions, unit = "1 mins")

clean_transactions(portfolio_transactions, unit = "1 mins", reduce = FALSE)

aggregate_market_prices(market_prices, unit = NULL, aggregate_price_fun = mean)

subset_market_prices(
  market_prices,
  portfolio_assets,
  portfolio_datetimes,
  unit = NULL
)

generate_data(
  portfolio_transactions,
  market_prices,
  investor_name = NULL,
  unit = NULL,
  subset = FALSE
)

Arguments

portfolio_transactions

Data frame. The investor's transactions data frame.

unit

Character string specifying a time unit or a multiple of a unit to be rounded to. Valid base units are second, minute, hour, day, week, etc. See lubridate::round_date.

reduce

Logical. If TRUE use reduce_transactions, otherwise use aggregate_transactions to aggregate portfolio transactions.

market_prices

Data frame containing the market prices.

aggregate_price_fun

Function to use to aggregate prices within the round unit. Default to mean.

portfolio_assets

Character vector of the transaction assets.

portfolio_datetimes

POSIXct vector of the transaction datetimes.

investor_name

Character. The name to be assigned to the investor.

subset

Logical. If TRUE, subset_market_prices is used to generate investor's data.

Value

A modified version of the input data frame.

Functions

See Also

closest_market_price, lubridate::round_date


[Package dispositionEffect version 1.0.1 Index]