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

Description Usage Arguments Value Examples

View source: R/Utils.R

Description

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

Usage

1
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

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

BatchGetSymbols documentation built on May 9, 2018, 1:05 a.m.