Compute paper gains and paper losses as either simple counts, total quantities, expected returns and financial duration.
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"
)
Numeric vector. The portfolio quantities of assets into the investor's portfolio.
Numeric vector. The portfolio prices of assets into the investor's portfolio.
Numeric vector. The market prices of assets into the investor's portfolio.
Logical. If TRUE short positions are allowed, otherwise only long positions are allowed.
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.
POSIXct value. The date-time of the last transaction performed by the investor.
POSIXct value. The date-time at which the transaction is going to occur.
Character vector. The name of assets into the investor's portfolio but the traded asset.
Character string. The method used to compute papers. Allowed values are "count", "total", "value", "duration" and "all".
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
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.