How to Install Quantstrat

Master R

By Guangming Lang Comment

quantstrat is a R package. It makes backtesting trading strategies easy. It is still under heavy development and can’t be installed from CRAN yet. You can install it from source and the process is straightforward.

Step1. Install these dependencies in R:

install.packages("FinancialInstrument")
install.packages("PerformanceAnalytics")
install.packages("foreach")

Step2. Go to R-forge and download the .tar.gz files for blotter and quantstrat, and run the following commands in R (change version numbers to reflect the version you downloaded):

install.packages("/Users/gmlang/Downloads/blotter_0.8.17.tar", repos = NULL, type="source")
install.packages("/Users/gmlang/Downloads/quantstrat_0.8.0.tar", repos = NULL, type="source")

shiny is a tool that allows you to easily make and publish web apps using R. Here’s an app I made using Shiny and Quantstrat to backtest a couple of trading strategies on a group of vanguard funds. I also made a version where you can enter your own stock symbols, however it can take 8-10 minutes to run.

A client of mine told me about a web service called Quantopian that allows you to easily build, test and execute your trading algorithms. I haven’t used it yet, but on the first look, it seems they’re doing a pretty good job.

If you enjoyed this post, get updates. It's FREE