calc.ret: Function to calculate returns from a price and ticker vector

View source: R/Utils.R

calc.retR Documentation

Function to calculate returns from a price and ticker vector

Description

Created so that a return column is added to a dataframe with prices in the long (tidy) format.

Usage

calc.ret(P, tickers = rep("ticker", length(P)), type.return = "arit")

Arguments

P

Price vector

tickers

Ticker of symbols (usefull if working with long dataframe)

type.return

Type of price return to calculate: 'arit' (default) - aritmetic, 'log' - log returns.

Value

A vector of returns

Examples

P <- c(1,2,3)
R <- calc.ret(P)

BatchGetSymbols documentation built on May 1, 2022, 5:07 p.m.