Skip to contents

Calculate the Sharpe ratio, a measure of risk-adjusted return.

Usage

calc_sharpe(returns, rf_rate = 0, periods = 252)

Arguments

returns

Numeric vector of returns

rf_rate

Risk-free rate (default: 0)

periods

Number of periods per year (default: 252 for daily data)

Value

Numeric value representing the Sharpe ratio

Examples

if (FALSE) { # \dontrun{
returns <- c(0.01, 0.02, -0.01, 0.03)
calc_sharpe(returns, rf_rate = 0.02/252, periods = 252)
} # }