sharpe: Get Sharpe Ratio of Performance

Description Usage Arguments Examples

Description

Get the sharpe ratio of the performance of an object of class Strategy.

Usage

1
2
3
4
5
6
7
8
9
sharpe(object, rf=0, of="portfolio"
     , from=NULL, until=NULL, which=NULL
     , scaling.periods=NULL, include.costs=TRUE
     , use.backtest=FALSE)

## S4 method for signature 'Strategy'
sharpe(object, rf = 0, of = c("portfolio", "assets"),
  from = NULL, until = NULL, which = NULL, scaling.periods = NULL,
  include.costs = TRUE, use.backtest = FALSE)

Arguments

object

An object of class Strategy.

rf

Risk free rate in decimal, e.g. rf=0.01 equals 1 percent.

of

Sharpe ratio to be calculated for assets separately or the portfolio sharpe.

from

The date in character format "yyyy-MM-dd" or as date-object from which performance shall be considered. If NULL, no restriction is made.

until

The date in character format "yyyy-MM-dd" or as date-object until which performance shall be considered. If NULL, no restriction is made.

which

Names or number of assets that should be included in calculation.

scaling.periods

Vector with annualization factors for sharpe ratio calculation. Default is 252, 52, 12, 4, 1 for daily, weekly, monthly, quarterly and yearly data respectively.

include.costs

If FALSE, the fixed and relative trading costs are NOT considered for performance calculation. Default value is TRUE. As default values for costs are 0, this argument is obsolete if no costs are given.

use.backtest

If TRUE, the performance of the backtesting output is considered for sharpe ratio calculation. If FALSE, the performance of the initial strategy execution are used.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run:

# MA(200)-Strategy
params <- list(k=200)
myStrat.MA <- Strategy(assets=assets, strat="MA", strat.params=params)

# Get sharpe of MA(200)-Strategy portfolio
sharpe(myStrat.MA, from="2015-01-01", until="2015-12-31")

# Get backtest annualized sharpe of MA(200)-Strategy (daily data = 252 trading days)
# sharpe(myStrat.MA, from="2015-01-01", until="2015-12-31", use.backtest=TRUE, scaling.periods=252)

## End(Not run)

Strategy documentation built on May 2, 2019, 2:09 a.m.