powered by
Calculate sharp ratio of stock with running window.
Sharp(x, rf = 0, n = 10)
The sharp ratio series with length the same as x
vector of price
risk free rate
the length of running window
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