get_contrato_returns: returns of the total valuation per contrato

Description Usage Arguments Details Value Examples

View source: R/posiciones.R

Description

Create return data per contract for each contrato

Usage

1
get_contrato_returns(position, cumulative = FALSE)

Arguments

position

A position data.frame object assumed to be generated using get_position

cumulative

A boolean indicated whether returns are cumulative or daily. Defaults to FALSE

Details

This function takes a position data.frame and uses it to compute the return of the contrato by taking the percent change of each date's valuation and its previous valuation indicated by the column named tot.

Value

A xts (time series) object indexed by the date and with each column representing the daily return of the contrato. Returns are give in the form of valuation ratio (final_price/initial_price)

Examples

1
2
pos <- get_position(c("2015-12-31", "2016-01-04", "2016-01-05"), contrato = c("25774", "25773"))
get_position_returns(pos)

optimist/inhouse documentation built on May 24, 2019, 3:56 p.m.