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 |
reduce |
Logical. If TRUE use |
market_prices |
Data frame containing the market prices. |
aggregate_price_fun |
Function to use to aggregate prices within
the round unit. Default to |
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, |
Value
A modified version of the input data frame.
Functions
-
aggregate_transactions
: Aggregate the data frame of investors' transactions that happened at the same datetime. -
reduce_transactions
: Reduce the data frame of investors' transactions by aggregating those transactions that happened within a time interval. -
clean_transactions
: Clean the data frame of investors' transactions. -
aggregate_market_prices
: Aggregate the data frame of market prices with a specific aggregate function within a time interval. -
subset_market_prices
: Subset the data frame of market prices based on investor's traded assets and datetimes of transactions. -
generate_data
: Generate investors' data from transactions and market prices.
See Also
closest_market_price
,
lubridate::round_date