Description Usage Arguments Examples
Get the sharpe ratio of the performance of an object of class Strategy
.
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)
|
object |
An object of class |
rf |
Risk free rate in decimal, e.g. |
of |
Sharpe ratio to be calculated for assets separately or the portfolio sharpe. |
from |
The date in character format |
until |
The date in character format |
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 |
use.backtest |
If |
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.