This package allows users to apply customizable quantitative trading strategies to historical portfolio data. An S4 class called "Strategy" is implemented that creates objects from which vaious performance measurements may be extracted, visualized and compared. A template for custom quantitative strategies is available and so the package can be extended in an easy way and still all methods are available for consistent evaluations.
Strategy-object contains all relevant information about the strategy executed on the portfolio data. Dependent packages are
There is no data available within this package.
library(Strategy) # Generate positive random walks for random assets set.seed(2) len <- 1000 n <- 10 assets <- abs(apply(matrix(rnorm(n*len), ncol=n), 2, cumsum)) + 100 colnames(assets) <- paste0("asset", 1:n) assets <- xts(assets, order.by = seq(from=Sys.Date()-len, length.out=len, by="d")) # MA(200)-strategy myStrat.MA200 <- Strategy(assets = assets , strat = "MA" , strat.params = list(k=200))
# Plot MA(200)-strategy of first asset plot(myStrat.MA200, which.assets=1, from="2015-01-01", main="HA")
"He who gives up [code] safety for [code] speed deserves neither." (via)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.