Learn R Programming

RMOPI (version 1.1)

Sharp: Calculate Sharp Ratio with stock prices

Description

Calculate sharp ratio of stock with running window.

Usage

Sharp(x, rf = 0, n = 10)

Value

The sharp ratio series with length the same as x

Arguments

x

vector of price

rf

risk free rate

n

the length of running window

Examples

Run this code
date <- as.Date("2015-01-01") + days(0:29)
trade <- rTrade(date)
x <- trade$Close
Sharp(x)

Run the code above in your browser using DataLab