updates: Update results over time

updatesR Documentation

Update results over time

Description

Update investor's portfolio, realized and paper results and time series disposition effect computations.

Usage

update_price(
  portfolio_quantity,
  portfolio_price,
  transaction_quantity,
  transaction_price,
  transaction_type
)

update_datetime(
  portfolio_quantity,
  portfolio_datetime,
  transaction_quantity,
  transaction_datetime,
  transaction_type
)

update_quantity(portfolio_quantity, transaction_quantity)

update_portfolio(
  portfolio,
  transaction_asset,
  transaction_quantity,
  transaction_price,
  transaction_datetime,
  transaction_type
)

update_realized_and_paper(realized_and_paper, new_realized_and_paper, method)

update_timeseries_DE(
  timeseries_DE,
  realized_and_paper,
  gainslosses,
  transaction_id,
  assets_time_series_DE = NULL,
  method
)

update_expectedvalue(realized_and_paper, num_transaction_assets)

Arguments

portfolio_quantity

Numeric value. The portfolio quantity of the traded asset.

portfolio_price

Numeric value. The portfolio price of the traded asset.

transaction_quantity

Numeric value. The quantity of the traded asset.

transaction_price

Numeric value. The market price of the traded asset.

transaction_type

Character string. Either "B" = buy or "S" = sell.

portfolio_datetime

POSIXct value. The date-time of the traded asset.

transaction_datetime

POSIXct value. The date-time at which the transaction is going to occur.

portfolio

Data frame of the investor's portfolio at time t.

transaction_asset

Character string. The name of the traded asset.

realized_and_paper

Data frame containing the realized and paper gains and losses results to be updated.

new_realized_and_paper

Data frame containing the realized and paper gains and losses results related to the new transaction.

method

Character string. The method used to compute papers. Allowed values are "count", "total", "value", "duration" and "all".

timeseries_DE

Data frame of time series disposition effect results.

transaction_id

Numeric, the id of transaction.

assets_time_series_DE

Character vector of assets' names as contained into portfolio_transactions on which to compute the time series disposition effect.

num_transaction_assets

Data frame containing the number of transactions for each asset traded by the investor.

Value

The updated input data.

Functions

  • update_price: Update the portfolio price of the traded asset.

  • update_datetime: Update the portfolio datetime of the traded asset.

  • update_quantity: Update the portfolio quantity of the traded asset.

  • update_portfolio: Update the portfolio with the new quantity, price and datetime of the traded asset.

  • update_realized_and_paper: Update the realized and paper gains and losses results with the results obtained on the last occurred transaction.

  • update_timeseries_DE: Update the time series disposition effect averaging values over time.

  • update_expectedvalue: Update the realized and paper gains and losses results averaging the total value by the number of transactions for each asset.


dispositionEffect documentation built on May 30, 2022, 9:05 a.m.