Learn R Programming

RTL (version 0.1.7)

tradeStats: tradeStats

Description

Compute list of risk reward metrics

Usage

tradeStats(x, Rf = 0)

Arguments

x

Univariate xts object of returns or dataframe with date and return variable.

Rf

Risk-free rate

Value

List of risk/reward metrics.

Examples

Run this code
# NOT RUN {
library(tidyverse)
library(tidyquant)
x <- tidyquant::tq_get("SPY") %>% dplyr::mutate(ret = log(adjusted / dplyr::lag(adjusted)))
x <- x %>% stats::na.omit()%>% dplyr::select(date,ret)
tradeStats(x = x,Rf=0)
# }

Run the code above in your browser using DataLab