paper_compute: Papers' estimation

View source: R/paper.R

paper_computeR Documentation

Papers' estimation

Description

Compute paper gains and paper losses as either simple counts, total quantities, expected returns and financial duration.

Usage

paper_count(
  portfolio_quantity,
  portfolio_price,
  market_price,
  allow_short = TRUE
)

paper_total(
  portfolio_quantity,
  portfolio_price,
  market_price,
  allow_short = TRUE
)

paper_value(
  portfolio_quantity,
  portfolio_price,
  market_price,
  allow_short = TRUE
)

paper_duration(
  portfolio_quantity,
  portfolio_price,
  market_price,
  datetime_difference = NULL,
  previous_datetime = NULL,
  transaction_datetime = NULL,
  allow_short = TRUE
)

paper_compute(
  portfolio_quantity,
  portfolio_price,
  market_price,
  previous_datetime,
  transaction_datetime,
  assets,
  allow_short = TRUE,
  method = "all"
)

Arguments

portfolio_quantity

Numeric vector. The portfolio quantities of assets into the investor's portfolio.

portfolio_price

Numeric vector. The portfolio prices of assets into the investor's portfolio.

market_price

Numeric vector. The market prices of assets into the investor's portfolio.

allow_short

Logical. If TRUE short positions are allowed, otherwise only long positions are allowed.

datetime_difference

Numeric value of time difference between the previous_datetime and the transaction_datetime, computed through difftime_financial. If NULL, then previous_datetime and transaction_datetime must be specified.

previous_datetime

POSIXct value. The date-time of the last transaction performed by the investor.

transaction_datetime

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

assets

Character vector. The name of assets into the investor's portfolio but the traded asset.

method

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

Value

The described functions have different return behaviors

  • paper_compute returns a data frame containing the values of paper gains and paper losses computed by means of the chosen method on each portfolio assets.

  • paper_count returns a named vector containing the values of paper gains and paper losses computed using the count method.

  • paper_total returns a named vector containing the values of paper gains and paper losses computed using the total method.

  • paper_value returns a named vector containing the values of paper gains and paper losses computed using the value method.

  • paper_duration returns a named vector containing the values of paper gains and paper losses computed using the duration method.

In particular:

  • RG_"method" contains Realized Gains results

  • RL_"method" contains Realized Losses results

  • PG_"method" contains Paper Gains results

  • PL_"method" contains Paper Losses results

Functions

  • paper_count: Computation of paper gains and paper losses as simple counts (default method).

  • paper_total: Computation of paper gains and paper losses as total quantity of assets.

  • paper_value: Computation of paper gains and paper losses as expected return of assets.

  • paper_duration: Computation of paper gains and paper losses as financial duration.

  • paper_compute: Wrapper that calls other paper_. functions to compute paper gains and paper losses based on the chosen method.

See Also

realized_compute, gains_losses


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